/
ChartAxis.js
43 lines (39 loc) · 1.16 KB
/
ChartAxis.js
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
37
38
39
40
41
42
43
/* eslint-disable react/require-default-props,react/prop-types */
import React from 'react';
import PropTypes from 'prop-types';
import hoistNonReactStatics from 'hoist-non-react-statics';
import { VictoryAxis } from 'victory';
import { getTheme } from '../ChartUtils/chart-theme';
export const propTypes = {
/**
* See TypeScript API docs: https://formidable.com/open-source/victory/docs/victory-axis/
*/
'': PropTypes.any,
/**
* Specifies the theme color. Valid values are 'blue', 'green', 'grey' (recomended), 'multi', etc.
*
* Note: Not compatible with theme prop
*
* @example themeColor={ChartThemeColor.blue}
*/
themeColor: PropTypes.string,
/**
* Specifies the theme variant. Valid values are 'dark' or 'light'
*
* Note: Not compatible with theme prop
*
* @example themeVariant={ChartThemeVariant.light}
*/
themeVariant: PropTypes.string
};
const ChartAxis = ({
themeColor,
themeVariant,
theme = getTheme(themeColor, themeVariant), // destructure last
...rest
}) => (
<VictoryAxis theme={theme} {...rest}/>
);
hoistNonReactStatics(ChartAxis, VictoryAxis);
ChartAxis.propTypes = propTypes;
export default ChartAxis;