drawSegmentLabel method
dynamic
drawSegmentLabel(
- CanvasRenderingContext2D ctx,
- PieChartItem item,
- double start,
- double total,
Implementation
drawSegmentLabel(CanvasRenderingContext2D ctx, PieChartItem item, double start, double total) {
ctx.save();
var x = (width / 2).floor();
var y = (height / 2).floor();
var angle = this.degreesToRadians((start / total) * 360 - 90);
ctx.translate(x, y);
ctx.rotate(angle);
var dx = (min(width, height) * 0.5).floor() * 0.8 - 10;
var dy = (height * 0.05).floor();
ctx.textAlign = "right";
int fontSize = (height / 25).floor();
ctx.font = fontSize.toString() + "pt Helvetica";
ctx.fillText(item.label, dx, dy);
ctx.restore();
}