fix(仪表盘): 处理空数据时同步清空图表显示

当查询结果为空时,确保仪表盘和排名图表被清空,避免显示旧数据
main
zch 4 weeks ago
parent 498dad2b15
commit 08f83fb91e

@ -133,9 +133,16 @@ const renderCharts = () => {
data: [{ value: toNumber(item.value), name: item.name }] data: [{ value: toNumber(item.value), name: item.name }]
})) }))
}); });
} else {
// KPI
gaugeChart.value?.setData(null);
} }
if (hasMultiDevice.value) { if (hasMultiDevice.value) {
if (!deviceRanks.length) {
rankChart.value?.setData(null);
return;
}
rankChart.value?.setData({ rankChart.value?.setData({
tooltip: { trigger: 'axis' }, tooltip: { trigger: 'axis' },
xAxis: { type: 'value' }, xAxis: { type: 'value' },
@ -152,7 +159,10 @@ const renderCharts = () => {
} }
const stats = overviewData.value.primaryMetricStats; const stats = overviewData.value.primaryMetricStats;
if (!stats) return; if (!stats) {
rankChart.value?.setData(null);
return;
}
rankChart.value?.setData({ rankChart.value?.setData({
xAxis: { type: 'category', data: ['最小值', '均值', '最大值'] }, xAxis: { type: 'category', data: ['最小值', '均值', '最大值'] },
yAxis: { type: 'value', name: overviewData.value.unit || '' }, yAxis: { type: 'value', name: overviewData.value.unit || '' },

Loading…
Cancel
Save