MCPcopy Create free account
hub / github.com/chartjs/Chart.js / getCenterPoint

Method getCenterPoint

src/elements/element.arc.ts:448–464  ·  view source on GitHub ↗
(useFinalPosition: boolean)

Source from the content-addressed store, hash-verified

446 }
447
448 getCenterPoint(useFinalPosition: boolean) {
449 const {x, y, startAngle, endAngle, innerRadius, outerRadius} = this.getProps([
450 'x',
451 'y',
452 'startAngle',
453 'endAngle',
454 'innerRadius',
455 'outerRadius'
456 ], useFinalPosition);
457 const {offset, spacing} = this.options;
458 const halfAngle = (startAngle + endAngle) / 2;
459 const halfRadius = (innerRadius + outerRadius + spacing + offset) / 2;
460 return {
461 x: x + Math.cos(halfAngle) * halfRadius,
462 y: y + Math.sin(halfAngle) * halfRadius
463 };
464 }
465
466 tooltipPosition(useFinalPosition: boolean) {
467 return this.getCenterPoint(useFinalPosition);

Callers 1

tooltipPositionMethod · 0.95

Calls 1

getPropsMethod · 0.80

Tested by

no test coverage detected