Your code is ok. you need to have: s = 0, that is, the starting point must be zero. and if you want the circle to start drawing from above, you can use: context.rotate (-90 * Math.PI / 180); but after the rotation you have to check the arguments arc () x, y. I used it like:
context.rotate(-90 * Math.PI / 180); context.arc(-200, 200, 150, startPoint, radian, false); context.lineWidth = 20; context.strokeStyle = '#b3e5fc'; context.stroke(); context.closePath();
after that I needed to display the percentage in text form, so I did:
context.rotate(90 * Math.PI / 180); context.fillStyle = '#1aa8ff'; context.textAlign = 'center'; context.font = "bold 76px Verdana";; context.textBaseline = "middle"; context.fillText("50%", 200, 200);
source share