[Chartjs]-Angular 2 ng2-charts donut add horizontal line

2👍

You can draw a horizontal line which will separate the texts inside chart, using the following code after drawing the first text …

ctx.beginPath();
ctx.moveTo(centerX - chart.innerRadius, centerY);
ctx.lineTo(centerX + chart.innerRadius, centerY);
ctx.strokeStyle = 'rgba(0, 0, 0, 0.5)';
ctx.stroke();

and that results in …

enter image description here

Here is a working example on Plunker

Leave a comment