From eee56c42731e5246dbb9eaf4294df019ec2b3d6e Mon Sep 17 00:00:00 2001 From: ko1234 Date: Fri, 8 Nov 2024 11:53:01 +0800 Subject: [PATCH] =?UTF-8?q?=E6=AD=B7=E5=8F=B2=E8=B3=87=E6=96=99:=20?= =?UTF-8?q?=E6=8C=89=E9=88=95=E8=AA=AA=E6=98=8E=E4=B8=8D=E6=8F=9B=E8=A1=8C?= =?UTF-8?q?=E3=80=81=E6=9A=AB=E6=99=82=E7=A7=BB=E9=99=A4table=20loadind=20?= =?UTF-8?q?|=20=E8=83=BD=E6=BA=90=E7=AE=A1=E7=90=86:=20sankey=E7=9A=84?= =?UTF-8?q?=E5=88=86=E6=94=AF=E9=A1=8F=E8=89=B2=E6=98=8E=E9=A1=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../energyManagement/components/ElecConsumption.vue | 12 +++++++++--- src/views/history/components/HistorySearch.vue | 8 +++++--- src/views/history/components/HistoryTable.vue | 2 +- 3 files changed, 15 insertions(+), 7 deletions(-) diff --git a/src/views/energyManagement/components/ElecConsumption.vue b/src/views/energyManagement/components/ElecConsumption.vue index b7abd52..ff91348 100644 --- a/src/views/energyManagement/components/ElecConsumption.vue +++ b/src/views/energyManagement/components/ElecConsumption.vue @@ -39,7 +39,7 @@ const chartOption = { borderWidth: 0, }, lineStyle: { - color: "target", + color: 'gradient', opacity: 0.7, curveness: 0.5, }, @@ -64,15 +64,21 @@ const loadData = async () => { ]; // 構造 links 連結 - const links = rawData.map((item) => ({ + const links = rawData.map((item, index) => ({ source: "Total", target: item.key, value: item.value, percentage: item.percentage, })); + const colors = ["#45f4ef", "#f5d54e", "#63ed84", "#5a5cac", "#ff5e5e", "#e266fe"]; // 更新 chartOption - chartOption.series[0].data = data; + chartOption.series[0].data = data.map((item, index) => ({ + ...item, + itemStyle: { + color: colors[index % colors.length], // 節點顏色 + }, + })); chartOption.series[0].links = links; // 初始化圖表 diff --git a/src/views/history/components/HistorySearch.vue b/src/views/history/components/HistorySearch.vue index 03ebd3c..031880e 100644 --- a/src/views/history/components/HistorySearch.vue +++ b/src/views/history/components/HistorySearch.vue @@ -160,7 +160,7 @@ onBeforeMount(() => {
-

+

{{ $t("history.system_category") }} :

{ />
-

+

{{ $t("history.device_category") }} :

{ />
-

{{ $t("history.point") }} :

+

+ {{ $t("history.point") }} : +