From 944f03a064358b81ddb6b1145168ff28c785334d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=82=A0=E9=9D=99=E8=90=9D=E8=8E=89?= Date: Thu, 15 Feb 2024 22:40:28 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BF=AE=E5=A4=8DECharts=E7=8E=AF?= =?UTF-8?q?=E5=BD=A2=E5=9B=BE=E6=96=87=E5=AD=97=E9=87=8D=E5=8F=A0=E7=9A=84?= =?UTF-8?q?=E9=97=AE=E9=A2=98=20(#682)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: 修复ECharts环形图文字重叠的问题 * chore: remove 注释 --- .../dashboard/base/components/MiddleChart.vue | 19 +++++++++++++++++++ src/pages/dashboard/base/index.ts | 3 +-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/src/pages/dashboard/base/components/MiddleChart.vue b/src/pages/dashboard/base/components/MiddleChart.vue index 11d546d..d39772c 100644 --- a/src/pages/dashboard/base/components/MiddleChart.vue +++ b/src/pages/dashboard/base/components/MiddleChart.vue @@ -97,6 +97,25 @@ const renderCountChart = () => { } countChart = echarts.init(countContainer); countChart.setOption(getPieChartDataSet(chartColors.value)); + + // 取消之前高亮的图形 + countChart.dispatchAction({ + type: 'downplay', + seriesIndex: 0, + dataIndex: -1, + }); + // 高亮当前图形 + countChart.dispatchAction({ + type: 'highlight', + seriesIndex: 0, + dataIndex: 1, + }); + // 显示 tooltip + countChart.dispatchAction({ + type: 'showTip', + seriesIndex: 0, + dataIndex: 1, + }); }; const renderCharts = () => { diff --git a/src/pages/dashboard/base/index.ts b/src/pages/dashboard/base/index.ts index 35a768e..1bbe05b 100644 --- a/src/pages/dashboard/base/index.ts +++ b/src/pages/dashboard/base/index.ts @@ -367,8 +367,7 @@ export function getPieChartDataSet({ emphasis: { scale: true, label: { - show: true, - formatter: ['{value|{d}%}', '{name|{b}渠道占比}'].join('\n'), + show: false, rich: { value: { color: textColor,