@mui/x-charts 8.0.0-alpha.1 → 8.0.0-alpha.2
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 +228 -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 +1 -1
- 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/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 +1 -1
- 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/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 +2 -2
- 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/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
|
@@ -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']),
|
|
@@ -11,22 +11,42 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var React = _interopRequireWildcard(require("react"));
|
|
12
12
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
13
13
|
var _ChartDataProvider = require("../context/ChartDataProvider");
|
|
14
|
-
var _ResizableContainer = require("./ResizableContainer");
|
|
15
14
|
var _useChartContainerProps = require("./useChartContainerProps");
|
|
16
15
|
var _ChartsSurface = require("../ChartsSurface");
|
|
17
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
+
/**
|
|
18
|
+
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
19
|
+
*
|
|
20
|
+
* This is a combination of both the `ChartDataProvider` and `ChartsSurface` components.
|
|
21
|
+
*
|
|
22
|
+
* Demos:
|
|
23
|
+
*
|
|
24
|
+
* - [Composition](http://localhost:3001/x/react-charts/composition/)
|
|
25
|
+
*
|
|
26
|
+
* API:
|
|
27
|
+
*
|
|
28
|
+
* - [ChartContainer API](https://mui.com/x/api/charts/chart-container/)
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* ```jsx
|
|
32
|
+
* <ChartContainer
|
|
33
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
34
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
35
|
+
* >
|
|
36
|
+
* <BarPlot />
|
|
37
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
38
|
+
* </ChartContainer>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
18
41
|
const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
19
42
|
const {
|
|
20
43
|
chartDataProviderProps,
|
|
21
44
|
children,
|
|
22
|
-
resizableContainerProps,
|
|
23
45
|
chartsSurfaceProps
|
|
24
46
|
} = (0, _useChartContainerProps.useChartContainerProps)(props, ref);
|
|
25
47
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
26
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
27
|
-
children:
|
|
28
|
-
children: children
|
|
29
|
-
}))
|
|
48
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
49
|
+
children: children
|
|
30
50
|
}))
|
|
31
51
|
}));
|
|
32
52
|
});
|
|
@@ -135,7 +155,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
135
155
|
hideTooltip: _propTypes.default.bool,
|
|
136
156
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
137
157
|
label: _propTypes.default.string,
|
|
138
|
-
labelFontSize: _propTypes.default.number,
|
|
139
158
|
labelStyle: _propTypes.default.object,
|
|
140
159
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
141
160
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
@@ -146,7 +165,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
146
165
|
slots: _propTypes.default.object,
|
|
147
166
|
stroke: _propTypes.default.string,
|
|
148
167
|
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]),
|
|
149
|
-
tickFontSize: _propTypes.default.number,
|
|
150
168
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
151
169
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
152
170
|
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
@@ -189,7 +207,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
189
207
|
hideTooltip: _propTypes.default.bool,
|
|
190
208
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
191
209
|
label: _propTypes.default.string,
|
|
192
|
-
labelFontSize: _propTypes.default.number,
|
|
193
210
|
labelStyle: _propTypes.default.object,
|
|
194
211
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
195
212
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
@@ -200,7 +217,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
200
217
|
slots: _propTypes.default.object,
|
|
201
218
|
stroke: _propTypes.default.string,
|
|
202
219
|
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]),
|
|
203
|
-
tickFontSize: _propTypes.default.number,
|
|
204
220
|
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
205
221
|
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
206
222
|
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.useChartContainerProps = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
11
|
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "xAxis", "yAxis", "zAxis", "skipAnimation"];
|
|
11
12
|
const useChartContainerProps = (props, ref) => {
|
|
@@ -30,14 +31,13 @@ const useChartContainerProps = (props, ref) => {
|
|
|
30
31
|
skipAnimation
|
|
31
32
|
} = props,
|
|
32
33
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
33
|
-
const
|
|
34
|
-
const chartsSurfaceProps = {
|
|
34
|
+
const chartsSurfaceProps = (0, _extends2.default)({
|
|
35
35
|
title,
|
|
36
36
|
desc,
|
|
37
37
|
sx,
|
|
38
38
|
disableAxisListener,
|
|
39
39
|
ref
|
|
40
|
-
};
|
|
40
|
+
}, other);
|
|
41
41
|
const chartDataProviderProps = {
|
|
42
42
|
margin,
|
|
43
43
|
series,
|
|
@@ -55,7 +55,6 @@ const useChartContainerProps = (props, ref) => {
|
|
|
55
55
|
};
|
|
56
56
|
return {
|
|
57
57
|
chartDataProviderProps,
|
|
58
|
-
resizableContainerProps,
|
|
59
58
|
chartsSurfaceProps,
|
|
60
59
|
children
|
|
61
60
|
};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.axisClasses = void 0;
|
|
7
8
|
exports.getAxisUtilityClass = getAxisUtilityClass;
|
|
8
|
-
var
|
|
9
|
+
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
10
|
+
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
9
11
|
function getAxisUtilityClass(slot) {
|
|
10
|
-
return (0,
|
|
12
|
+
return (0, _generateUtilityClass.default)('MuiChartsAxis', slot);
|
|
11
13
|
}
|
|
12
|
-
const axisClasses = exports.axisClasses = (0,
|
|
14
|
+
const axisClasses = exports.axisClasses = (0, _generateUtilityClasses.default)('MuiChartsAxis', ['root', 'line', 'tickContainer', 'tick', 'tickLabel', 'label', 'directionX', 'directionY', 'top', 'bottom', 'left', 'right']);
|
|
@@ -9,9 +9,9 @@ exports.default = ChartsXHighlight;
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useScale = require("../hooks/useScale");
|
|
11
11
|
var _isBandScale = require("../internals/isBandScale");
|
|
12
|
-
var _useSelector = require("../internals/useSelector");
|
|
13
|
-
var _useStore = require("../internals/useStore");
|
|
14
|
-
var
|
|
12
|
+
var _useSelector = require("../internals/store/useSelector");
|
|
13
|
+
var _useStore = require("../internals/store/useStore");
|
|
14
|
+
var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
|
|
15
15
|
var _hooks = require("../hooks");
|
|
16
16
|
var _ChartsAxisHighlightPath = require("./ChartsAxisHighlightPath");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -28,7 +28,7 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
28
28
|
} = (0, _hooks.useDrawingArea)();
|
|
29
29
|
const xScale = (0, _useScale.useXScale)();
|
|
30
30
|
const store = (0, _useStore.useStore)();
|
|
31
|
-
const axisX = (0, _useSelector.useSelector)(store,
|
|
31
|
+
const axisX = (0, _useSelector.useSelector)(store, _useChartInteraction.selectorChartsInteractionXAxis);
|
|
32
32
|
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
33
33
|
const isBandScaleX = type === 'band' && axisX !== null && (0, _isBandScale.isBandScale)(xScale);
|
|
34
34
|
if (process.env.NODE_ENV !== 'production') {
|