Skip to content

Commit 76bc6c5

Browse files
committed
fix: 修复ECharts环形图文字重叠的问题
1 parent ce97b04 commit 76bc6c5

File tree

2 files changed

+21
-2
lines changed

2 files changed

+21
-2
lines changed

src/pages/dashboard/base/components/MiddleChart.vue

+19
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,25 @@ const renderCountChart = () => {
9797
}
9898
countChart = echarts.init(countContainer);
9999
countChart.setOption(getPieChartDataSet(chartColors.value));
100+
101+
// 取消之前高亮的图形
102+
countChart.dispatchAction({
103+
type: 'downplay',
104+
seriesIndex: 0,
105+
dataIndex: -1,
106+
});
107+
// 高亮当前图形
108+
countChart.dispatchAction({
109+
type: 'highlight',
110+
seriesIndex: 0,
111+
dataIndex: 1,
112+
});
113+
// 显示 tooltip
114+
countChart.dispatchAction({
115+
type: 'showTip',
116+
seriesIndex: 0,
117+
dataIndex: 1,
118+
});
100119
};
101120
102121
const renderCharts = () => {

src/pages/dashboard/base/index.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -367,8 +367,8 @@ export function getPieChartDataSet({
367367
emphasis: {
368368
scale: true,
369369
label: {
370-
show: true,
371-
formatter: ['{value|{d}%}', '{name|{b}渠道占比}'].join('\n'),
370+
show: false,
371+
// formatter: ['{value|{d}%}', '{name|{b}渠道占比}'].join('\n'), 就是这个东西造成文字重叠
372372
rich: {
373373
value: {
374374
color: textColor,

0 commit comments

Comments
 (0)