I'm trying to rotate and position the dataLabels in each segment of a Highcharts pie chart and just feel like Im getting myself deeper and deeper without getting closer to a solution. Would love some tips or suggestions.
A graphic to illustrate the desired goal:

There will be three segments in my pie chart. I would ideally like:
- Each dataLabel to be rotated to basically create a center line for each segment (illustrated by the magenta lines); and
- The dataLabel to be centered in the segment, regardless of type size.
Suggestions on where to get started with this, or a sample that gets me close?
$(function () {
$('#container').highcharts({
chart: {
type: 'pie',
backgroundColor: 'transparent',
spacing: [0, 0, 0, 0],
margin: [0, 0, 0, 0],
events: {
load: function() {
$.each(this.series[0].data, function(index, point) {
var degree = (point.angle * 180) / Math.PI;
var rotation = 0;
(degree < 0) && (degree += 360);
// If the slice is in the left half, then rotate 180
// so the text won't look upside down
if (degree >= 90 && degree <= 270) {
rotation = degree - 180;
point.dataLabel.x = 0;
point.dataLabel.y = 0;
point.dataLabel.translateX = (point.labelPos[2] + point.labelPos[4]) / 2;
point.dataLabel.translateY = (point.labelPos[3] + point.labelPos[5]) / 2;
} else {
point.dataLabel.x = 0;
point.dataLabel.y = 0;
rotation = degree - 180;
point.dataLabel.translateX = (point.labelPos[2] + point.labelPos[4]) / 2;
point.dataLabel.translateY = (point.labelPos[3] + point.labelPos[5]) / 2;
}
point.dataLabel.rotation = Math.floor(rotation);
point.dataLabel.show();
point.dataLabel.updateTransform();
});
}
}
},
title: {
text: null
},
yAxis: {
title: {
text: 'Total percent market share'
}
},
plotOptions: {
pie: {
borderColor: 'rgb(243, 243, 243)',
borderWidth: 2,
shadow: false,
center: ['50%', '50%'],
colors: ['rgb(77, 196, 215)', 'rgb(50, 68, 132)', 'rgb(85, 119, 183)']
}
},
tooltip: {
enabled: false
},
series: [{
type: 'pie',
name: 'Votes',
data: [
['Yes', 9],
['No', 5],
['Undecided', 2]
],
size: '90%',
dataLabels: {
formatter: function () {
return this.point.name;
},
color: 'white',
connectorWidth: 0,
distance: -80
}
}]
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://code.highcharts.com/highcharts.js"></script>
<div id="container" style="height: 600px; width: 100%;"></div>