稳定提交
This commit is contained in:
parent
aafd49217c
commit
d16e99c63c
|
@ -4,14 +4,14 @@
|
|||
<div v-if="loading" class="loading-mask">
|
||||
<div class="loading-spinner"></div>
|
||||
</div>
|
||||
|
||||
<div
|
||||
ref="chartRef"
|
||||
:style="{
|
||||
width: width,
|
||||
|
||||
<div
|
||||
ref="chartRef"
|
||||
:style="{
|
||||
width: width,
|
||||
height: height,
|
||||
minHeight: '100px'
|
||||
}"
|
||||
}"
|
||||
class="echarts-container"
|
||||
/>
|
||||
</div>
|
||||
|
@ -125,10 +125,10 @@ const mergedConfig = computed(() => ({
|
|||
// 生成图表配置
|
||||
const generateOptions = computed(() => {
|
||||
if (!props.data?.length) return {}
|
||||
|
||||
|
||||
const config = mergedConfig.value
|
||||
const categories = props.data.map(item => item[config.xField])
|
||||
|
||||
|
||||
// 处理系列数据
|
||||
const series = config.series
|
||||
.filter(s => s.show !== false) // 过滤掉 show: false 的系列
|
||||
|
@ -171,9 +171,9 @@ const generateOptions = computed(() => {
|
|||
const seriesConfig = config.series.find(s => s.name === param.seriesName)
|
||||
return seriesConfig && seriesConfig.tooltip?.show !== false
|
||||
})
|
||||
|
||||
|
||||
if (validParams.length === 0) return ''
|
||||
|
||||
|
||||
let result = `${validParams[0].axisValue}<br/>`
|
||||
validParams.forEach(param => {
|
||||
// 找到对应的系列配置
|
||||
|
@ -188,7 +188,7 @@ const generateOptions = computed(() => {
|
|||
}
|
||||
result += `${param.marker}${param.seriesName}: ${param.value}${unit}<br/>`
|
||||
})
|
||||
|
||||
|
||||
return result
|
||||
}
|
||||
},
|
||||
|
@ -230,7 +230,7 @@ const generateOptions = computed(() => {
|
|||
// 初始化图表
|
||||
const initChart = () => {
|
||||
if (!chartRef.value) return
|
||||
|
||||
|
||||
chartInstance = echarts.init(chartRef.value, props.theme)
|
||||
chartInstance.setOption(generateOptions.value)
|
||||
emit('chartReady', chartInstance)
|
||||
|
@ -330,4 +330,4 @@ onBeforeUnmount(() => {
|
|||
0% { transform: rotate(0deg); }
|
||||
100% { transform: rotate(360deg); }
|
||||
}
|
||||
</style>
|
||||
</style>
|
||||
|
|
Loading…
Reference in New Issue