UNPKG

@patternfly/react-charts

Version:

This library provides a set of React chart components for use with the PatternFly reference implementation.

26 lines 1.5 kB
import { __rest } from "tslib"; import { jsx as _jsx } from "react/jsx-runtime"; import { cloneElement } from 'react'; import hoistNonReactStatics from 'hoist-non-react-statics'; import { VictoryScatter } from 'victory-scatter'; import { ChartContainer } from '../ChartContainer/ChartContainer'; import { ChartScatterStyles } from '../ChartTheme/ChartStyles'; import { getTheme } from '../ChartUtils/chart-theme'; export const ChartScatter = (_a) => { var { containerComponent = _jsx(ChartContainer, {}), themeColor, // destructure last theme = getTheme(themeColor) } = _a, rest = __rest(_a, ["containerComponent", "themeColor", "theme"]); // Clone so users can override container props const container = cloneElement(containerComponent, Object.assign({ theme }, containerComponent.props)); // bubbleProperty is only considered if the size prop is undefined, therefore set // default size function only if bubbleProperty is not set. if (typeof rest.size === 'undefined' && typeof rest.bubbleProperty === 'undefined') { rest.size = ({ active }) => (active ? ChartScatterStyles.activeSize : ChartScatterStyles.size); } // Note: containerComponent is required for theme return _jsx(VictoryScatter, Object.assign({ containerComponent: container, theme: theme }, rest)); }; ChartScatter.displayName = 'ChartScatter'; // Note: VictoryLine.role must be hoisted hoistNonReactStatics(ChartScatter, VictoryScatter); //# sourceMappingURL=ChartScatter.js.map