更新代码

This commit is contained in:
ahanhanhan
2024-03-13 12:00:04 +08:00
parent be25317e95
commit a47a4849eb

View File

@@ -102,6 +102,7 @@ export default {
mounted() {
publisherInstance.subscribe('refresh', this.staticAmountLine);
this.$nextTick(() => {
this.chart = echarts.init(this.$refs.chart, 'macarons')
this.staticAmountLine();
})
},
@@ -112,20 +113,25 @@ export default {
if (code === 200) {
const { x } = data;
echartsConfig.xAxis.data = x;
const series = [];
for (const key in legendMap) {
const name = legendMap[key];
echartsConfig.series.push({
series.push({
name,
yAxisIndex: key === 'orderCountData' ? 1 : 0,
data: data[key],
type: "line",
})
}
const options = this.chart.getOption();
if (options && options.legend) {
echartsConfig.legend = { selected: options.legend[0].selected }
}
echartsConfig.series = series;
this.initChart(echartsConfig)
}
},
initChart(chartData) {
this.chart = echarts.init(this.$refs.chart, 'macarons')
this.chart.setOption(chartData);
},
},