From 0fe0237b1eb968858b156c7edb160173604aae53 Mon Sep 17 00:00:00 2001 From: ali <ali9696@163.com> Date: 星期四, 13 二月 2025 16:06:52 +0800 Subject: [PATCH] 成本趋势 --- zhitan-vue/src/components/Echarts/LineChart.vue | 10 ++++++++-- 1 files changed, 8 insertions(+), 2 deletions(-) diff --git a/zhitan-vue/src/components/Echarts/LineChart.vue b/zhitan-vue/src/components/Echarts/LineChart.vue index 3294c0c..8703363 100644 --- a/zhitan-vue/src/components/Echarts/LineChart.vue +++ b/zhitan-vue/src/components/Echarts/LineChart.vue @@ -1,6 +1,6 @@ <template> <div class="chart-item"> - <div id="ChartDom" style="width: 100%; height: 100%"></div> + <div :id="domId" style="width: 100%; height: 100%"></div> </div> </template> @@ -18,6 +18,10 @@ chartType: { type: String, default: "line", // bar + }, + domId: { + type: String, + default: "ChartDom", }, }) @@ -44,13 +48,14 @@ if (!props.chartData.xAxis) { return } - const chartDom = document.getElementById("ChartDom") + const chartDom = document.getElementById(props.domId) if (echarts.getInstanceByDom(chartDom)) { echarts.dispose(chartDom) } const myChart = echarts.init(chartDom) // 澶勭悊澶氱郴鍒楁暟鎹� const series = props.chartData.series.map((item) => ({ + ...item, name: item.name, type: props.chartType, // 鏍规嵁浼犲叆绫诲瀷娓叉煋 data: item.data, @@ -60,6 +65,7 @@ }, smooth: true, // 鍚敤骞虫粦鏇茬嚎 })) + console.log("initChart", series) let option = { title: { // text: props.chartData.title, -- Gitblit v1.9.3