How to make the labels of the ECharts pie chart not overlap?

1. How to make the labels of the ECharts pie chart not overlap?
Using the ECharts pie chart, if some items account for a small proportion and the space occupied by the pie chart is relatively small, the labels will overlap and the labels will be truncated ( figure 1).
insert image description here
Figure 1: Labels overlap and are truncated
You can reduce the radius adjustment of the pie chart by setting the radius property (Figure 2). Or cooperate with the minAngle attribute to set a minimum angle for each sector. The disadvantage is that some sector areas will look the same size (Figure 3).
insert image description here
Figure 2: Reduce the radius of the pie chart
insert image description here
Figure 3: Reduce the radius + set the minimum angle
In addition, you can adjust the alignTo attribute of the label. labelLine indicates that the end of the label guide line is aligned, and edge indicates that the text is aligned.
Another idea is to use the formatter function of the label to process the label text and wrap the label text.
According to the actual situation, the above methods can be combined for processing.

2. How to write the code?

Guess you like

Origin blog.csdn.net/longxiaobao123/article/details/130133631