AlexMA
AlexMA

Reputation: 10214

Dealing with pie chart label overlap [Highcharts]

My chart is ugly and I'm not sure what to do about it. It's ugly because the labels overlap and are barely readable. Ideas I've already considered:

Anyone have a better idea? I wish highcharts was able to detect overlap and do something about it automatically. Here's the pic:

The label overlap on this chart is obviously an issue

Upvotes: 7

Views: 9882

Answers (3)

Chethan H
Chethan H

Reputation: 1

I also come across the same issue. I fixed the issue with below code.

plotOptions : {
    pie : {
        dataLabels : {
            whiteSpace: 'nowrap', 
            overflow: 'hidden',
            textOverflow: 'ellipsis'
        }
    }
}

Upvotes: 0

d2vid
d2vid

Reputation: 2322

There is a new option in Highcharts to set the startAngle of the pie chart. You can use the startAngle to arrange all the small slices on the right side of the chart, allowing more of the labels to fit.

series: [{
    startAngle: 90
}]

JSFiddle demo here: http://jsfiddle.net/highcharts/dK9CD/

Upvotes: 9

Ryan Lynch
Ryan Lynch

Reputation: 7786

I found a highcharts forum topic related to rotating the pie chart to better distribute labels in this sort of case, but it involves modifying the source to find the following line and change the cumulative reference to zero:

cumulative = -0.25, // start at top

One option that is not optimal but might work is to rotate the data labels a few degrees so that they don't overlap, like so:

{
    plotOptions : {
        pie : {
            dataLabels : {
                rotation : 15
            }
        }
    }
}

Upvotes: 7

Related Questions