@mui/x-charts 7.7.0 → 7.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +21 -104
- package/BarChart/BarElement.d.ts +225 -228
- package/BarChart/BarLabel/BarLabel.d.ts +225 -228
- package/BarChart/BarLabel/BarLabelPlot.d.ts +0 -3
- package/BarChart/BarLabel/BarLabelPlot.js +1 -24
- package/BarChart/BarLabel/getBarLabel.d.ts +1 -1
- package/BarChart/BarPlot.js +2 -2
- package/BarChart/checkScaleErrors.d.ts +5 -9
- package/BarChart/types.d.ts +2 -2
- package/BarChart/useBarChartProps.d.ts +34 -0
- package/BarChart/useBarChartProps.js +143 -0
- package/CHANGELOG.md +181 -0
- package/ChartContainer/ChartContainer.d.ts +2 -2
- package/ChartContainer/ChartContainer.js +6 -10
- package/ChartContainer/useChartContainerHooks.d.ts +11 -0
- package/ChartContainer/useChartContainerHooks.js +34 -0
- package/ChartContainer/usePluginsMerge.d.ts +1 -2
- package/ChartsAxis/ChartsAxis.js +2 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +21 -6
- package/ChartsGrid/ChartsGrid.js +2 -2
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsReferenceLine/common.d.ts +0 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsTooltipTable.d.ts +0 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +4 -4
- package/ChartsXAxis/ChartsXAxis.js +2 -2
- package/ChartsYAxis/ChartsYAxis.js +5 -3
- package/Gauge/GaugeProvider.d.ts +1 -1
- package/LineChart/AnimatedArea.d.ts +225 -228
- package/LineChart/AnimatedLine.d.ts +225 -228
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.js +24 -106
- package/LineChart/LineHighlightPlot.js +2 -2
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +2 -2
- package/LineChart/useLineChartProps.d.ts +40 -0
- package/LineChart/useLineChartProps.js +152 -0
- package/PieChart/PieArc.d.ts +0 -1
- package/PieChart/PieArcLabel.d.ts +0 -1
- package/PieChart/dataTransform/transition.d.ts +0 -1
- package/ResponsiveChartContainer/ResizableContainer.d.ts +1 -2
- package/ScatterChart/ScatterChart.js +20 -75
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/useScatterChartProps.d.ts +31 -0
- package/ScatterChart/useScatterChartProps.js +116 -0
- package/context/CartesianProvider/CartesianContext.d.ts +25 -0
- package/context/CartesianProvider/CartesianContext.js +21 -0
- package/context/CartesianProvider/CartesianProvider.d.ts +34 -0
- package/context/CartesianProvider/CartesianProvider.js +44 -0
- package/context/CartesianProvider/computeValue.d.ts +19 -0
- package/context/CartesianProvider/computeValue.js +104 -0
- package/context/CartesianProvider/getAxisExtremum.d.ts +4 -0
- package/context/CartesianProvider/getAxisExtremum.js +28 -0
- package/context/CartesianProvider/index.d.ts +9 -0
- package/context/CartesianProvider/index.js +51 -0
- package/context/CartesianProvider/normalizeAxis.d.ts +5 -0
- package/context/CartesianProvider/normalizeAxis.js +23 -0
- package/context/CartesianProvider/useCartesianContext.d.ts +2 -0
- package/context/CartesianProvider/useCartesianContext.js +17 -0
- package/context/ColorProvider.d.ts +2 -2
- package/esm/BarChart/BarChart.js +21 -104
- package/esm/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/esm/BarChart/BarPlot.js +2 -2
- package/esm/BarChart/useBarChartProps.js +135 -0
- package/esm/ChartContainer/ChartContainer.js +5 -9
- package/esm/ChartContainer/useChartContainerHooks.js +24 -0
- package/esm/ChartsAxis/ChartsAxis.js +2 -2
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +21 -6
- package/esm/ChartsGrid/ChartsGrid.js +2 -2
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +5 -3
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +24 -106
- package/esm/LineChart/LineHighlightPlot.js +2 -2
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +2 -2
- package/esm/LineChart/useLineChartProps.js +144 -0
- package/esm/ScatterChart/ScatterChart.js +20 -75
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/useScatterChartProps.js +108 -0
- package/esm/context/CartesianProvider/CartesianContext.js +13 -0
- package/esm/context/CartesianProvider/CartesianProvider.js +37 -0
- package/esm/context/CartesianProvider/computeValue.js +97 -0
- package/esm/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/esm/context/CartesianProvider/index.js +10 -0
- package/esm/context/CartesianProvider/normalizeAxis.js +15 -0
- package/esm/context/CartesianProvider/useCartesianContext.js +8 -0
- package/esm/hooks/useAxisEvents.js +7 -10
- package/esm/hooks/useColorScale.js +3 -3
- package/esm/hooks/useScale.js +4 -5
- package/esm/hooks/useTicks.js +2 -1
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/esm/internals/getSVGPoint.js +11 -0
- package/esm/internals/index.js +8 -2
- package/esm/internals/utils.js +0 -12
- package/hooks/useAxisEvents.js +8 -11
- package/hooks/useChartDimensions.d.ts +1 -1
- package/hooks/useColor.d.ts +1 -1
- package/hooks/useColorScale.js +3 -3
- package/hooks/useDrawingArea.d.ts +2 -8
- package/hooks/useScale.js +4 -7
- package/hooks/useTicks.js +2 -1
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +0 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +2 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/internals/defaultizeColor.d.ts +68 -68
- package/internals/getSVGPoint.d.ts +6 -0
- package/internals/getSVGPoint.js +17 -0
- package/internals/getWordsByLines.d.ts +0 -1
- package/internals/index.d.ts +9 -1
- package/internals/index.js +69 -5
- package/internals/useAnimatedPath.d.ts +0 -1
- package/internals/utils.d.ts +0 -6
- package/internals/utils.js +0 -13
- package/models/axis.d.ts +1 -2
- package/models/plugin.d.ts +4 -1
- package/modern/BarChart/BarChart.js +21 -104
- package/modern/BarChart/BarLabel/BarLabelPlot.js +0 -23
- package/modern/BarChart/BarPlot.js +2 -2
- package/modern/BarChart/useBarChartProps.js +135 -0
- package/modern/ChartContainer/ChartContainer.js +5 -9
- package/modern/ChartContainer/useChartContainerHooks.js +24 -0
- package/modern/ChartsAxis/ChartsAxis.js +2 -2
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +21 -6
- package/modern/ChartsGrid/ChartsGrid.js +2 -2
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +5 -3
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +24 -106
- package/modern/LineChart/LineHighlightPlot.js +2 -2
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +2 -2
- package/modern/LineChart/useLineChartProps.js +144 -0
- package/modern/ScatterChart/ScatterChart.js +20 -75
- package/modern/ScatterChart/ScatterPlot.js +2 -2
- package/modern/ScatterChart/useScatterChartProps.js +108 -0
- package/modern/context/CartesianProvider/CartesianContext.js +13 -0
- package/modern/context/CartesianProvider/CartesianProvider.js +37 -0
- package/modern/context/CartesianProvider/computeValue.js +97 -0
- package/modern/context/CartesianProvider/getAxisExtremum.js +21 -0
- package/modern/context/CartesianProvider/index.js +10 -0
- package/modern/context/CartesianProvider/normalizeAxis.js +15 -0
- package/modern/context/CartesianProvider/useCartesianContext.js +8 -0
- package/modern/hooks/useAxisEvents.js +7 -10
- package/modern/hooks/useColorScale.js +3 -3
- package/modern/hooks/useScale.js +4 -5
- package/modern/hooks/useTicks.js +2 -1
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -2
- package/modern/internals/getSVGPoint.js +11 -0
- package/modern/internals/index.js +8 -2
- package/modern/internals/utils.js +0 -12
- package/package.json +3 -3
- package/context/CartesianContextProvider.d.ts +0 -61
- package/context/CartesianContextProvider.js +0 -220
- package/esm/context/CartesianContextProvider.js +0 -211
- package/modern/context/CartesianContextProvider.js +0 -211
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import useId from '@mui/utils/useId';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import { BarPlot } from './BarPlot';
|
|
6
5
|
import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
|
|
7
6
|
import { ChartsAxis } from '../ChartsAxis';
|
|
8
|
-
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
9
7
|
import { ChartsTooltip } from '../ChartsTooltip';
|
|
10
8
|
import { ChartsLegend } from '../ChartsLegend';
|
|
11
9
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
@@ -13,6 +11,7 @@ import { ChartsClipPath } from '../ChartsClipPath';
|
|
|
13
11
|
import { ChartsGrid } from '../ChartsGrid';
|
|
14
12
|
import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
|
|
15
13
|
import { ChartsOverlay } from '../ChartsOverlay/ChartsOverlay';
|
|
14
|
+
import { useBarChartProps } from './useBarChartProps';
|
|
16
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
16
|
/**
|
|
18
17
|
* Demos:
|
|
@@ -27,108 +26,26 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
27
26
|
*/
|
|
28
27
|
const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
29
28
|
const {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
onItemClick,
|
|
51
|
-
onAxisClick,
|
|
52
|
-
children,
|
|
53
|
-
slots,
|
|
54
|
-
slotProps,
|
|
55
|
-
loading,
|
|
56
|
-
barLabel,
|
|
57
|
-
highlightedItem,
|
|
58
|
-
onHighlightChange
|
|
59
|
-
} = props;
|
|
60
|
-
const id = useId();
|
|
61
|
-
const clipPathId = `${id}-clip-path`;
|
|
62
|
-
const hasHorizontalSeries = layout === 'horizontal' || layout === undefined && series.some(item => item.layout === 'horizontal');
|
|
63
|
-
const defaultAxisConfig = {
|
|
64
|
-
scaleType: 'band',
|
|
65
|
-
data: Array.from({
|
|
66
|
-
length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
|
|
67
|
-
}, (_, index) => index)
|
|
68
|
-
};
|
|
69
|
-
const defaultizedAxisHighlight = _extends({}, hasHorizontalSeries ? {
|
|
70
|
-
y: 'band'
|
|
71
|
-
} : {
|
|
72
|
-
x: 'band'
|
|
73
|
-
}, axisHighlight);
|
|
74
|
-
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
75
|
-
ref: ref,
|
|
76
|
-
series: series.map(s => _extends({
|
|
77
|
-
type: 'bar'
|
|
78
|
-
}, s, {
|
|
79
|
-
layout: hasHorizontalSeries ? 'horizontal' : 'vertical'
|
|
80
|
-
})),
|
|
81
|
-
width: width,
|
|
82
|
-
height: height,
|
|
83
|
-
margin: margin,
|
|
84
|
-
xAxis: xAxis ?? (hasHorizontalSeries ? undefined : [_extends({
|
|
85
|
-
id: DEFAULT_X_AXIS_KEY
|
|
86
|
-
}, defaultAxisConfig)]),
|
|
87
|
-
yAxis: yAxis ?? (hasHorizontalSeries ? [_extends({
|
|
88
|
-
id: DEFAULT_Y_AXIS_KEY
|
|
89
|
-
}, defaultAxisConfig)] : undefined),
|
|
90
|
-
colors: colors,
|
|
91
|
-
dataset: dataset,
|
|
92
|
-
sx: sx,
|
|
93
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
94
|
-
highlightedItem: highlightedItem,
|
|
95
|
-
onHighlightChange: onHighlightChange,
|
|
96
|
-
children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
|
|
97
|
-
onAxisClick: onAxisClick
|
|
98
|
-
}), grid && /*#__PURE__*/_jsx(ChartsGrid, {
|
|
99
|
-
vertical: grid.vertical,
|
|
100
|
-
horizontal: grid.horizontal
|
|
101
|
-
}), /*#__PURE__*/_jsxs("g", {
|
|
102
|
-
clipPath: `url(#${clipPathId})`,
|
|
103
|
-
children: [/*#__PURE__*/_jsx(BarPlot, {
|
|
104
|
-
slots: slots,
|
|
105
|
-
slotProps: slotProps,
|
|
106
|
-
skipAnimation: skipAnimation,
|
|
107
|
-
onItemClick: onItemClick,
|
|
108
|
-
borderRadius: borderRadius,
|
|
109
|
-
barLabel: barLabel
|
|
110
|
-
}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
111
|
-
loading: loading,
|
|
112
|
-
slots: slots,
|
|
113
|
-
slotProps: slotProps
|
|
114
|
-
})]
|
|
115
|
-
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
116
|
-
topAxis: topAxis,
|
|
117
|
-
leftAxis: leftAxis,
|
|
118
|
-
rightAxis: rightAxis,
|
|
119
|
-
bottomAxis: bottomAxis,
|
|
120
|
-
slots: slots,
|
|
121
|
-
slotProps: slotProps
|
|
122
|
-
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
123
|
-
slots: slots,
|
|
124
|
-
slotProps: slotProps
|
|
125
|
-
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), !loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
126
|
-
slots: slots,
|
|
127
|
-
slotProps: slotProps
|
|
128
|
-
})), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
129
|
-
id: clipPathId
|
|
130
|
-
}), children]
|
|
131
|
-
});
|
|
29
|
+
chartContainerProps,
|
|
30
|
+
barPlotProps,
|
|
31
|
+
axisClickHandlerProps,
|
|
32
|
+
gridProps,
|
|
33
|
+
clipPathProps,
|
|
34
|
+
clipPathGroupProps,
|
|
35
|
+
overlayProps,
|
|
36
|
+
chartsAxisProps,
|
|
37
|
+
axisHighlightProps,
|
|
38
|
+
legendProps,
|
|
39
|
+
tooltipProps,
|
|
40
|
+
children
|
|
41
|
+
} = useBarChartProps(props);
|
|
42
|
+
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({
|
|
43
|
+
ref: ref
|
|
44
|
+
}, chartContainerProps, {
|
|
45
|
+
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), props.grid && /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
46
|
+
children: [/*#__PURE__*/_jsx(BarPlot, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps))]
|
|
47
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
48
|
+
}));
|
|
132
49
|
});
|
|
133
50
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
134
51
|
// ----------------------------- Warning --------------------------------
|
|
@@ -2,7 +2,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
3
|
const _excluded = ["bars", "skipAnimation"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
5
|
import { useTransition } from '@react-spring/web';
|
|
7
6
|
import { BarLabelItem } from './BarLabelItem';
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -73,26 +72,4 @@ function BarLabelPlot(props) {
|
|
|
73
72
|
})))
|
|
74
73
|
});
|
|
75
74
|
}
|
|
76
|
-
process.env.NODE_ENV !== "production" ? BarLabelPlot.propTypes = {
|
|
77
|
-
// ----------------------------- Warning --------------------------------
|
|
78
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
79
|
-
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
80
|
-
// ----------------------------------------------------------------------
|
|
81
|
-
barLabel: PropTypes.oneOfType([PropTypes.oneOf(['value']), PropTypes.func]),
|
|
82
|
-
bars: PropTypes.arrayOf(PropTypes.shape({
|
|
83
|
-
color: PropTypes.string.isRequired,
|
|
84
|
-
dataIndex: PropTypes.number.isRequired,
|
|
85
|
-
height: PropTypes.number.isRequired,
|
|
86
|
-
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
87
|
-
maskId: PropTypes.string.isRequired,
|
|
88
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
89
|
-
value: PropTypes.number,
|
|
90
|
-
width: PropTypes.number.isRequired,
|
|
91
|
-
x: PropTypes.number.isRequired,
|
|
92
|
-
xOrigin: PropTypes.number.isRequired,
|
|
93
|
-
y: PropTypes.number.isRequired,
|
|
94
|
-
yOrigin: PropTypes.number.isRequired
|
|
95
|
-
})).isRequired,
|
|
96
|
-
skipAnimation: PropTypes.bool
|
|
97
|
-
} : void 0;
|
|
98
75
|
export { BarLabelPlot };
|
package/esm/BarChart/BarPlot.js
CHANGED
|
@@ -4,7 +4,7 @@ const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useTransition } from '@react-spring/web';
|
|
7
|
-
import {
|
|
7
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
8
8
|
import { BarElement } from './BarElement';
|
|
9
9
|
import getColor from './getColor';
|
|
10
10
|
import { useChartId } from '../hooks';
|
|
@@ -47,7 +47,7 @@ const useAggregatedData = () => {
|
|
|
47
47
|
stackingGroups: [],
|
|
48
48
|
seriesOrder: []
|
|
49
49
|
};
|
|
50
|
-
const axisData =
|
|
50
|
+
const axisData = useCartesianContext();
|
|
51
51
|
const chartId = useChartId();
|
|
52
52
|
const {
|
|
53
53
|
series,
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import useId from '@mui/utils/useId';
|
|
3
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
4
|
+
/**
|
|
5
|
+
* A helper function that extracts BarChartProps from the input props
|
|
6
|
+
* and returns an object with props for the children components of BarChart.
|
|
7
|
+
*
|
|
8
|
+
* @param props The input props for BarChart
|
|
9
|
+
* @returns An object with props for the children components of BarChart
|
|
10
|
+
*/
|
|
11
|
+
export const useBarChartProps = props => {
|
|
12
|
+
const {
|
|
13
|
+
xAxis,
|
|
14
|
+
yAxis,
|
|
15
|
+
series,
|
|
16
|
+
width,
|
|
17
|
+
height,
|
|
18
|
+
margin,
|
|
19
|
+
colors,
|
|
20
|
+
dataset,
|
|
21
|
+
sx,
|
|
22
|
+
tooltip,
|
|
23
|
+
onAxisClick,
|
|
24
|
+
axisHighlight,
|
|
25
|
+
legend,
|
|
26
|
+
grid,
|
|
27
|
+
topAxis,
|
|
28
|
+
leftAxis,
|
|
29
|
+
rightAxis,
|
|
30
|
+
bottomAxis,
|
|
31
|
+
children,
|
|
32
|
+
slots,
|
|
33
|
+
slotProps,
|
|
34
|
+
skipAnimation,
|
|
35
|
+
loading,
|
|
36
|
+
layout,
|
|
37
|
+
onItemClick,
|
|
38
|
+
highlightedItem,
|
|
39
|
+
onHighlightChange,
|
|
40
|
+
borderRadius,
|
|
41
|
+
barLabel
|
|
42
|
+
} = props;
|
|
43
|
+
const id = useId();
|
|
44
|
+
const clipPathId = `${id}-clip-path`;
|
|
45
|
+
const hasHorizontalSeries = layout === 'horizontal' || layout === undefined && series.some(item => item.layout === 'horizontal');
|
|
46
|
+
const defaultAxisConfig = {
|
|
47
|
+
scaleType: 'band',
|
|
48
|
+
data: Array.from({
|
|
49
|
+
length: Math.max(...series.map(s => (s.data ?? dataset ?? []).length))
|
|
50
|
+
}, (_, index) => index)
|
|
51
|
+
};
|
|
52
|
+
const chartContainerProps = {
|
|
53
|
+
series: series.map(s => _extends({
|
|
54
|
+
type: 'bar'
|
|
55
|
+
}, s, {
|
|
56
|
+
layout: hasHorizontalSeries ? 'horizontal' : 'vertical'
|
|
57
|
+
})),
|
|
58
|
+
width,
|
|
59
|
+
height,
|
|
60
|
+
margin,
|
|
61
|
+
colors,
|
|
62
|
+
dataset,
|
|
63
|
+
xAxis: xAxis ?? (hasHorizontalSeries ? undefined : [_extends({
|
|
64
|
+
id: DEFAULT_X_AXIS_KEY
|
|
65
|
+
}, defaultAxisConfig)]),
|
|
66
|
+
yAxis: yAxis ?? (hasHorizontalSeries ? [_extends({
|
|
67
|
+
id: DEFAULT_Y_AXIS_KEY
|
|
68
|
+
}, defaultAxisConfig)] : undefined),
|
|
69
|
+
sx,
|
|
70
|
+
highlightedItem,
|
|
71
|
+
onHighlightChange,
|
|
72
|
+
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick
|
|
73
|
+
};
|
|
74
|
+
const barPlotProps = {
|
|
75
|
+
onItemClick,
|
|
76
|
+
slots,
|
|
77
|
+
slotProps,
|
|
78
|
+
skipAnimation,
|
|
79
|
+
borderRadius,
|
|
80
|
+
barLabel
|
|
81
|
+
};
|
|
82
|
+
const axisClickHandlerProps = {
|
|
83
|
+
onAxisClick
|
|
84
|
+
};
|
|
85
|
+
const gridProps = {
|
|
86
|
+
vertical: grid?.vertical,
|
|
87
|
+
horizontal: grid?.horizontal
|
|
88
|
+
};
|
|
89
|
+
const clipPathGroupProps = {
|
|
90
|
+
clipPath: `url(#${clipPathId})`
|
|
91
|
+
};
|
|
92
|
+
const clipPathProps = {
|
|
93
|
+
id: clipPathId
|
|
94
|
+
};
|
|
95
|
+
const overlayProps = {
|
|
96
|
+
slots,
|
|
97
|
+
slotProps,
|
|
98
|
+
loading
|
|
99
|
+
};
|
|
100
|
+
const chartsAxisProps = {
|
|
101
|
+
topAxis,
|
|
102
|
+
leftAxis,
|
|
103
|
+
rightAxis,
|
|
104
|
+
bottomAxis,
|
|
105
|
+
slots,
|
|
106
|
+
slotProps
|
|
107
|
+
};
|
|
108
|
+
const axisHighlightProps = _extends({}, hasHorizontalSeries ? {
|
|
109
|
+
y: 'band'
|
|
110
|
+
} : {
|
|
111
|
+
x: 'band'
|
|
112
|
+
}, axisHighlight);
|
|
113
|
+
const legendProps = _extends({}, legend, {
|
|
114
|
+
slots,
|
|
115
|
+
slotProps
|
|
116
|
+
});
|
|
117
|
+
const tooltipProps = _extends({}, tooltip, {
|
|
118
|
+
slots,
|
|
119
|
+
slotProps
|
|
120
|
+
});
|
|
121
|
+
return {
|
|
122
|
+
chartContainerProps,
|
|
123
|
+
barPlotProps,
|
|
124
|
+
axisClickHandlerProps,
|
|
125
|
+
gridProps,
|
|
126
|
+
clipPathProps,
|
|
127
|
+
clipPathGroupProps,
|
|
128
|
+
overlayProps,
|
|
129
|
+
chartsAxisProps,
|
|
130
|
+
axisHighlightProps,
|
|
131
|
+
legendProps,
|
|
132
|
+
tooltipProps,
|
|
133
|
+
children
|
|
134
|
+
};
|
|
135
|
+
};
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
|
-
import useForkRef from '@mui/utils/useForkRef';
|
|
4
3
|
import { DrawingProvider } from '../context/DrawingProvider';
|
|
5
4
|
import { SeriesContextProvider } from '../context/SeriesContextProvider';
|
|
6
5
|
import { InteractionProvider } from '../context/InteractionProvider';
|
|
7
6
|
import { ColorProvider } from '../context/ColorProvider';
|
|
8
|
-
import { useReducedMotion } from '../hooks/useReducedMotion';
|
|
9
7
|
import { ChartsSurface } from '../ChartsSurface';
|
|
10
|
-
import { CartesianContextProvider } from '../context/
|
|
8
|
+
import { CartesianContextProvider } from '../context/CartesianProvider';
|
|
11
9
|
import { ChartsAxesGradients } from '../internals/components/ChartsAxesGradients';
|
|
12
10
|
import { HighlightedProvider, ZAxisContextProvider } from '../context';
|
|
13
|
-
import {
|
|
11
|
+
import { useChartContainerHooks } from './useChartContainerHooks';
|
|
14
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
13
|
const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
16
14
|
const {
|
|
@@ -32,16 +30,14 @@ const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(pro
|
|
|
32
30
|
plugins,
|
|
33
31
|
children
|
|
34
32
|
} = props;
|
|
35
|
-
const svgRef = React.useRef(null);
|
|
36
|
-
const handleRef = useForkRef(ref, svgRef);
|
|
37
33
|
const {
|
|
34
|
+
svgRef,
|
|
35
|
+
handleRef,
|
|
38
36
|
xExtremumGetters,
|
|
39
37
|
yExtremumGetters,
|
|
40
38
|
seriesFormatters,
|
|
41
39
|
colorProcessors
|
|
42
|
-
} =
|
|
43
|
-
useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
|
|
44
|
-
|
|
40
|
+
} = useChartContainerHooks(ref, plugins);
|
|
45
41
|
return /*#__PURE__*/_jsx(DrawingProvider, {
|
|
46
42
|
width: width,
|
|
47
43
|
height: height,
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { usePluginsMerge } from './usePluginsMerge';
|
|
4
|
+
import { useReducedMotion } from '../hooks/useReducedMotion';
|
|
5
|
+
export const useChartContainerHooks = (ref, plugins) => {
|
|
6
|
+
const svgRef = React.useRef(null);
|
|
7
|
+
const handleRef = useForkRef(ref, svgRef);
|
|
8
|
+
const {
|
|
9
|
+
xExtremumGetters,
|
|
10
|
+
yExtremumGetters,
|
|
11
|
+
seriesFormatters,
|
|
12
|
+
colorProcessors
|
|
13
|
+
} = usePluginsMerge(plugins);
|
|
14
|
+
useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
|
|
15
|
+
|
|
16
|
+
return {
|
|
17
|
+
svgRef,
|
|
18
|
+
handleRef,
|
|
19
|
+
xExtremumGetters,
|
|
20
|
+
yExtremumGetters,
|
|
21
|
+
seriesFormatters,
|
|
22
|
+
colorProcessors
|
|
23
|
+
};
|
|
24
|
+
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
|
-
import {
|
|
4
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
5
5
|
import { ChartsXAxis } from '../ChartsXAxis';
|
|
6
6
|
import { ChartsYAxis } from '../ChartsYAxis';
|
|
7
7
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -47,7 +47,7 @@ function ChartsAxis(props) {
|
|
|
47
47
|
xAxisIds,
|
|
48
48
|
yAxis,
|
|
49
49
|
yAxisIds
|
|
50
|
-
} =
|
|
50
|
+
} = useCartesianContext();
|
|
51
51
|
|
|
52
52
|
// TODO: use for plotting line without ticks or any thing
|
|
53
53
|
// const drawingArea = React.useContext(DrawingContext);
|
|
@@ -6,7 +6,7 @@ import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
|
6
6
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
7
7
|
import { styled } from '@mui/material/styles';
|
|
8
8
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
9
|
-
import {
|
|
9
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
11
|
import { isBandScale } from '../internals/isBandScale';
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -55,7 +55,7 @@ function ChartsAxisHighlight(props) {
|
|
|
55
55
|
xAxis,
|
|
56
56
|
yAxisIds,
|
|
57
57
|
yAxis
|
|
58
|
-
} =
|
|
58
|
+
} = useCartesianContext();
|
|
59
59
|
const classes = useUtilityClasses();
|
|
60
60
|
const USED_X_AXIS_ID = xAxisIds[0];
|
|
61
61
|
const USED_Y_AXIS_ID = yAxisIds[0];
|
|
@@ -66,15 +66,30 @@ function ChartsAxisHighlight(props) {
|
|
|
66
66
|
} = React.useContext(InteractionContext);
|
|
67
67
|
const getXPosition = getValueToPositionMapper(xScale);
|
|
68
68
|
const getYPosition = getValueToPositionMapper(yScale);
|
|
69
|
+
const axisX = axis.x;
|
|
70
|
+
const axisY = axis.y;
|
|
71
|
+
const isBandScaleX = xAxisHighlight === 'band' && axisX !== null && isBandScale(xScale);
|
|
72
|
+
const isBandScaleY = yAxisHighlight === 'band' && axisY !== null && isBandScale(yScale);
|
|
73
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
74
|
+
const isXError = isBandScaleX && xScale(axisX.value) === undefined;
|
|
75
|
+
const isYError = isBandScaleY && yScale(axisY.value) === undefined;
|
|
76
|
+
if (isXError || isYError) {
|
|
77
|
+
console.error([`MUI X Charts: The position value provided for the axis is not valid for the current scale.`, `This probably means something is wrong with the data passed to the chart.`, `The ChartsAxisHighlight component will not be displayed.`].join('\n'));
|
|
78
|
+
}
|
|
79
|
+
}
|
|
69
80
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
70
|
-
children: [
|
|
71
|
-
|
|
81
|
+
children: [isBandScaleX && xScale(axisX.value) !== undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath
|
|
82
|
+
// @ts-expect-error, xScale value is checked in the statement above
|
|
83
|
+
, {
|
|
84
|
+
d: `M ${xScale(axisX.value) - (xScale.step() - xScale.bandwidth()) / 2} ${yScale.range()[0]} l ${xScale.step()} 0 l 0 ${yScale.range()[1] - yScale.range()[0]} l ${-xScale.step()} 0 Z`,
|
|
72
85
|
className: classes.root,
|
|
73
86
|
ownerState: {
|
|
74
87
|
axisHighlight: 'band'
|
|
75
88
|
}
|
|
76
|
-
}),
|
|
77
|
-
d: `M ${xScale.range()[0]} ${
|
|
89
|
+
}), isBandScaleY && yScale(axisY.value) === undefined && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
|
|
90
|
+
d: `M ${xScale.range()[0]} ${
|
|
91
|
+
// @ts-expect-error, yScale value is checked in the statement above
|
|
92
|
+
yScale(axisY.value) - (yScale.step() - yScale.bandwidth()) / 2} l 0 ${yScale.step()} l ${xScale.range()[1] - xScale.range()[0]} 0 l 0 ${-yScale.step()} Z`,
|
|
78
93
|
className: classes.root,
|
|
79
94
|
ownerState: {
|
|
80
95
|
axisHighlight: 'band'
|
|
@@ -5,7 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
7
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
|
-
import {
|
|
8
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
9
9
|
import { useTicks } from '../hooks/useTicks';
|
|
10
10
|
import { getChartsGridUtilityClass, chartsGridClasses } from './chartsGridClasses';
|
|
11
11
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -63,7 +63,7 @@ function ChartsGrid(props) {
|
|
|
63
63
|
xAxisIds,
|
|
64
64
|
yAxis,
|
|
65
65
|
yAxisIds
|
|
66
|
-
} =
|
|
66
|
+
} = useCartesianContext();
|
|
67
67
|
const classes = useUtilityClasses(themeProps);
|
|
68
68
|
const horizontalAxisId = yAxisIds[0];
|
|
69
69
|
const verticalAxisId = xAxisIds[0];
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
4
|
-
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
5
4
|
import { useSeries } from '../hooks/useSeries';
|
|
6
5
|
import { useSvgRef } from '../hooks';
|
|
6
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
7
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
8
|
function ChartsOnAxisClickHandler(props) {
|
|
9
9
|
const {
|
|
@@ -19,7 +19,7 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
19
19
|
xAxis,
|
|
20
20
|
yAxisIds,
|
|
21
21
|
yAxis
|
|
22
|
-
} =
|
|
22
|
+
} = useCartesianContext();
|
|
23
23
|
React.useEffect(() => {
|
|
24
24
|
const element = svgRef.current;
|
|
25
25
|
if (element === null || !onAxisClick) {
|
|
@@ -2,7 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { useSlotProps } from '@mui/base/utils';
|
|
5
|
-
import {
|
|
5
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
6
6
|
import { DefaultChartsAxisTooltipContent } from './DefaultChartsAxisTooltipContent';
|
|
7
7
|
import { ZAxisContext } from '../context/ZAxisContextProvider';
|
|
8
8
|
import { useColorProcessor } from '../hooks/useColor';
|
|
@@ -25,7 +25,7 @@ function ChartsAxisTooltipContent(props) {
|
|
|
25
25
|
xAxis,
|
|
26
26
|
yAxisIds,
|
|
27
27
|
yAxis
|
|
28
|
-
} =
|
|
28
|
+
} = useCartesianContext();
|
|
29
29
|
const {
|
|
30
30
|
zAxisIds,
|
|
31
31
|
zAxis
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import PropTypes from 'prop-types';
|
|
4
4
|
import { useSlotProps } from '@mui/base/utils';
|
|
5
5
|
import { DefaultChartsItemTooltipContent } from './DefaultChartsItemTooltipContent';
|
|
6
|
-
import {
|
|
6
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
7
7
|
import { ZAxisContext } from '../context/ZAxisContextProvider';
|
|
8
8
|
import { useColorProcessor } from '../hooks/useColor';
|
|
9
9
|
import { useSeries } from '../hooks/useSeries';
|
|
@@ -22,7 +22,7 @@ function ChartsItemTooltipContent(props) {
|
|
|
22
22
|
yAxis,
|
|
23
23
|
xAxisIds,
|
|
24
24
|
yAxisIds
|
|
25
|
-
} =
|
|
25
|
+
} = useCartesianContext();
|
|
26
26
|
const {
|
|
27
27
|
zAxis,
|
|
28
28
|
zAxisIds
|
|
@@ -3,9 +3,9 @@ import PropTypes from 'prop-types';
|
|
|
3
3
|
import { Delaunay } from 'd3-delaunay';
|
|
4
4
|
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
5
5
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
6
|
-
import {
|
|
6
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
7
7
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
8
|
-
import { getSVGPoint } from '../internals/
|
|
8
|
+
import { getSVGPoint } from '../internals/getSVGPoint';
|
|
9
9
|
import { useDrawingArea, useSvgRef } from '../hooks';
|
|
10
10
|
import { useHighlighted } from '../context';
|
|
11
11
|
import { useScatterSeries } from '../hooks/useSeries';
|
|
@@ -27,7 +27,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
27
27
|
yAxis,
|
|
28
28
|
xAxisIds,
|
|
29
29
|
yAxisIds
|
|
30
|
-
} =
|
|
30
|
+
} = useCartesianContext();
|
|
31
31
|
const {
|
|
32
32
|
dispatch
|
|
33
33
|
} = React.useContext(InteractionContext);
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { useSlotProps } from '@mui/base/utils';
|
|
7
7
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
8
|
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
9
|
-
import {
|
|
9
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
10
10
|
import { useTicks } from '../hooks/useTicks';
|
|
11
11
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
12
12
|
import { AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
@@ -107,7 +107,7 @@ function ChartsXAxis(inProps) {
|
|
|
107
107
|
const {
|
|
108
108
|
xAxisIds,
|
|
109
109
|
xAxis
|
|
110
|
-
} =
|
|
110
|
+
} = useCartesianContext();
|
|
111
111
|
const _xAxis = xAxis[inProps.axisId ?? xAxisIds[0]],
|
|
112
112
|
{
|
|
113
113
|
scale: xScale,
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { useSlotProps } from '@mui/base/utils';
|
|
7
7
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
8
8
|
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
9
|
-
import {
|
|
9
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
10
10
|
import { useTicks } from '../hooks/useTicks';
|
|
11
11
|
import { useDrawingArea } from '../hooks/useDrawingArea';
|
|
12
12
|
import { AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
@@ -50,7 +50,7 @@ function ChartsYAxis(inProps) {
|
|
|
50
50
|
const {
|
|
51
51
|
yAxisIds,
|
|
52
52
|
yAxis
|
|
53
|
-
} =
|
|
53
|
+
} = useCartesianContext();
|
|
54
54
|
const _yAxis = yAxis[inProps.axisId ?? yAxisIds[0]],
|
|
55
55
|
{
|
|
56
56
|
scale: yScale,
|
|
@@ -81,6 +81,7 @@ function ChartsYAxis(inProps) {
|
|
|
81
81
|
tickLabelInterval
|
|
82
82
|
} = defaultizedProps;
|
|
83
83
|
const theme = useTheme();
|
|
84
|
+
const isRTL = theme.direction === 'rtl';
|
|
84
85
|
const classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
85
86
|
theme
|
|
86
87
|
}));
|
|
@@ -108,13 +109,14 @@ function ChartsYAxis(inProps) {
|
|
|
108
109
|
const Tick = slots?.axisTick ?? 'line';
|
|
109
110
|
const TickLabel = slots?.axisTickLabel ?? ChartsText;
|
|
110
111
|
const Label = slots?.axisLabel ?? ChartsText;
|
|
112
|
+
const revertAnchor = !isRTL && position === 'right' || isRTL && position !== 'right';
|
|
111
113
|
const axisTickLabelProps = useSlotProps({
|
|
112
114
|
elementType: TickLabel,
|
|
113
115
|
externalSlotProps: slotProps?.axisTickLabel,
|
|
114
116
|
additionalProps: {
|
|
115
117
|
style: _extends({
|
|
116
118
|
fontSize: tickFontSize,
|
|
117
|
-
textAnchor:
|
|
119
|
+
textAnchor: revertAnchor ? 'start' : 'end',
|
|
118
120
|
dominantBaseline: 'central'
|
|
119
121
|
}, tickLabelStyle)
|
|
120
122
|
},
|
|
@@ -4,7 +4,7 @@ const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { area as d3Area } from 'd3-shape';
|
|
7
|
-
import {
|
|
7
|
+
import { useCartesianContext } from '../context/CartesianProvider';
|
|
8
8
|
import { AreaElement } from './AreaElement';
|
|
9
9
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
10
10
|
import getCurveFactory from '../internals/getCurve';
|
|
@@ -14,7 +14,7 @@ import { useLineSeries } from '../hooks/useSeries';
|
|
|
14
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
15
|
const useAggregatedData = () => {
|
|
16
16
|
const seriesData = useLineSeries();
|
|
17
|
-
const axisData =
|
|
17
|
+
const axisData = useCartesianContext();
|
|
18
18
|
if (seriesData === undefined) {
|
|
19
19
|
return [];
|
|
20
20
|
}
|