|
@ -296,11 +296,33 @@ export default { |
|
|
cseries1.push(e.data[0].value) |
|
|
cseries1.push(e.data[0].value) |
|
|
cseries2.push(e.data[0].cum) |
|
|
cseries2.push(e.data[0].cum) |
|
|
}); |
|
|
}); |
|
|
|
|
|
|
|
|
chartOption.xAxis.data = cdata; |
|
|
chartOption.xAxis.data = cdata; |
|
|
chartOption.yAxis[0].name = title + '日计' |
|
|
chartOption.series[0].name = title + '日计'; |
|
|
chartOption.yAxis[1].name = title + '累计' |
|
|
chartOption.series[1].name = title + '累计'; |
|
|
|
|
|
|
|
|
chartOption.series[0].data = cseries1; |
|
|
chartOption.series[0].data = cseries1; |
|
|
chartOption.series[1].data = cseries2; |
|
|
chartOption.series[1].data = cseries2; |
|
|
|
|
|
// 假设 chartOption 已经初始化 |
|
|
|
|
|
chartOption.tooltip = { |
|
|
|
|
|
trigger: 'axis', |
|
|
|
|
|
axisPointer: { |
|
|
|
|
|
type: 'cross' |
|
|
|
|
|
}, |
|
|
|
|
|
formatter: function (params) { |
|
|
|
|
|
console.log('Params:', params); // 调试信息 |
|
|
|
|
|
let tooltipText = `<div><b>${params[0].name}</b></div>`; // 显示日期 |
|
|
|
|
|
params.forEach(function (item) { |
|
|
|
|
|
console.log('Item:', item); // 调试信息 |
|
|
|
|
|
if (item.seriesName === (title + '日计')) { |
|
|
|
|
|
tooltipText += `<div>${item.seriesName}: ${item.value}</div>`; |
|
|
|
|
|
} else if (item.seriesName === (title + '累计')) { |
|
|
|
|
|
tooltipText += `<div>${item.seriesName}: ${item.value}</div>`; |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
return tooltipText; |
|
|
|
|
|
} |
|
|
|
|
|
}; |
|
|
const chartIns = echarts.init(this.$refs.chartRef); |
|
|
const chartIns = echarts.init(this.$refs.chartRef); |
|
|
chartIns.setOption(chartOption); |
|
|
chartIns.setOption(chartOption); |
|
|
} |
|
|
} |
|
|