source: node_modules/recharts/es6/util/TickUtils.js@ a762898

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

Added visualizations

  • Property mode set to 100644
File size: 1.2 KB
Line 
1import { getAngledRectangleWidth } from './CartesianUtils';
2import { getEveryNth } from './getEveryNth';
3export function getAngledTickWidth(contentSize, unitSize, angle) {
4 var size = {
5 width: contentSize.width + unitSize.width,
6 height: contentSize.height + unitSize.height
7 };
8 return getAngledRectangleWidth(size, angle);
9}
10export function getTickBoundaries(viewBox, sign, sizeKey) {
11 var isWidth = sizeKey === 'width';
12 var {
13 x,
14 y,
15 width,
16 height
17 } = viewBox;
18 if (sign === 1) {
19 return {
20 start: isWidth ? x : y,
21 end: isWidth ? x + width : y + height
22 };
23 }
24 return {
25 start: isWidth ? x + width : y + height,
26 end: isWidth ? x : y
27 };
28}
29export function isVisible(sign, tickPosition, getSize, start, end) {
30 /* Since getSize() is expensive (it reads the ticks' size from the DOM), we do this check first to avoid calculating
31 * the tick's size. */
32 if (sign * tickPosition < sign * start || sign * tickPosition > sign * end) {
33 return false;
34 }
35 var size = getSize();
36 return sign * (tickPosition - sign * size / 2 - start) >= 0 && sign * (tickPosition + sign * size / 2 - end) <= 0;
37}
38export function getNumberIntervalTicks(ticks, interval) {
39 return getEveryNth(ticks, interval + 1);
40}
Note: See TracBrowser for help on using the repository browser.