I have created a pie chart using angular-chart.js and it works perfectly fine. Now I need to display the data value on each section of the pie which does not work.
I tried using Chart.PieceLabel.js and added the following piece of code in the option section. It didn't work. I am not sure how to use it with angular-chart.js because it was originally written for chart.js
pieceLabel: {
render: 'label'
}
I have used the onAnimationComplete but it doesn't seem to work. I do not get any error message. Here's my code. Where am I going wrong? Thanks for your help in advance! :)
html
<canvas id="pie" class="chart chart-pie"
chart-data="data" chart-labels="labels" chart-options="options" width="500" height="300" chart-colors="colors"></canvas>
JS code
$scope.options = {
legend: {
display: true,
position: "bottom"
},
tooltipEvents: [],
showTooltips: true,
tooltipCaretSize: 0,
onAnimationComplete: function () {
this.showTooltip(this.segments, true);
}
};
$scope.data = tempData;
$scope.labels = tempLabels;
Plunker link: https://embed.plnkr.co/zlBWzJ/