From 06d3d15a5a08637041cc601101c063b11b07a346 Mon Sep 17 00:00:00 2001 From: net <net@netdeMBP.lan> Date: 星期五, 14 二月 2025 17:25:21 +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