From ecc78c82b3dc1c72f2f9e66e62f19b50af186b41 Mon Sep 17 00:00:00 2001 From: d266377 Date: Fri, 30 Jan 2026 14:33:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=80=81=E5=8A=BF=E6=84=9F=E7=9F=A5=E5=B9=B3?= =?UTF-8?q?=E5=8F=B0-=E5=85=A8=E7=90=83=E5=BC=80=E6=BA=90=E9=A3=8E?= =?UTF-8?q?=E9=99=A9=E6=80=81=E5=8A=BF=E6=84=9F=E7=9F=A5=E7=9B=91=E6=8E=A7?= =?UTF-8?q?=E4=B8=AD=E5=BF=83-=E8=A1=8C=E4=B8=9A=E5=88=86=E5=B8=83?= =?UTF-8?q?=E6=A0=B7=E5=BC=8F=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../components/IndustryDistribution.vue | 29 +++++++++++++++---- 1 file changed, 24 insertions(+), 5 deletions(-) diff --git a/src/views/Jyh/security/components/IndustryDistribution.vue b/src/views/Jyh/security/components/IndustryDistribution.vue index 6d30568..9635b9e 100644 --- a/src/views/Jyh/security/components/IndustryDistribution.vue +++ b/src/views/Jyh/security/components/IndustryDistribution.vue @@ -50,16 +50,25 @@ const initChart = () => { myChart = echarts.init(chartDiv.value); + // 构建图例数据,对于较长的名称才在图例中显示数值 + const legendData = internalData.value.map(item => ({ + name: item.name, + icon: 'circle' + })); + const option: echarts.EChartsOption = { tooltip: { trigger: 'item', - formatter: (params: any) => `${params.name}: ${params.percent}% (${params.value}%)` + formatter: (params: any) => `${params.name}: ${params.value} (${params.percent}%)` }, legend: { bottom: '0', - textStyle: { fontSize: 12 }, + textStyle: { fontSize: 10 }, itemWidth: 10, - itemHeight: 10 + itemHeight: 10, + orient: 'horizontal', + padding: [5, 0, 0, 0], + data: legendData }, series: [ { @@ -69,8 +78,18 @@ const initChart = () => { data: internalData.value, label: { show: true, - formatter: '{b}: {d}%', - fontSize: 10 + formatter: '{b}\n{d}%', + fontSize: 10, + rich: { + b: { + fontSize: 10, + lineHeight: 12 + }, + d: { + fontSize: 10, + lineHeight: 12 + } + } }, itemStyle: { color: (params: any) => {