From f94b708045d88e0de12d323d535eaea6a508eb18 Mon Sep 17 00:00:00 2001 From: ali <ali9696@163.com> Date: 星期二, 25 二月 2025 09:56:08 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/develop1.0' into develop_alioo --- zhitan-vue/src/components/Echarts/LineChart.vue | 13 ++++++++++--- 1 files changed, 10 insertions(+), 3 deletions(-) diff --git a/zhitan-vue/src/components/Echarts/LineChart.vue b/zhitan-vue/src/components/Echarts/LineChart.vue index 3294c0c..c4c0de6 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, @@ -68,7 +74,8 @@ color: "#2979ff", }, }, - color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"], + color: ["#4dadf8", "#19be6b", "#ff9900", "#3d8a32", "#e8463a", "#ff4e3f"], + // color: ["#2979ff", "#19be6b", "#ff9900", "#fa3534"], tooltip: { trigger: "axis", axisPointer: { -- Gitblit v1.9.3