Pie label distance as percentage of pie size
Allow percentage value for option dataLabels.distance (percentage of the pie radius). That way I can make sure that the labels fit inside their slice for every label length and pie size.
http://jsfiddle.net/kzoon/ntDX9/ shows what I mean. If you use distance -30 longer datalabels go outside their slide. If you use -50 they fit, but that will mess up small pies (100px).
-
Nidhi commented
What is the solution for this?
-
kzoon commented
I hacked distance as percentage into highcharts.src.js and it is really very simple.
I add this line to PieSeries.translate (on line 14204 in v2.2.5 (2012-06-08)):
CODE: SELECT ALL
if (/%$/.test(labelDistance)) { //labelDistance set as percentage
labelDistance = pInt((pInt(labelDistance) / 100) * (series.center[2] / 2));
}and this to PieSeries.drawDataLabels(on line 14204 in v2.2.5 (2012-06-08)):
CODE: SELECT ALL
if (/%$/.test(distanceOption)) { //labelDistance set as percentage
distanceOption = pInt((pInt(distanceOption) / 100) * (series.center[2] / 2));
}Can someone at HighCharts please consider adding this or similar code to HighCharts.js, so I don't have to use an edited version of highcharts.src.js?