From 5d36e1f987ef21e44ded2e8a1d06c28094ec1e76 Mon Sep 17 00:00:00 2001 From: baoshiwei <baoshiwei@shlanbao.cn> Date: 星期六, 19 四月 2025 12:39:47 +0800 Subject: [PATCH] Merge remote-tracking branch 'origin/master' --- zhitan-vue/src/components/Echarts/LineChart.vue | 17 ++++++++++++----- 1 files changed, 12 insertions(+), 5 deletions(-) diff --git a/zhitan-vue/src/components/Echarts/LineChart.vue b/zhitan-vue/src/components/Echarts/LineChart.vue index 3294c0c..8a1f434 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,31 +48,34 @@ 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, - barWidth: "16", + barWidth: props.chartData.barWidth || "16", itemStyle: { borderRadius: [15, 15, 0, 0], }, smooth: true, // 鍚敤骞虫粦鏇茬嚎 })) + console.log("initChart", series) let option = { title: { - // text: props.chartData.title, + text: props.chartData.title || "", left: "40", textStyle: { 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