-
Notifications
You must be signed in to change notification settings - Fork 730
/
Copy pathAxisRight.tsx
36 lines (33 loc) · 927 Bytes
/
AxisRight.tsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
import React from 'react';
import cx from 'classnames';
import Axis from './Axis';
import Orientation from '../constants/orientation';
import { SharedAxisProps, AxisScale } from '../types';
export type AxisRightProps<Scale extends AxisScale> = SharedAxisProps<Scale>;
export const rightTickLabelProps = (/** tickValue, index */) =>
({
dx: '0.25em',
dy: '0.25em',
fill: '#222',
fontFamily: 'Arial',
fontSize: 10,
textAnchor: 'start',
} as const);
export default function AxisRight<Scale extends AxisScale>({
axisClassName,
labelOffset = 36,
tickLabelProps = rightTickLabelProps,
tickLength = 8,
...restProps
}: AxisRightProps<Scale>) {
return (
<Axis
axisClassName={cx('vx-axis-right', axisClassName)}
labelOffset={labelOffset}
orientation={Orientation.right}
tickLabelProps={tickLabelProps}
tickLength={tickLength}
{...restProps}
/>
);
}