Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pie Labels Overlap #157

Open
loretoparisi opened this issue May 29, 2018 · 2 comments
Open

Pie Labels Overlap #157

loretoparisi opened this issue May 29, 2018 · 2 comments

Comments

@loretoparisi
Copy link

My labels are text with a generic size. In some cases labels overlaps like in the following

schermata 2018-05-29 alle 12 31 29

My configuration was

var pie = new d3pie(id, {
            "header": {
                /*"title": {
                    "text": "title",
                    "fontSize": 20,
                    "font": "open sans"
                },
                "subtitle": {
                    "text": "desc",
                    "color": "#999999",
                    "fontSize": 11,
                    "font": "open sans"
                },
                "titleSubtitlePadding": 9*/
            },
            "footer": {
                "color": "#999999",
                "fontSize": 10,
                "font": "open sans",
                "location": "bottom-left"
            },
            "size": {
                "canvasWidth": width,
                "canvasHeight": height,
                "pieOuterRadius": "80%"
            },
            "data": {
                "sortOrder": "value-desc",
                "content": data
            },
            "labels": {
                "outer": {
                    "pieDistance": 42
                },
                "inner": {
                    "hideWhenLessThanPercentage": 3
                },
                "mainLabel": {
                    "fontSize": 11
                },
                "percentage": {
                    "color": "#ffffff",
                    "decimalPlaces": 0
                },
                "value": {
                    "color": "#adadad",
                    "fontSize": 11
                },
                "lines": {
                    "enabled": true
                },
                "truncation": {
                    "enabled": true
                }
            },
            "effects": {
                "pullOutSegmentOnClick": {
                    "effect": "linear",
                    "speed": 400,
                    "size": 8
                }
            },
            "misc": {
                "gradient": {
                    "enabled": true,
                    "percentage": 100
                }
            }
        }); 
@mnori
Copy link

mnori commented Aug 3, 2018

Nice library overall. I had a similar problem. It seems to happen when there are lots of segments clustered at the top or bottom of the chart.

rsz_screenshot_from_2018-08-03_11-27-12

I'm probably just going to work around this by drawing a colour coded legend next to the pie chart and ditching the labels.

@mnori
Copy link

mnori commented Aug 6, 2018

I think my problem is different from the OP, as after running tests I found that label segments render correctly at the top of the pie, as long as there are not too many of them.

I opened an issue for my own bug here - #160 - this includes a solution where I added an alternative label rendering mode to stop the lines from overlapping.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants