recharts
Version:
React charts
23 lines • 773 B
JavaScript
import { polarToCartesian } from '../PolarUtils';
/**
* Only applicable for radial layouts
* @param activeCoordinate the polar coordinate of the active tooltip item
* @returns start and end points of the radial cursor line, together with the polar coordinates they were computed from
*/
export function getRadialCursorPoints(activeCoordinate) {
var cx = activeCoordinate.cx,
cy = activeCoordinate.cy,
radius = activeCoordinate.radius,
startAngle = activeCoordinate.startAngle,
endAngle = activeCoordinate.endAngle;
var startPoint = polarToCartesian(cx, cy, radius, startAngle);
var endPoint = polarToCartesian(cx, cy, radius, endAngle);
return {
points: [startPoint, endPoint],
cx,
cy,
radius,
startAngle,
endAngle
};
}