指标拟合图没有数据的时候也要展示x,y轴

This commit is contained in:
stt
2025-11-27 14:36:27 +08:00
parent 9117a6e3c6
commit 3745d91a9d

View File

@@ -62,7 +62,6 @@
width: prop.width,
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`
}"
v-if="showEchart"
/>
</div>
</div>
@@ -94,8 +93,6 @@ const powerList: any = ref()
const countData: any = ref([])
const showEchart = ref(true)
const chartsList = ref<any>([])
// 计算是否全屏展示
@@ -198,12 +195,6 @@ const setEchart = () => {
}
}
// 检查是否有数据
if (!chartsList.value || chartsList.value.length === 0) {
showEchart.value = false // 没有数据时隐藏图表
return
}
try {
// 用户功率数据和电能质量数据
let powerData: any[] = []
@@ -242,20 +233,11 @@ const setEchart = () => {
const hasPowerData = processedPowerData.length > 0 && processedPowerData.some(item => item[1] !== null)
const hasQualityData = processedQualityData.length > 0 && processedQualityData.some(item => item[1] !== null)
if (!hasPowerData && !hasQualityData) {
showEchart.value = false
return
}
// 更新图表配置
echartList.value.options.series[0].data = processedPowerData
echartList.value.options.series[1].data = processedQualityData
// 确保图表显示
showEchart.value = true
} catch (error) {
console.error('处理图表数据时出错:', error)
showEchart.value = false
}
}
@@ -330,11 +312,9 @@ const tableStore: any = new TableStore({
loadCallback: () => {
tableStore.table.height = `calc(${prop.height} - 80px)`
// 数据加载完成后的处理
if (tableStore.table.data && tableStore.table.data.length > 0) {
if (tableStore.table.data) {
chartsList.value = JSON.parse(JSON.stringify(tableStore.table.data))
setEchart()
} else if (tableStore.table.data) {
showEchart.value = false
}
}
})