feat: dashboard when loading and no data is present show blank chart (#6550)

- If no data is present and the chart is loading, there's now an option
to show a blank chart
- #6557
This commit is contained in:
ktx-vaidehi
2025-04-16 11:12:47 +05:30
committed by GitHub
parent 4a0ecfe239
commit 2edefdb0bf
4 changed files with 28 additions and 14 deletions
@@ -89,13 +89,18 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
v-else
:data="
panelSchema.queryType === 'promql' ||
(data.length &&
data[0]?.length &&
panelData.chartType != 'geomap' &&
(panelData.chartType != 'geomap' &&
panelData.chartType != 'table' &&
panelData.chartType != 'maps')
panelData.chartType != 'maps' &&
loading)
? panelData
: { options: { backgroundColor: 'transparent' } }
: noData == 'No Data'
? {
options: {
backgroundColor: 'transparent',
},
}
: panelData
"
:height="chartPanelHeight"
@updated:data-zoom="onDataZoom"
@@ -107,7 +112,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
v-if="
!errorDetail?.message &&
panelSchema.type != 'geomap' &&
panelSchema.type != 'maps'
panelSchema.type != 'maps' &&
!loading
"
class="noData"
data-test="no-data"
+2 -2
View File
@@ -761,8 +761,8 @@
"default": "Default",
"numbers": "Numbers",
"bytes": "Bytes",
"kilobytes": "Kilobytes (kb)",
"megabytes": "Megabytes (mb)",
"kilobytes": "Kilobytes (KB)",
"megabytes": "Megabytes (MB)",
"bytesPerSecond": "Bytes/Second",
"seconds": "Seconds (s)",
"microseconds": "Microseconds (μs)",
+6 -2
View File
@@ -349,7 +349,9 @@ export const convertPromQLData = async (
xAxis: {
type: "time",
axisLine: {
show: panelSchema.config?.axis_border_show || false,
show: searchQueryData?.every((it: any) => it.result.length == 0)
? true
: (panelSchema.config?.axis_border_show ?? false),
},
splitLine: {
show: true,
@@ -379,7 +381,9 @@ export const convertPromQLData = async (
},
},
axisLine: {
show: panelSchema.config?.axis_border_show || false,
show: searchQueryData?.every((it: any) => it.result.length == 0)
? true
: (panelSchema.config?.axis_border_show ?? false),
},
splitLine: {
show: true,
+8 -4
View File
@@ -1111,7 +1111,9 @@ export const convertSQLData = async (
show: true,
},
axisLine: {
show: panelSchema.config?.axis_border_show || false,
show: searchQueryData?.every((it: any) => it.length == 0)
? true
: (panelSchema.config?.axis_border_show ?? false),
},
axisTick: {
show: xAxisKeys.length + breakDownKeys.length == 1 ? false : true,
@@ -1170,7 +1172,9 @@ export const convertSQLData = async (
show: true,
},
axisLine: {
show: panelSchema.config?.axis_border_show || false,
show: searchQueryData?.every((it: any) => it.length == 0)
? true
: (panelSchema.config?.axis_border_show ?? false),
},
},
toolbox: {
@@ -2643,9 +2647,9 @@ export const convertSQLData = async (
if (!["metric", "gauge"].includes(panelSchema.type)) {
options.series = options.series.filter((it: any) => it.data?.length);
if (panelSchema.type == "h-bar" || panelSchema.type == "h-stacked") {
options.xAxis = options.series.length ? options.xAxis : {};
options.xAxis = options.xAxis;
} else if (!["pie", "donut"].includes(panelSchema.type)) {
options.yAxis = options.series.length ? options.yAxis : {};
options.yAxis = options.yAxis;
}
}