MCPcopy
hub / github.com/chartjs/Chart.js / getCenterPoint

Method getCenterPoint

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

Source from the content-addressed store, hash-verified

370 }
371
372 getCenterPoint(useFinalPosition: boolean) {
373 const {x, y, startAngle, endAngle, innerRadius, outerRadius} = this.getProps([
374 'x',
375 'y',
376 'startAngle',
377 'endAngle',
378 'innerRadius',
379 'outerRadius'
380 ], useFinalPosition);
381 const {offset, spacing} = this.options;
382 const halfAngle = (startAngle + endAngle) / 2;
383 const halfRadius = (innerRadius + outerRadius + spacing + offset) / 2;
384 return {
385 x: x + Math.cos(halfAngle) * halfRadius,
386 y: y + Math.sin(halfAngle) * halfRadius
387 };
388 }
389
390 tooltipPosition(useFinalPosition: boolean) {
391 return this.getCenterPoint(useFinalPosition);

Callers 1

tooltipPositionMethod · 0.95

Calls 1

getPropsMethod · 0.80

Tested by

no test coverage detected