source: node_modules/recharts/es6/util/cursor/getCursorPoints.js

Last change on this file was a762898, checked in by istevanoska <ilinastevanoska@…>, 5 months ago

Added visualizations

  • Property mode set to 100644
File size: 1.1 KB
Line 
1import { polarToCartesian } from '../PolarUtils';
2import { isPolarCoordinate } from '../types';
3import { getRadialCursorPoints } from './getRadialCursorPoints';
4export function getCursorPoints(layout, activeCoordinate, offset) {
5 if (layout === 'horizontal') {
6 return [{
7 x: activeCoordinate.x,
8 y: offset.top
9 }, {
10 x: activeCoordinate.x,
11 y: offset.top + offset.height
12 }];
13 }
14 if (layout === 'vertical') {
15 return [{
16 x: offset.left,
17 y: activeCoordinate.y
18 }, {
19 x: offset.left + offset.width,
20 y: activeCoordinate.y
21 }];
22 }
23 if (isPolarCoordinate(activeCoordinate)) {
24 if (layout === 'centric') {
25 var {
26 cx,
27 cy,
28 innerRadius,
29 outerRadius,
30 angle
31 } = activeCoordinate;
32 var innerPoint = polarToCartesian(cx, cy, innerRadius, angle);
33 var outerPoint = polarToCartesian(cx, cy, outerRadius, angle);
34 return [{
35 x: innerPoint.x,
36 y: innerPoint.y
37 }, {
38 x: outerPoint.x,
39 y: outerPoint.y
40 }];
41 }
42 return getRadialCursorPoints(activeCoordinate);
43 }
44 return undefined;
45}
Note: See TracBrowser for help on using the repository browser.