指标拟合图没有数据的时候也要展示x,y轴
This commit is contained in:
@@ -62,7 +62,6 @@
|
|||||||
width: prop.width,
|
width: prop.width,
|
||||||
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`
|
height: `calc(${prop.height} - ${headerHeight}px + ${fullscreen ? 0 : 56}px )`
|
||||||
}"
|
}"
|
||||||
v-if="showEchart"
|
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -94,8 +93,6 @@ const powerList: any = ref()
|
|||||||
|
|
||||||
const countData: any = ref([])
|
const countData: any = ref([])
|
||||||
|
|
||||||
const showEchart = ref(true)
|
|
||||||
|
|
||||||
const chartsList = ref<any>([])
|
const chartsList = ref<any>([])
|
||||||
|
|
||||||
// 计算是否全屏展示
|
// 计算是否全屏展示
|
||||||
@@ -198,12 +195,6 @@ const setEchart = () => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 检查是否有数据
|
|
||||||
if (!chartsList.value || chartsList.value.length === 0) {
|
|
||||||
showEchart.value = false // 没有数据时隐藏图表
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// 用户功率数据和电能质量数据
|
// 用户功率数据和电能质量数据
|
||||||
let powerData: any[] = []
|
let powerData: any[] = []
|
||||||
@@ -242,20 +233,11 @@ const setEchart = () => {
|
|||||||
const hasPowerData = processedPowerData.length > 0 && processedPowerData.some(item => item[1] !== null)
|
const hasPowerData = processedPowerData.length > 0 && processedPowerData.some(item => item[1] !== null)
|
||||||
const hasQualityData = processedQualityData.length > 0 && processedQualityData.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[0].data = processedPowerData
|
||||||
echartList.value.options.series[1].data = processedQualityData
|
echartList.value.options.series[1].data = processedQualityData
|
||||||
|
|
||||||
// 确保图表显示
|
|
||||||
showEchart.value = true
|
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('处理图表数据时出错:', error)
|
console.error('处理图表数据时出错:', error)
|
||||||
showEchart.value = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -330,11 +312,9 @@ const tableStore: any = new TableStore({
|
|||||||
loadCallback: () => {
|
loadCallback: () => {
|
||||||
tableStore.table.height = `calc(${prop.height} - 80px)`
|
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))
|
chartsList.value = JSON.parse(JSON.stringify(tableStore.table.data))
|
||||||
setEchart()
|
setEchart()
|
||||||
} else if (tableStore.table.data) {
|
|
||||||
showEchart.value = false
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user