@mui/x-charts 8.0.0-alpha.1 → 8.0.0-alpha.3
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 +0 -4
- package/BarChart/BarLabel/BarLabel.d.ts +298 -298
- package/CHANGELOG.md +330 -7
- package/ChartContainer/ChartContainer.d.ts +24 -0
- package/ChartContainer/ChartContainer.js +26 -10
- package/ChartContainer/useChartContainerProps.d.ts +0 -1
- package/ChartContainer/useChartContainerProps.js +3 -4
- package/ChartsAxis/axisClasses.js +2 -1
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +3 -3
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +3 -3
- package/ChartsLegend/chartsLegendClasses.js +2 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsSurface/ChartsSurface.d.ts +14 -0
- package/ChartsSurface/ChartsSurface.js +38 -6
- package/ChartsTooltip/ChartsTooltip.js +2 -20
- package/ChartsTooltip/ChartsTooltipContainer.js +5 -23
- package/ChartsTooltip/ChartsTooltipTable.js +2 -2
- package/ChartsTooltip/useAxisTooltip.js +3 -3
- package/ChartsTooltip/useItemTooltip.d.ts +2 -3
- package/ChartsTooltip/useItemTooltip.js +3 -3
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/ChartsXAxis/ChartsXAxis.js +3 -17
- package/ChartsYAxis/ChartsYAxis.js +2 -17
- package/Gauge/Gauge.d.ts +1 -1
- package/Gauge/GaugeContainer.d.ts +2 -2
- package/Gauge/GaugeContainer.js +14 -47
- package/LineChart/CircleMarkElement.js +3 -3
- package/LineChart/LineChart.js +0 -4
- package/LineChart/LineHighlightPlot.js +3 -3
- package/LineChart/MarkElement.js +3 -3
- package/PieChart/PieArc.js +11 -5
- package/PieChart/PieArcPlot.js +9 -13
- package/PieChart/PieChart.js +0 -4
- package/ScatterChart/Scatter.js +3 -3
- package/ScatterChart/ScatterChart.js +0 -4
- package/SparkLineChart/SparkLineChart.js +0 -4
- package/context/CartesianProvider/defaultizeAxis.d.ts +9 -11
- package/context/ChartDataProvider/ChartDataProvider.d.ts +27 -0
- package/context/ChartDataProvider/ChartDataProvider.js +38 -18
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +18 -22
- package/context/ChartDataProvider/useDefaultizeAxis.d.ts +9 -11
- package/context/ChartProvider/ChartContext.d.ts +6 -0
- package/context/ChartProvider/ChartContext.js +8 -0
- package/context/ChartProvider/ChartProvider.d.ts +4 -0
- package/context/ChartProvider/ChartProvider.js +19 -0
- package/context/ChartProvider/ChartProvider.types.d.ts +24 -0
- package/context/ChartProvider/index.d.ts +3 -0
- package/context/ChartProvider/index.js +3 -0
- package/context/ChartProvider/useChartContext.d.ts +3 -0
- package/context/ChartProvider/useChartContext.js +11 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +1 -6
- package/context/DrawingAreaProvider/DrawingAreaContext.js +0 -1
- package/context/InteractionSelectors.d.ts +72 -49
- package/context/SizeProvider/Size.types.d.ts +2 -2
- package/context/SizeProvider/SizeContext.js +3 -1
- package/context/SizeProvider/useChartContainerDimensions.d.ts +1 -1
- package/context/SizeProvider/useChartContainerDimensions.js +5 -1
- package/hooks/useAxisEvents.js +1 -1
- package/hooks/useChartId.js +5 -6
- package/hooks/useInteractionItemProps.js +4 -2
- package/hooks/useSvgRef.d.ts +1 -1
- package/hooks/useSvgRef.js +4 -8
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -5
- package/internals/defaultizeColor.d.ts +1 -1
- package/internals/index.d.ts +1 -3
- package/internals/index.js +1 -3
- package/internals/plugins/allPlugins.d.ts +1 -0
- package/internals/plugins/allPlugins.js +3 -0
- package/internals/plugins/corePlugins/corePlugins.d.ts +10 -0
- package/internals/plugins/corePlugins/corePlugins.js +7 -0
- package/internals/plugins/corePlugins/index.d.ts +2 -0
- package/internals/plugins/corePlugins/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/index.d.ts +2 -0
- package/internals/plugins/corePlugins/useChartId/index.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +36 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.types.d.ts +20 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.utils.d.ts +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +376 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +57 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
- package/internals/plugins/models/chart.d.ts +14 -0
- package/internals/plugins/models/chart.js +1 -0
- package/internals/plugins/models/helpers.d.ts +7 -0
- package/internals/plugins/models/helpers.js +1 -0
- package/internals/plugins/models/index.d.ts +3 -35
- package/internals/plugins/models/index.js +3 -1
- package/internals/plugins/models/plugin.d.ts +75 -0
- package/internals/plugins/models/plugin.js +1 -0
- package/internals/plugins/utils/ChartStore.d.ts +9 -8
- package/internals/plugins/utils/ChartStore.js +0 -2
- package/internals/plugins/utils/selectors.d.ts +2 -2
- package/internals/store/useCharts.d.ts +14 -0
- package/internals/store/useCharts.js +72 -0
- package/internals/store/useCharts.types.d.ts +5 -0
- package/internals/store/useCharts.types.js +1 -0
- package/internals/store/useSelector.d.ts +4 -0
- package/internals/store/useStore.d.ts +3 -0
- package/{modern/internals → internals/store}/useStore.js +6 -6
- package/models/axis.d.ts +1 -13
- package/modern/BarChart/BarChart.js +0 -4
- package/modern/ChartContainer/ChartContainer.js +26 -10
- package/modern/ChartContainer/useChartContainerProps.js +3 -4
- package/modern/ChartsAxis/axisClasses.js +2 -1
- package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +3 -3
- package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +3 -3
- package/modern/ChartsLegend/chartsLegendClasses.js +2 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/modern/ChartsSurface/ChartsSurface.js +38 -6
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -20
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +5 -23
- package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -2
- package/modern/ChartsTooltip/useAxisTooltip.js +3 -3
- package/modern/ChartsTooltip/useItemTooltip.js +3 -3
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +3 -17
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -17
- package/modern/Gauge/GaugeContainer.js +14 -47
- package/modern/LineChart/CircleMarkElement.js +3 -3
- package/modern/LineChart/LineChart.js +0 -4
- package/modern/LineChart/LineHighlightPlot.js +3 -3
- package/modern/LineChart/MarkElement.js +3 -3
- package/modern/PieChart/PieArc.js +11 -5
- package/modern/PieChart/PieArcPlot.js +9 -13
- package/modern/PieChart/PieChart.js +0 -4
- package/modern/ScatterChart/Scatter.js +3 -3
- package/modern/ScatterChart/ScatterChart.js +0 -4
- package/modern/SparkLineChart/SparkLineChart.js +0 -4
- package/modern/context/ChartDataProvider/ChartDataProvider.js +38 -18
- package/modern/context/ChartProvider/ChartContext.js +8 -0
- package/modern/context/ChartProvider/ChartProvider.js +19 -0
- package/modern/context/ChartProvider/ChartProvider.types.js +1 -0
- package/modern/context/ChartProvider/index.js +3 -0
- package/modern/context/ChartProvider/useChartContext.js +11 -0
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +0 -1
- package/modern/context/SizeProvider/SizeContext.js +3 -1
- package/modern/context/SizeProvider/useChartContainerDimensions.js +5 -1
- package/modern/hooks/useAxisEvents.js +1 -1
- package/modern/hooks/useChartId.js +5 -6
- package/modern/hooks/useInteractionItemProps.js +4 -2
- package/modern/hooks/useSvgRef.js +4 -8
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -5
- package/modern/internals/index.js +1 -3
- package/modern/internals/plugins/allPlugins.js +3 -0
- package/modern/internals/plugins/corePlugins/corePlugins.js +7 -0
- package/modern/internals/plugins/corePlugins/index.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/index.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.js +32 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +9 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.types.js +1 -0
- package/modern/internals/plugins/corePlugins/useChartId/useChartId.utils.js +5 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/index.js +2 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +73 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +1 -0
- package/modern/internals/plugins/models/chart.js +1 -0
- package/modern/internals/plugins/models/helpers.js +1 -0
- package/modern/internals/plugins/models/index.js +3 -1
- package/modern/internals/plugins/models/plugin.js +1 -0
- package/modern/internals/plugins/utils/ChartStore.js +0 -2
- package/modern/internals/store/useCharts.js +72 -0
- package/modern/internals/store/useCharts.types.js +1 -0
- package/{internals → modern/internals/store}/useStore.js +6 -6
- package/node/BarChart/BarChart.js +0 -4
- package/node/ChartContainer/ChartContainer.js +26 -10
- package/node/ChartContainer/useChartContainerProps.js +3 -4
- package/node/ChartsAxis/axisClasses.js +5 -3
- package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
- package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
- package/node/ChartsLegend/chartsLegendClasses.js +5 -3
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/node/ChartsSurface/ChartsSurface.js +37 -5
- package/node/ChartsTooltip/ChartsTooltip.js +2 -20
- package/node/ChartsTooltip/ChartsTooltipContainer.js +6 -24
- package/node/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/node/ChartsTooltip/useAxisTooltip.js +4 -4
- package/node/ChartsTooltip/useItemTooltip.js +4 -4
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/node/ChartsXAxis/ChartsXAxis.js +3 -17
- package/node/ChartsYAxis/ChartsYAxis.js +2 -17
- package/node/Gauge/GaugeContainer.js +13 -46
- package/node/LineChart/CircleMarkElement.js +4 -4
- package/node/LineChart/LineChart.js +0 -4
- package/node/LineChart/LineHighlightPlot.js +4 -4
- package/node/LineChart/MarkElement.js +4 -4
- package/node/PieChart/PieArc.js +11 -5
- package/node/PieChart/PieArcPlot.js +9 -13
- package/node/PieChart/PieChart.js +0 -4
- package/node/ScatterChart/Scatter.js +4 -4
- package/node/ScatterChart/ScatterChart.js +0 -4
- package/node/SparkLineChart/SparkLineChart.js +0 -4
- package/node/context/ChartDataProvider/ChartDataProvider.js +38 -18
- package/node/context/ChartProvider/ChartContext.js +15 -0
- package/node/context/ChartProvider/ChartProvider.js +24 -0
- package/node/context/ChartProvider/index.js +38 -0
- package/node/context/ChartProvider/useChartContext.js +18 -0
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +0 -1
- package/node/context/SizeProvider/SizeContext.js +3 -1
- package/node/context/SizeProvider/useChartContainerDimensions.js +5 -1
- package/node/hooks/useAxisEvents.js +1 -1
- package/node/hooks/useChartId.js +5 -7
- package/node/hooks/useInteractionItemProps.js +4 -2
- package/node/hooks/useSvgRef.js +4 -9
- package/node/index.js +1 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +1 -4
- package/node/internals/index.js +4 -28
- package/node/internals/plugins/allPlugins.js +10 -0
- package/node/internals/plugins/corePlugins/corePlugins.js +12 -0
- package/node/internals/plugins/corePlugins/index.js +12 -0
- package/node/internals/plugins/corePlugins/useChartId/index.js +12 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.js +41 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +15 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.types.js +5 -0
- package/node/internals/plugins/corePlugins/useChartId/useChartId.utils.js +12 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/index.js +27 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +81 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +16 -0
- package/node/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js +5 -0
- package/node/internals/plugins/models/chart.js +5 -0
- package/node/internals/plugins/models/helpers.js +5 -0
- package/node/internals/plugins/models/index.js +33 -0
- package/node/internals/plugins/models/plugin.js +5 -0
- package/node/internals/plugins/utils/ChartStore.js +0 -2
- package/node/internals/store/useCharts.js +80 -0
- package/node/internals/store/useCharts.types.js +5 -0
- package/node/internals/{useStore.js → store/useStore.js} +6 -7
- package/package.json +4 -4
- package/ChartContainer/ResizableContainer.d.ts +0 -22
- package/ChartContainer/ResizableContainer.js +0 -60
- package/context/InteractionProvider.d.ts +0 -7
- package/context/InteractionProvider.js +0 -22
- package/context/SvgRefProvider/SvgRef.types.d.ts +0 -8
- package/context/SvgRefProvider/SvgRefContext.d.ts +0 -4
- package/context/SvgRefProvider/SvgRefContext.js +0 -17
- package/context/SvgRefProvider/SvgRefProvider.d.ts +0 -3
- package/context/SvgRefProvider/SvgRefProvider.js +0 -24
- package/context/SvgRefProvider/index.d.ts +0 -4
- package/context/SvgRefProvider/index.js +0 -4
- package/context/SvgRefProvider/useSurfaceRef.d.ts +0 -2
- package/context/SvgRefProvider/useSurfaceRef.js +0 -14
- package/internals/plugins/utils/ChartsStore.d.ts +0 -12
- package/internals/plugins/utils/ChartsStore.js +0 -26
- package/internals/useCharts.d.ts +0 -6
- package/internals/useCharts.js +0 -29
- package/internals/useSelector.d.ts +0 -4
- package/internals/useStore.d.ts +0 -2
- package/modern/ChartContainer/ResizableContainer.js +0 -60
- package/modern/context/InteractionProvider.js +0 -22
- package/modern/context/SvgRefProvider/SvgRefContext.js +0 -17
- package/modern/context/SvgRefProvider/SvgRefProvider.js +0 -24
- package/modern/context/SvgRefProvider/index.js +0 -4
- package/modern/context/SvgRefProvider/useSurfaceRef.js +0 -14
- package/modern/internals/plugins/utils/ChartsStore.js +0 -26
- package/modern/internals/useCharts.js +0 -29
- package/node/ChartContainer/ResizableContainer.js +0 -68
- package/node/context/InteractionProvider.js +0 -28
- package/node/context/SvgRefProvider/SvgRefContext.js +0 -23
- package/node/context/SvgRefProvider/SvgRefProvider.js +0 -31
- package/node/context/SvgRefProvider/index.js +0 -49
- package/node/context/SvgRefProvider/useSurfaceRef.js +0 -20
- package/node/internals/plugins/utils/ChartsStore.js +0 -33
- package/node/internals/useCharts.js +0 -36
- /package/context/{SvgRefProvider/SvgRef.types.js → ChartProvider/ChartProvider.types.js} +0 -0
- /package/{modern/context/SvgRefProvider/SvgRef.types.js → internals/plugins/corePlugins/useChartId/useChartId.types.js} +0 -0
- /package/internals/{useSelector.js → store/useSelector.js} +0 -0
- /package/modern/internals/{useSelector.js → store/useSelector.js} +0 -0
- /package/node/context/{SvgRefProvider/SvgRef.types.js → ChartProvider/ChartProvider.types.js} +0 -0
- /package/node/internals/{useSelector.js → store/useSelector.js} +0 -0
|
@@ -5,7 +5,6 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { DrawingAreaProvider } from "../DrawingAreaProvider/index.js";
|
|
7
7
|
import { SeriesProvider } from "../SeriesProvider/index.js";
|
|
8
|
-
import { InteractionProvider } from "../InteractionProvider.js";
|
|
9
8
|
import { CartesianProvider } from "../CartesianProvider/index.js";
|
|
10
9
|
import { PluginProvider } from "../PluginProvider/index.js";
|
|
11
10
|
import { useChartDataProviderProps } from "./useChartDataProviderProps.js";
|
|
@@ -13,8 +12,35 @@ import { AnimationProvider } from "../AnimationProvider/index.js";
|
|
|
13
12
|
import { ZAxisContextProvider } from "../ZAxisContextProvider.js";
|
|
14
13
|
import { HighlightedProvider } from "../HighlightedProvider/index.js";
|
|
15
14
|
import { SizeProvider } from "../SizeProvider/index.js";
|
|
16
|
-
import {
|
|
15
|
+
import { ChartProvider } from "../ChartProvider/index.js";
|
|
17
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
/**
|
|
18
|
+
* Orchestrates the data providers for the chart components and hooks.
|
|
19
|
+
*
|
|
20
|
+
* Use this component if you have custom HTML components that need to access the chart data.
|
|
21
|
+
*
|
|
22
|
+
* Demos:
|
|
23
|
+
*
|
|
24
|
+
* - [Composition](http://localhost:3001/x/react-charts/composition/)
|
|
25
|
+
*
|
|
26
|
+
* API:
|
|
27
|
+
*
|
|
28
|
+
* - [ChartDataProvider API](https://mui.com/x/api/charts/chart-data-provider/)
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```jsx
|
|
32
|
+
* <ChartDataProvider
|
|
33
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
34
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
35
|
+
* >
|
|
36
|
+
* <ChartsSurface>
|
|
37
|
+
* <BarPlot />
|
|
38
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
39
|
+
* </ChartsSurface>
|
|
40
|
+
* {'Custom Legend Component'}
|
|
41
|
+
* </ChartDataProvider>
|
|
42
|
+
* ```
|
|
43
|
+
*/
|
|
18
44
|
function ChartDataProvider(props) {
|
|
19
45
|
const {
|
|
20
46
|
children,
|
|
@@ -27,27 +53,25 @@ function ChartDataProvider(props) {
|
|
|
27
53
|
animationProviderProps,
|
|
28
54
|
sizeProviderProps
|
|
29
55
|
} = useChartDataProviderProps(props);
|
|
30
|
-
return /*#__PURE__*/_jsx(
|
|
31
|
-
children: /*#__PURE__*/_jsx(
|
|
32
|
-
children: /*#__PURE__*/_jsx(
|
|
33
|
-
children: /*#__PURE__*/_jsx(
|
|
34
|
-
children: /*#__PURE__*/_jsx(
|
|
35
|
-
children: /*#__PURE__*/_jsx(
|
|
36
|
-
children: /*#__PURE__*/_jsx(
|
|
56
|
+
return /*#__PURE__*/_jsx(ChartProvider, {
|
|
57
|
+
children: /*#__PURE__*/_jsx(SizeProvider, _extends({}, sizeProviderProps, {
|
|
58
|
+
children: /*#__PURE__*/_jsx(DrawingAreaProvider, _extends({}, drawingAreaProviderProps, {
|
|
59
|
+
children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
|
|
60
|
+
children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
|
|
61
|
+
children: /*#__PURE__*/_jsx(CartesianProvider, _extends({}, cartesianProviderProps, {
|
|
62
|
+
children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
|
|
37
63
|
children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
|
|
38
64
|
children: /*#__PURE__*/_jsx(AnimationProvider, _extends({}, animationProviderProps, {
|
|
39
|
-
children:
|
|
40
|
-
children: children
|
|
41
|
-
})
|
|
65
|
+
children: children
|
|
42
66
|
}))
|
|
43
67
|
}))
|
|
44
|
-
})
|
|
68
|
+
}))
|
|
45
69
|
}))
|
|
46
70
|
}))
|
|
47
71
|
}))
|
|
48
72
|
}))
|
|
49
73
|
}))
|
|
50
|
-
})
|
|
74
|
+
});
|
|
51
75
|
}
|
|
52
76
|
process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
53
77
|
// ----------------------------- Warning --------------------------------
|
|
@@ -144,7 +168,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
|
144
168
|
hideTooltip: PropTypes.bool,
|
|
145
169
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
146
170
|
label: PropTypes.string,
|
|
147
|
-
labelFontSize: PropTypes.number,
|
|
148
171
|
labelStyle: PropTypes.object,
|
|
149
172
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
150
173
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -155,7 +178,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
|
155
178
|
slots: PropTypes.object,
|
|
156
179
|
stroke: PropTypes.string,
|
|
157
180
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
158
|
-
tickFontSize: PropTypes.number,
|
|
159
181
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
160
182
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
161
183
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -198,7 +220,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
|
198
220
|
hideTooltip: PropTypes.bool,
|
|
199
221
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
200
222
|
label: PropTypes.string,
|
|
201
|
-
labelFontSize: PropTypes.number,
|
|
202
223
|
labelStyle: PropTypes.object,
|
|
203
224
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
204
225
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -209,7 +230,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProvider.propTypes = {
|
|
|
209
230
|
slots: PropTypes.object,
|
|
210
231
|
stroke: PropTypes.string,
|
|
211
232
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
212
|
-
tickFontSize: PropTypes.number,
|
|
213
233
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
214
234
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
215
235
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useCharts } from "../../internals/store/useCharts.js";
|
|
5
|
+
import { ChartContext } from "./ChartContext.js";
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
function ChartProvider(props) {
|
|
8
|
+
const {
|
|
9
|
+
children
|
|
10
|
+
} = props;
|
|
11
|
+
const {
|
|
12
|
+
contextValue
|
|
13
|
+
} = useCharts([], {});
|
|
14
|
+
return /*#__PURE__*/_jsx(ChartContext.Provider, {
|
|
15
|
+
value: contextValue,
|
|
16
|
+
children: children
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
export { ChartProvider };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { ChartContext } from "./ChartContext.js";
|
|
5
|
+
export const useChartContext = () => {
|
|
6
|
+
const context = React.useContext(ChartContext);
|
|
7
|
+
if (context == null) {
|
|
8
|
+
throw new Error(['MUI X: Could not find the Chart context.', 'It looks like you rendered your component outside of a ChartDataProvider.', 'This can also happen if you are bundling multiple versions of the library.'].join('\n'));
|
|
9
|
+
}
|
|
10
|
+
return context;
|
|
11
|
+
};
|
|
@@ -20,6 +20,10 @@ export const useChartContainerDimensions = (inWidth, inHeight) => {
|
|
|
20
20
|
const computeSize = React.useCallback(() => {
|
|
21
21
|
const mainEl = rootRef?.current;
|
|
22
22
|
if (!mainEl) {
|
|
23
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
24
|
+
// This is mostly for internal use.
|
|
25
|
+
throw new Error([`MUI X: ChartContainer does not have a valid reference to the <svg /> element.`, 'This may be caused by a ref forwarding issue.', 'Make sure that the ref from SizedProvider is forwarded correctly.'].join('\n'));
|
|
26
|
+
}
|
|
23
27
|
return {};
|
|
24
28
|
}
|
|
25
29
|
const win = ownerWindow(mainEl);
|
|
@@ -94,7 +98,7 @@ export const useChartContainerDimensions = (inWidth, inHeight) => {
|
|
|
94
98
|
const finalWidth = inWidth ?? width;
|
|
95
99
|
const finalHeight = inHeight ?? height;
|
|
96
100
|
return {
|
|
97
|
-
|
|
101
|
+
svgRef: rootRef,
|
|
98
102
|
width: finalWidth,
|
|
99
103
|
height: finalHeight,
|
|
100
104
|
hasIntrinsicSize: finalWidth > 0 && finalHeight > 0,
|
|
@@ -7,7 +7,7 @@ import { isBandScale } from "../internals/isBandScale.js";
|
|
|
7
7
|
import { getSVGPoint } from "../internals/getSVGPoint.js";
|
|
8
8
|
import { useSvgRef } from "./useSvgRef.js";
|
|
9
9
|
import { useDrawingArea } from "./useDrawingArea.js";
|
|
10
|
-
import { useStore } from "../internals/useStore.js";
|
|
10
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
11
11
|
function getAsANumber(value) {
|
|
12
12
|
return value instanceof Date ? value.getTime() : value;
|
|
13
13
|
}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
4
|
+
import { useSelector } from "../internals/store/useSelector.js";
|
|
5
|
+
import { selectorChartId } from "../internals/plugins/corePlugins/useChartId/useChartId.selectors.js";
|
|
5
6
|
export function useChartId() {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
} = React.useContext(DrawingAreaContext);
|
|
9
|
-
return React.useMemo(() => chartId, [chartId]);
|
|
7
|
+
const store = useStore();
|
|
8
|
+
return useSelector(store, selectorChartId);
|
|
10
9
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import { useHighlighted } from "../context/index.js";
|
|
5
|
-
import { useStore } from "../internals/useStore.js";
|
|
5
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
6
6
|
export const useInteractionItemProps = skip => {
|
|
7
7
|
const store = useStore();
|
|
8
8
|
const {
|
|
@@ -30,7 +30,9 @@ export const useInteractionItemProps = skip => {
|
|
|
30
30
|
});
|
|
31
31
|
};
|
|
32
32
|
const onPointerLeave = event => {
|
|
33
|
-
event.currentTarget.
|
|
33
|
+
if (event.currentTarget.hasPointerCapture(event.pointerId)) {
|
|
34
|
+
event.currentTarget.releasePointerCapture(event.pointerId);
|
|
35
|
+
}
|
|
34
36
|
store.update(prev => {
|
|
35
37
|
const prevItem = prev.interaction.item;
|
|
36
38
|
if (prevItem === null || Object.keys(data).some(key => data[key] !== prevItem[key])) {
|
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
import { SvgRefContext } from "../context/SvgRefProvider/index.js";
|
|
3
|
+
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
5
4
|
export function useSvgRef() {
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
data
|
|
9
|
-
} = React.useContext(SvgRefContext);
|
|
10
|
-
if (!isInitialized) {
|
|
5
|
+
const context = useChartContext();
|
|
6
|
+
if (!context) {
|
|
11
7
|
throw new Error(['MUI X: Could not find the svg ref context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
12
8
|
}
|
|
13
|
-
return
|
|
9
|
+
return context.svgRef;
|
|
14
10
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { useCartesianContext } from "../../../context/CartesianProvider/index.js";
|
|
3
|
-
import {
|
|
4
|
-
import { useDrawingArea } from "../../../hooks/index.js";
|
|
3
|
+
import { useChartId, useDrawingArea } from "../../../hooks/index.js";
|
|
5
4
|
import ChartsPiecewiseGradient from "./ChartsPiecewiseGradient.js";
|
|
6
5
|
import ChartsContinuousGradient from "./ChartsContinuousGradient.js";
|
|
7
6
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
7
|
export function useChartGradient() {
|
|
9
|
-
const
|
|
10
|
-
chartId
|
|
11
|
-
} = React.useContext(DrawingAreaContext);
|
|
8
|
+
const chartId = useChartId();
|
|
12
9
|
return React.useCallback((axisId, direction) => `${chartId}-gradient-${direction}-${axisId}`, [chartId]);
|
|
13
10
|
}
|
|
14
11
|
export function ChartsAxesGradients() {
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
// Components
|
|
2
2
|
export * from "./components/ChartsAxesGradients/index.js";
|
|
3
|
-
export * from "../ChartContainer/ResizableContainer.js";
|
|
4
3
|
|
|
5
4
|
// hooks
|
|
6
5
|
export { useSeries } from "../hooks/useSeries.js";
|
|
@@ -26,7 +25,6 @@ export * from "./computeAxisValue.js";
|
|
|
26
25
|
|
|
27
26
|
export * from "../context/CartesianProvider/index.js";
|
|
28
27
|
export * from "../context/DrawingAreaProvider/index.js";
|
|
29
|
-
export * from "../context/InteractionProvider.js";
|
|
30
28
|
export * from "../context/SeriesProvider/index.js";
|
|
31
29
|
export * from "../context/ZAxisContextProvider.js";
|
|
32
30
|
export * from "../context/PluginProvider/index.js";
|
|
@@ -34,7 +32,7 @@ export * from "../context/AnimationProvider/index.js";
|
|
|
34
32
|
export { getAxisExtremum } from "../context/CartesianProvider/getAxisExtremum.js";
|
|
35
33
|
export * from "../context/ChartDataProvider/index.js";
|
|
36
34
|
export * from "../context/SizeProvider/index.js";
|
|
37
|
-
export * from "../context/
|
|
35
|
+
export * from "../context/ChartProvider/index.js";
|
|
38
36
|
|
|
39
37
|
// series configuration
|
|
40
38
|
export * from "../models/seriesType/config.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CHART_CORE_PLUGINS } from "./corePlugins.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { useChartId } from "./useChartId.js";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { createChartDefaultId } from "./useChartId.utils.js";
|
|
4
|
+
export const useChartId = ({
|
|
5
|
+
params,
|
|
6
|
+
store
|
|
7
|
+
}) => {
|
|
8
|
+
React.useEffect(() => {
|
|
9
|
+
store.update(prevState => {
|
|
10
|
+
if (params.id === prevState.id.providedChartId && prevState.id.chartId !== undefined) {
|
|
11
|
+
return prevState;
|
|
12
|
+
}
|
|
13
|
+
return _extends({}, prevState, {
|
|
14
|
+
id: _extends({}, prevState.id, {
|
|
15
|
+
chartId: params.id ?? createChartDefaultId()
|
|
16
|
+
})
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
}, [store, params.id]);
|
|
20
|
+
return {};
|
|
21
|
+
};
|
|
22
|
+
useChartId.params = {
|
|
23
|
+
id: true
|
|
24
|
+
};
|
|
25
|
+
useChartId.getInitialState = ({
|
|
26
|
+
id
|
|
27
|
+
}) => ({
|
|
28
|
+
id: {
|
|
29
|
+
chartId: createChartDefaultId(),
|
|
30
|
+
providedChartId: id
|
|
31
|
+
}
|
|
32
|
+
});
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createSelector } from "../../utils/selectors.js";
|
|
2
|
+
const selectorChartIdState = state => state.id;
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Get the id attribute of the chart.
|
|
6
|
+
* @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
|
|
7
|
+
* @returns {string} The id attribute of the chart.
|
|
8
|
+
*/
|
|
9
|
+
export const selectorChartId = createSelector(selectorChartIdState, idState => idState.chartId);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
3
|
+
export const useChartInteraction = ({
|
|
4
|
+
store
|
|
5
|
+
}) => {
|
|
6
|
+
const cleanInteraction = useEventCallback(() => {
|
|
7
|
+
store.update(prev => _extends({}, prev, {
|
|
8
|
+
interaction: _extends({}, prev.interaction, {
|
|
9
|
+
axis: {
|
|
10
|
+
x: null,
|
|
11
|
+
y: null
|
|
12
|
+
},
|
|
13
|
+
item: null
|
|
14
|
+
})
|
|
15
|
+
}));
|
|
16
|
+
});
|
|
17
|
+
const setItemInteraction = useEventCallback(newItem => {
|
|
18
|
+
store.update(prev => _extends({}, prev, {
|
|
19
|
+
interaction: _extends({}, prev.interaction, {
|
|
20
|
+
item: newItem
|
|
21
|
+
})
|
|
22
|
+
}));
|
|
23
|
+
});
|
|
24
|
+
const setAxisInteraction = useEventCallback(({
|
|
25
|
+
x: newStateX,
|
|
26
|
+
y: newStateY
|
|
27
|
+
}) => {
|
|
28
|
+
store.update(prev => _extends({}, prev, {
|
|
29
|
+
interaction: _extends({}, prev.interaction, {
|
|
30
|
+
axis: _extends({}, prev.interaction.axis, prev.interaction.axis.x?.index !== newStateX?.index || prev.interaction.axis.x?.value !== newStateX?.value ? {
|
|
31
|
+
x: newStateX
|
|
32
|
+
} : {}, prev.interaction.axis.y?.index !== newStateY?.index || prev.interaction.axis.y?.value !== newStateY?.value ? {
|
|
33
|
+
y: newStateY
|
|
34
|
+
} : {})
|
|
35
|
+
})
|
|
36
|
+
}));
|
|
37
|
+
});
|
|
38
|
+
const enableVoronoid = useEventCallback(() => {
|
|
39
|
+
store.update(prev => _extends({}, prev, {
|
|
40
|
+
interaction: _extends({}, prev.interaction, {
|
|
41
|
+
isVoronoiEnabled: true
|
|
42
|
+
})
|
|
43
|
+
}));
|
|
44
|
+
});
|
|
45
|
+
const disableVoronoid = useEventCallback(() => {
|
|
46
|
+
store.update(prev => _extends({}, prev, {
|
|
47
|
+
interaction: _extends({}, prev.interaction, {
|
|
48
|
+
isVoronoiEnabled: false
|
|
49
|
+
})
|
|
50
|
+
}));
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
params: {},
|
|
54
|
+
instance: {
|
|
55
|
+
cleanInteraction,
|
|
56
|
+
setItemInteraction,
|
|
57
|
+
setAxisInteraction,
|
|
58
|
+
enableVoronoid,
|
|
59
|
+
disableVoronoid
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
};
|
|
63
|
+
useChartInteraction.getInitialState = () => ({
|
|
64
|
+
interaction: {
|
|
65
|
+
item: null,
|
|
66
|
+
axis: {
|
|
67
|
+
x: null,
|
|
68
|
+
y: null
|
|
69
|
+
},
|
|
70
|
+
isVoronoiEnabled: false
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
useChartInteraction.params = {};
|
package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { createSelector } from "../../utils/selectors.js";
|
|
2
|
+
const selectInteraction = state => state.interaction;
|
|
3
|
+
export const selectorChartsInteractionItem = createSelector(selectInteraction, interaction => interaction.item);
|
|
4
|
+
export const selectorChartsInteractionAxis = createSelector(selectInteraction, interaction => interaction.axis);
|
|
5
|
+
export const selectorChartsInteractionXAxis = createSelector(selectInteraction, interaction => interaction.axis.x);
|
|
6
|
+
export const selectorChartsInteractionYAxis = createSelector(selectInteraction, interaction => interaction.axis.y);
|
|
7
|
+
export const selectorChartsInteractionItemIsDefined = createSelector(selectorChartsInteractionItem, item => item !== null);
|
|
8
|
+
export const selectorChartsInteractionXAxisIsDefined = createSelector(selectorChartsInteractionXAxis, x => x !== null);
|
|
9
|
+
export const selectorChartsInteractionYAxisIsDefined = createSelector(selectorChartsInteractionYAxis, y => y !== null);
|
|
10
|
+
export const selectorChartsInteractionIsVoronoiEnabled = createSelector(selectInteraction, interaction => interaction.isVoronoiEnabled);
|
package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartStore } from "../plugins/utils/ChartStore.js";
|
|
3
|
+
import { CHART_CORE_PLUGINS } from "../plugins/corePlugins/index.js";
|
|
4
|
+
export function useChartApiInitialization(inputApiRef) {
|
|
5
|
+
const fallbackPublicApiRef = React.useRef({});
|
|
6
|
+
if (inputApiRef) {
|
|
7
|
+
if (inputApiRef.current == null) {
|
|
8
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
9
|
+
inputApiRef.current = {};
|
|
10
|
+
}
|
|
11
|
+
return inputApiRef.current;
|
|
12
|
+
}
|
|
13
|
+
return fallbackPublicApiRef.current;
|
|
14
|
+
}
|
|
15
|
+
let globalId = 0;
|
|
16
|
+
export function useCharts(inPlugins, props) {
|
|
17
|
+
const plugins = React.useMemo(() => [...CHART_CORE_PLUGINS, ...inPlugins], [inPlugins]);
|
|
18
|
+
const pluginParams = {}; // To generate when plugins use params.
|
|
19
|
+
const instanceRef = React.useRef({});
|
|
20
|
+
const instance = instanceRef.current;
|
|
21
|
+
const publicAPI = useChartApiInitialization(props.apiRef);
|
|
22
|
+
const innerSvgRef = React.useRef(null);
|
|
23
|
+
const storeRef = React.useRef(null);
|
|
24
|
+
if (storeRef.current == null) {
|
|
25
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
26
|
+
globalId += 1;
|
|
27
|
+
const initialState = {
|
|
28
|
+
// TODO remove when the interaction moves to plugin
|
|
29
|
+
interaction: {
|
|
30
|
+
item: null,
|
|
31
|
+
axis: {
|
|
32
|
+
x: null,
|
|
33
|
+
y: null
|
|
34
|
+
}
|
|
35
|
+
},
|
|
36
|
+
cacheKey: {
|
|
37
|
+
id: globalId
|
|
38
|
+
}
|
|
39
|
+
};
|
|
40
|
+
plugins.forEach(plugin => {
|
|
41
|
+
if (plugin.getInitialState) {
|
|
42
|
+
Object.assign(initialState, plugin.getInitialState({}));
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
storeRef.current = new ChartStore(initialState);
|
|
46
|
+
}
|
|
47
|
+
const runPlugin = plugin => {
|
|
48
|
+
const pluginResponse = plugin({
|
|
49
|
+
instance,
|
|
50
|
+
params: pluginParams,
|
|
51
|
+
plugins: plugins,
|
|
52
|
+
store: storeRef.current,
|
|
53
|
+
svgRef: innerSvgRef
|
|
54
|
+
});
|
|
55
|
+
if (pluginResponse.publicAPI) {
|
|
56
|
+
Object.assign(publicAPI, pluginResponse.publicAPI);
|
|
57
|
+
}
|
|
58
|
+
if (pluginResponse.instance) {
|
|
59
|
+
Object.assign(instance, pluginResponse.instance);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
plugins.forEach(runPlugin);
|
|
63
|
+
const contextValue = React.useMemo(() => ({
|
|
64
|
+
store: storeRef.current,
|
|
65
|
+
publicAPI,
|
|
66
|
+
instance,
|
|
67
|
+
svgRef: innerSvgRef
|
|
68
|
+
}), [instance, publicAPI]);
|
|
69
|
+
return {
|
|
70
|
+
contextValue
|
|
71
|
+
};
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import
|
|
2
|
-
|
|
1
|
+
import { useChartContext } from "../../context/ChartProvider/index.js";
|
|
2
|
+
// This hook should be removed because user and us should not interact with the store directly, but with public/private APIs
|
|
3
3
|
export function useStore(skipError) {
|
|
4
|
-
const
|
|
4
|
+
const context = useChartContext();
|
|
5
5
|
if (skipError) {
|
|
6
6
|
// TODO: Remove once store is used by all charts.
|
|
7
7
|
// This line is only for `useAxisEvents` which is in the surface of the Gauge.
|
|
8
8
|
// But the Gauge don't have store yet because it does not need the interaction provider.
|
|
9
9
|
// Will be fixed when every thing move to the store since every component will have access to it.
|
|
10
10
|
// @ts-ignore
|
|
11
|
-
return
|
|
11
|
+
return context?.store;
|
|
12
12
|
}
|
|
13
|
-
if (!
|
|
13
|
+
if (!context) {
|
|
14
14
|
throw new Error(['MUI X: Could not find the charts context.', 'It looks like you rendered your component outside of a ChartsContainer parent component.'].join('\n'));
|
|
15
15
|
}
|
|
16
|
-
return
|
|
16
|
+
return context.store;
|
|
17
17
|
}
|
|
@@ -250,7 +250,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
250
250
|
hideTooltip: _propTypes.default.bool,
|
|
251
251
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
252
252
|
label: _propTypes.default.string,
|
|
253
|
-
labelFontSize: _propTypes.default.number,
|
|
254
253
|
labelStyle: _propTypes.default.object,
|
|
255
254
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
256
255
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
@@ -261,7 +260,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
261
260
|
slots: _propTypes.default.object,
|
|
262
261
|
stroke: _propTypes.default.string,
|
|
263
262
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
264
|
-
tickFontSize: _propTypes.default.number,
|
|
265
263
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
266
264
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
267
265
|
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
@@ -304,7 +302,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
304
302
|
hideTooltip: _propTypes.default.bool,
|
|
305
303
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
306
304
|
label: _propTypes.default.string,
|
|
307
|
-
labelFontSize: _propTypes.default.number,
|
|
308
305
|
labelStyle: _propTypes.default.object,
|
|
309
306
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
310
307
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
@@ -315,7 +312,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
315
312
|
slots: _propTypes.default.object,
|
|
316
313
|
stroke: _propTypes.default.string,
|
|
317
314
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
318
|
-
tickFontSize: _propTypes.default.number,
|
|
319
315
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
320
316
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
321
317
|
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|