echarts icon indicating copy to clipboard operation
echarts copied to clipboard

Pie (and other) charts with label going outside of canvas

Open sbokorna opened this issue 10 years ago • 34 comments

问题简述 (One-line summary)

Pie charts with sections with long name have the labels that overlap / go out of the canvas (so no more visible)

版本及环境 (Version & Environment)

  • ECharts 版本 3.2.3:
  • Chrome 52.0.2743.116 (64-bit):
  • MAC OS-X El Capitan 10.11.6 (OS Version):

重现步骤 (Steps to reproduce)

  1. Create a pie chart with several sections with long labels (PROBLEM)
  2. Reduce the page size and reload (Same Problem and often overlap)

期望结果 (Expected behaviour)

The labels should stay visible even when they are too long.

可能哪里有问题 (What went wrong)

The labels are not visible and often overlap

ECharts配置项 (ECharts option)

            scope.distributionEvent = {
                identity: $echarts.generateInstanceIdentity(),
                dimension: '10:4',
                config: {
                    tooltip: {
                        trigger: 'item',
                        formatter: "{b} : {c} ({d}%)",
                        zlevel: 2,
                        z: 100
                    },
                    series: [
                        {
                            name: "Event distribution",
                            type: 'pie',
                            radius: ['60%', '70%'],
                            center: ['50%', '55%'],
                            itemStyle : {
                                normal : {
                                    label : {
                                        show : true
                                    },
                                    labelLine : {
                                        show : true,
                                        length: 5
                                    }
                                }
                            },
                            data: [{"name":"New investment","value":6},{"name":"Merger and Acquisition","value":9},{"name":"Bankruptcy","value":3},{"name":"New business relation","value":8},{"name":"Official resignations and appointments","value":1},{"name":"End of activity","value":1},{"name":"New market","value":2},{"name":"New product","value":3},{"name":"New unit","value":1}]
                        }
                    ]
                }
            };

其他信息 (Other comments)

capture d ecran 2016-09-13 a 17 49 07

sbokorna avatar Sep 13 '16 15:09 sbokorna

same question

davidcaiyou avatar Sep 24 '16 03:09 davidcaiyou

Indeed it is a problem. But \n can be added to label. Does it temporarily solve the problem in you case?

See http://gallery.echartsjs.com/editor.html?c=xryc4E9Xa&v=2

100pah avatar Sep 24 '16 05:09 100pah

@100pah Thanks! That's a reasonable solution for me!

davidcaiyou avatar Sep 24 '16 06:09 davidcaiyou

@100pah but the corresponding legend MUST also contain \n, which is not elegant.

davidcaiyou avatar Sep 24 '16 06:09 davidcaiyou

The "/n" help but is not a concrete solution. See what happend when too much data and "\n" capture d ecran 2016-09-26 a 17 37 45

sbokorna avatar Sep 26 '16 15:09 sbokorna

I agree. This is something the library should handle on its own on the first render and whenever the window gets resized, otherwise there will be \n's when they aren't needed or some will be missing when needed.

PLPeeters avatar Sep 27 '16 08:09 PLPeeters

I have the same question.

zhangya5847 avatar Nov 25 '17 04:11 zhangya5847

This is still a problem.

surjikal avatar Apr 27 '18 06:04 surjikal

Are there any updates on this?

kuhlebrock avatar Jul 24 '18 15:07 kuhlebrock

Any updates on this one?

theNotoriousHxc avatar Jul 31 '18 12:07 theNotoriousHxc

Any solution for this?

RudmanMario avatar Aug 05 '18 19:08 RudmanMario

Any updates

Chandru1427 avatar Aug 20 '18 10:08 Chandru1427

Hi, since this feature is required frequently, we put it in our priority list and will dive into it.

Ovilia avatar Aug 21 '18 02:08 Ovilia

I met the same problem in a pie chart.

siregic avatar Oct 08 '18 09:10 siregic

image same issue here.. mainly on mobile... Not only on pie charts..

dann95 avatar Oct 18 '18 18:10 dann95

Same problem. Any solutions ?

REPTILEHAUS avatar Nov 08 '18 09:11 REPTILEHAUS

Same problem as well

pauturvalles avatar Dec 18 '18 12:12 pauturvalles

I also have this issue. Is the team still trying to resolve this bug?

milesbeyond avatar Jan 25 '19 14:01 milesbeyond

+1

pieroliviermarquis avatar May 19 '19 00:05 pieroliviermarquis

are we accepting pull requests on this issue?

nk2580 avatar May 24 '19 02:05 nk2580