@mui/x-charts 8.0.0-alpha.0 → 8.0.0-alpha.1
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/AnimatedBarElement.d.ts +15 -0
- package/BarChart/AnimatedBarElement.js +21 -0
- package/BarChart/BarChart.d.ts +4 -9
- package/BarChart/BarChart.js +3 -31
- package/BarChart/BarElement.d.ts +5 -1342
- package/BarChart/BarElement.js +10 -20
- package/BarChart/BarPlot.js +12 -2
- package/BarChart/useBarChartProps.d.ts +0 -2
- package/BarChart/useBarChartProps.js +2 -8
- package/CHANGELOG.md +429 -5
- package/ChartContainer/ChartContainer.d.ts +2 -19
- package/ChartContainer/ChartContainer.js +10 -20
- package/ChartContainer/ResizableContainer.d.ts +17 -4
- package/ChartContainer/ResizableContainer.js +36 -2
- package/ChartContainer/useChartContainerProps.d.ts +6 -7
- package/ChartContainer/useChartContainerProps.js +14 -28
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +6 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.d.ts +7 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/ChartsAxisHighlight/index.d.ts +3 -0
- package/ChartsAxisHighlight/index.js +4 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/ChartsLegend/LegendPerItem.d.ts +2 -2
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/ChartsSurface/ChartsSurface.d.ts +0 -15
- package/ChartsSurface/ChartsSurface.js +35 -34
- package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
- package/ChartsTooltip/ChartTooltip.types.js +1 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
- package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
- package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
- package/ChartsTooltip/ChartsTooltip.js +161 -145
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +298 -0
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
- package/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/ChartsTooltip/index.d.ts +3 -3
- package/ChartsTooltip/index.js +2 -3
- package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
- package/ChartsTooltip/useAxisTooltip.js +19 -19
- package/ChartsTooltip/useItemTooltip.d.ts +1 -1
- package/ChartsTooltip/useItemTooltip.js +5 -4
- package/ChartsTooltip/utils.d.ts +0 -3
- package/ChartsTooltip/utils.js +0 -8
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +47 -34
- package/Gauge/Gauge.d.ts +1 -1
- package/Gauge/Gauge.js +0 -6
- package/Gauge/GaugeContainer.d.ts +3 -3
- package/Gauge/GaugeContainer.js +60 -61
- package/LineChart/AnimatedArea.d.ts +0 -1333
- package/LineChart/AnimatedArea.js +9 -18
- package/LineChart/AnimatedLine.d.ts +0 -1333
- package/LineChart/AnimatedLine.js +9 -20
- package/LineChart/AreaPlot.js +12 -2
- package/LineChart/CircleMarkElement.js +6 -5
- package/LineChart/LineChart.d.ts +4 -10
- package/LineChart/LineChart.js +3 -32
- package/LineChart/LineHighlightPlot.js +6 -5
- package/LineChart/LinePlot.js +12 -2
- package/LineChart/MarkElement.js +6 -5
- package/LineChart/useLineChartProps.d.ts +0 -2
- package/LineChart/useLineChartProps.js +2 -8
- package/PieChart/PieChart.d.ts +3 -9
- package/PieChart/PieChart.js +5 -37
- package/PieChart/PiePlot.js +2 -2
- package/PieChart/getPieCoordinates.d.ts +2 -2
- package/README.md +2 -2
- package/ScatterChart/Scatter.js +6 -5
- package/ScatterChart/ScatterChart.d.ts +4 -10
- package/ScatterChart/ScatterChart.js +5 -32
- package/ScatterChart/useScatterChartProps.d.ts +0 -2
- package/ScatterChart/useScatterChartProps.js +1 -9
- package/SparkLineChart/SparkLineChart.d.ts +3 -4
- package/SparkLineChart/SparkLineChart.js +4 -31
- package/context/ChartDataProvider/ChartDataProvider.d.ts +9 -19
- package/context/ChartDataProvider/ChartDataProvider.js +30 -43
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +7 -10
- package/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
- package/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +8 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
- package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
- package/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/context/DrawingAreaProvider/index.d.ts +3 -0
- package/context/DrawingAreaProvider/index.js +3 -0
- package/context/InteractionProvider.d.ts +5 -48
- package/context/InteractionProvider.js +8 -64
- package/context/InteractionSelectors.d.ts +359 -0
- package/context/InteractionSelectors.js +12 -0
- package/context/SizeProvider/Size.types.d.ts +30 -0
- package/context/SizeProvider/Size.types.js +1 -0
- package/context/SizeProvider/SizeContext.d.ts +4 -0
- package/context/SizeProvider/SizeContext.js +13 -0
- package/context/SizeProvider/SizeProvider.d.ts +11 -0
- package/context/SizeProvider/SizeProvider.js +26 -0
- package/context/SizeProvider/index.d.ts +4 -0
- package/context/SizeProvider/index.js +4 -0
- package/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.d.ts +4 -1
- package/{modern/ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +11 -5
- package/context/SizeProvider/useSize.d.ts +5 -0
- package/context/SizeProvider/useSize.js +13 -0
- package/context/SvgRefProvider/SvgRef.types.d.ts +8 -0
- package/context/SvgRefProvider/SvgRef.types.js +1 -0
- package/context/SvgRefProvider/SvgRefContext.d.ts +4 -0
- package/context/SvgRefProvider/SvgRefContext.js +17 -0
- package/context/SvgRefProvider/SvgRefProvider.d.ts +3 -0
- package/context/SvgRefProvider/SvgRefProvider.js +24 -0
- package/context/SvgRefProvider/index.d.ts +4 -0
- package/context/SvgRefProvider/index.js +4 -0
- package/context/SvgRefProvider/useSurfaceRef.d.ts +2 -0
- package/context/SvgRefProvider/useSurfaceRef.js +14 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +2 -1
- package/hooks/useAxisEvents.js +32 -19
- package/hooks/useChartId.js +2 -2
- package/hooks/useDrawingArea.d.ts +2 -2
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +19 -12
- package/hooks/useSvgRef.js +3 -3
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/internals/computeAxisValue.d.ts +2 -2
- package/internals/index.d.ts +3 -2
- package/internals/index.js +3 -2
- package/internals/plugins/models/index.d.ts +35 -0
- package/internals/plugins/models/index.js +1 -0
- package/internals/plugins/utils/ChartStore.d.ts +12 -0
- package/internals/plugins/utils/ChartStore.js +26 -0
- package/internals/plugins/utils/ChartsStore.d.ts +12 -0
- package/internals/plugins/utils/ChartsStore.js +26 -0
- package/internals/plugins/utils/selectors.d.ts +9 -0
- package/internals/plugins/utils/selectors.js +37 -0
- package/internals/useCharts.d.ts +6 -0
- package/internals/useCharts.js +29 -0
- package/internals/useSelector.d.ts +4 -0
- package/internals/useSelector.js +6 -0
- package/internals/useStore.d.ts +2 -0
- package/internals/useStore.js +17 -0
- package/modern/BarChart/AnimatedBarElement.js +21 -0
- package/modern/BarChart/BarChart.js +3 -31
- package/modern/BarChart/BarElement.js +10 -20
- package/modern/BarChart/BarPlot.js +12 -2
- package/modern/BarChart/useBarChartProps.js +2 -8
- package/modern/ChartContainer/ChartContainer.js +10 -20
- package/modern/ChartContainer/ResizableContainer.js +36 -2
- package/modern/ChartContainer/useChartContainerProps.js +14 -28
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/modern/ChartsAxisHighlight/index.js +4 -1
- package/modern/ChartsGrid/ChartsGrid.js +1 -1
- package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/modern/ChartsSurface/ChartsSurface.js +35 -34
- package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/modern/ChartsTooltip/ChartsTooltip.js +161 -145
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +298 -0
- package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/modern/ChartsTooltip/index.js +2 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +19 -19
- package/modern/ChartsTooltip/useItemTooltip.js +5 -4
- package/modern/ChartsTooltip/utils.js +0 -8
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +47 -34
- package/modern/Gauge/Gauge.js +0 -6
- package/modern/Gauge/GaugeContainer.js +60 -61
- package/modern/LineChart/AnimatedArea.js +9 -18
- package/modern/LineChart/AnimatedLine.js +9 -20
- package/modern/LineChart/AreaPlot.js +12 -2
- package/modern/LineChart/CircleMarkElement.js +6 -5
- package/modern/LineChart/LineChart.js +3 -32
- package/modern/LineChart/LineHighlightPlot.js +6 -5
- package/modern/LineChart/LinePlot.js +12 -2
- package/modern/LineChart/MarkElement.js +6 -5
- package/modern/LineChart/useLineChartProps.js +2 -8
- package/modern/PieChart/PieChart.js +5 -37
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/Scatter.js +6 -5
- package/modern/ScatterChart/ScatterChart.js +5 -32
- package/modern/ScatterChart/useScatterChartProps.js +1 -9
- package/modern/SparkLineChart/SparkLineChart.js +4 -31
- package/modern/context/ChartDataProvider/ChartDataProvider.js +30 -43
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
- package/modern/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/modern/context/DrawingAreaProvider/index.js +3 -0
- package/modern/context/InteractionProvider.js +8 -64
- package/modern/context/InteractionSelectors.js +12 -0
- package/modern/context/SizeProvider/Size.types.js +1 -0
- package/modern/context/SizeProvider/SizeContext.js +13 -0
- package/modern/context/SizeProvider/SizeProvider.js +26 -0
- package/modern/context/SizeProvider/index.js +4 -0
- package/{ChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +11 -5
- package/modern/context/SizeProvider/useSize.js +13 -0
- package/modern/context/SvgRefProvider/SvgRef.types.js +1 -0
- package/modern/context/SvgRefProvider/SvgRefContext.js +17 -0
- package/modern/context/SvgRefProvider/SvgRefProvider.js +24 -0
- package/modern/context/SvgRefProvider/index.js +4 -0
- package/modern/context/SvgRefProvider/useSurfaceRef.js +14 -0
- package/modern/context/index.js +2 -1
- package/modern/hooks/useAxisEvents.js +32 -19
- package/modern/hooks/useChartId.js +2 -2
- package/modern/hooks/useDrawingArea.js +2 -2
- package/modern/hooks/useInteractionItemProps.js +19 -12
- package/modern/hooks/useSvgRef.js +3 -3
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/modern/internals/index.js +3 -2
- package/modern/internals/plugins/models/index.js +1 -0
- package/modern/internals/plugins/utils/ChartStore.js +26 -0
- package/modern/internals/plugins/utils/ChartsStore.js +26 -0
- package/modern/internals/plugins/utils/selectors.js +37 -0
- package/modern/internals/useCharts.js +29 -0
- package/modern/internals/useSelector.js +6 -0
- package/modern/internals/useStore.js +17 -0
- package/node/BarChart/AnimatedBarElement.js +28 -0
- package/node/BarChart/BarChart.js +3 -31
- package/node/BarChart/BarElement.js +11 -21
- package/node/BarChart/BarPlot.js +11 -1
- package/node/BarChart/useBarChartProps.js +2 -8
- package/node/ChartContainer/ChartContainer.js +10 -20
- package/node/ChartContainer/ResizableContainer.js +39 -3
- package/node/ChartContainer/useChartContainerProps.js +14 -28
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.types.js +5 -0
- package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
- package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
- package/node/ChartsAxisHighlight/index.js +33 -0
- package/node/ChartsGrid/ChartsGrid.js +2 -2
- package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
- package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/node/ChartsSurface/ChartsSurface.js +35 -34
- package/node/ChartsTooltip/ChartTooltip.types.js +5 -0
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
- package/node/ChartsTooltip/ChartsTooltip.js +160 -144
- package/node/ChartsTooltip/ChartsTooltipContainer.js +304 -0
- package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
- package/node/ChartsTooltip/index.js +19 -28
- package/node/ChartsTooltip/useAxisTooltip.js +19 -19
- package/node/ChartsTooltip/useItemTooltip.js +5 -4
- package/node/ChartsTooltip/utils.js +0 -9
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +48 -35
- package/node/Gauge/Gauge.js +0 -6
- package/node/Gauge/GaugeContainer.js +60 -61
- package/node/LineChart/AnimatedArea.js +9 -19
- package/node/LineChart/AnimatedLine.js +9 -21
- package/node/LineChart/AreaPlot.js +11 -1
- package/node/LineChart/CircleMarkElement.js +6 -5
- package/node/LineChart/LineChart.js +3 -32
- package/node/LineChart/LineHighlightPlot.js +6 -5
- package/node/LineChart/LinePlot.js +11 -1
- package/node/LineChart/MarkElement.js +6 -5
- package/node/LineChart/useLineChartProps.js +2 -8
- package/node/PieChart/PieChart.js +5 -37
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/Scatter.js +6 -5
- package/node/ScatterChart/ScatterChart.js +5 -32
- package/node/ScatterChart/useScatterChartProps.js +1 -9
- package/node/SparkLineChart/SparkLineChart.js +4 -31
- package/node/context/ChartDataProvider/ChartDataProvider.js +30 -43
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +22 -44
- package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +22 -0
- package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
- package/node/context/DrawingAreaProvider/index.js +38 -0
- package/node/context/InteractionProvider.js +9 -66
- package/node/context/InteractionSelectors.js +18 -0
- package/node/context/SizeProvider/Size.types.js +5 -0
- package/node/context/SizeProvider/SizeContext.js +20 -0
- package/node/context/SizeProvider/SizeProvider.js +29 -0
- package/node/context/SizeProvider/index.js +49 -0
- package/node/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +11 -5
- package/node/context/SizeProvider/useSize.js +20 -0
- package/node/context/SvgRefProvider/SvgRef.types.js +5 -0
- package/node/context/SvgRefProvider/SvgRefContext.js +23 -0
- package/node/context/SvgRefProvider/SvgRefProvider.js +31 -0
- package/node/context/SvgRefProvider/index.js +49 -0
- package/node/context/SvgRefProvider/useSurfaceRef.js +20 -0
- package/node/context/index.js +10 -2
- package/node/hooks/useAxisEvents.js +33 -19
- package/node/hooks/useChartId.js +2 -2
- package/node/hooks/useDrawingArea.js +2 -2
- package/node/hooks/useInteractionItemProps.js +20 -13
- package/node/hooks/useSvgRef.js +3 -3
- package/node/index.js +1 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/node/internals/index.js +28 -16
- package/node/internals/plugins/models/index.js +5 -0
- package/node/internals/plugins/utils/ChartStore.js +33 -0
- package/node/internals/plugins/utils/ChartsStore.js +33 -0
- package/node/internals/plugins/utils/selectors.js +44 -0
- package/node/internals/useCharts.js +36 -0
- package/node/internals/useSelector.js +13 -0
- package/node/internals/useStore.js +24 -0
- package/package.json +7 -5
- package/themeAugmentation/props.d.ts +1 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
- /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
- /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
|
@@ -50,15 +50,15 @@ const BarChart = exports.BarChart = /*#__PURE__*/React.forwardRef(function BarCh
|
|
|
50
50
|
chartsAxisProps,
|
|
51
51
|
axisHighlightProps,
|
|
52
52
|
legendProps,
|
|
53
|
-
tooltipProps,
|
|
54
53
|
children
|
|
55
54
|
} = (0, _useBarChartProps.useBarChartProps)(props);
|
|
55
|
+
const Tooltip = props.slots?.tooltip ?? _ChartsTooltip.ChartsTooltip;
|
|
56
56
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ChartContainer.ChartContainer, (0, _extends2.default)({
|
|
57
57
|
ref: ref
|
|
58
58
|
}, chartContainerProps, {
|
|
59
59
|
children: [props.onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, (0, _extends2.default)({}, axisClickHandlerProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsGrid.ChartsGrid, (0, _extends2.default)({}, gridProps)), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", (0, _extends2.default)({}, clipPathGroupProps, {
|
|
60
60
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_BarPlot.BarPlot, (0, _extends2.default)({}, barPlotProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, (0, _extends2.default)({}, overlayProps)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlightProps))]
|
|
61
|
-
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
61
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, (0, _extends2.default)({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legendProps)), !props.loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, props.slotProps?.tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, (0, _extends2.default)({}, clipPathProps)), children]
|
|
62
62
|
}));
|
|
63
63
|
});
|
|
64
64
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
@@ -70,7 +70,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
70
70
|
* The configuration of axes highlight.
|
|
71
71
|
* Default is set to 'band' in the bar direction.
|
|
72
72
|
* Depends on `layout` prop.
|
|
73
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
73
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
74
74
|
*/
|
|
75
75
|
axisHighlight: _propTypes.default.shape({
|
|
76
76
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
@@ -181,16 +181,6 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
181
181
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
182
182
|
*/
|
|
183
183
|
onItemClick: _propTypes.default.func,
|
|
184
|
-
/**
|
|
185
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
186
|
-
* before it renders for the first time.
|
|
187
|
-
*
|
|
188
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
189
|
-
* the first render, like when used inside a grid.
|
|
190
|
-
*
|
|
191
|
-
* @default false
|
|
192
|
-
*/
|
|
193
|
-
resolveSizeBeforeRender: _propTypes.default.bool,
|
|
194
184
|
/**
|
|
195
185
|
* Indicate which axis to display the right of the charts.
|
|
196
186
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -219,30 +209,12 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
219
209
|
slots: _propTypes.default.object,
|
|
220
210
|
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]),
|
|
221
211
|
title: _propTypes.default.string,
|
|
222
|
-
/**
|
|
223
|
-
* The configuration of the tooltip.
|
|
224
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
225
|
-
*/
|
|
226
|
-
tooltip: _propTypes.default.shape({
|
|
227
|
-
axisContent: _propTypes.default.elementType,
|
|
228
|
-
classes: _propTypes.default.object,
|
|
229
|
-
itemContent: _propTypes.default.elementType,
|
|
230
|
-
slotProps: _propTypes.default.object,
|
|
231
|
-
slots: _propTypes.default.object,
|
|
232
|
-
trigger: _propTypes.default.oneOf(['axis', 'item', 'none'])
|
|
233
|
-
}),
|
|
234
212
|
/**
|
|
235
213
|
* Indicate which axis to display the top of the charts.
|
|
236
214
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
237
215
|
* @default null
|
|
238
216
|
*/
|
|
239
217
|
topAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
240
|
-
viewBox: _propTypes.default.shape({
|
|
241
|
-
height: _propTypes.default.number,
|
|
242
|
-
width: _propTypes.default.number,
|
|
243
|
-
x: _propTypes.default.number,
|
|
244
|
-
y: _propTypes.default.number
|
|
245
|
-
}),
|
|
246
218
|
/**
|
|
247
219
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
248
220
|
*/
|
|
@@ -7,7 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.BarElement = BarElement;
|
|
10
|
-
exports.barElementClasses =
|
|
10
|
+
exports.barElementClasses = void 0;
|
|
11
11
|
exports.getBarElementUtilityClass = getBarElementUtilityClass;
|
|
12
12
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
13
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
@@ -16,40 +16,28 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
16
16
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
17
17
|
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
18
18
|
var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateUtilityClass"));
|
|
19
|
-
var _styles = require("@mui/material/styles");
|
|
20
19
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
21
|
-
var _d3Color = require("@mui/x-charts-vendor/d3-color");
|
|
22
|
-
var _web = require("@react-spring/web");
|
|
23
20
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
24
21
|
var _context = require("../context");
|
|
22
|
+
var _AnimatedBarElement = require("./AnimatedBarElement");
|
|
25
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
24
|
const _excluded = ["id", "dataIndex", "classes", "color", "slots", "slotProps", "style", "onClick"];
|
|
27
25
|
function getBarElementUtilityClass(slot) {
|
|
28
26
|
return (0, _generateUtilityClass.default)('MuiBarElement', slot);
|
|
29
27
|
}
|
|
30
|
-
const barElementClasses = exports.barElementClasses = (0, _generateUtilityClasses.default)('MuiBarElement', ['root']);
|
|
28
|
+
const barElementClasses = exports.barElementClasses = (0, _generateUtilityClasses.default)('MuiBarElement', ['root', 'highlighted', 'faded']);
|
|
31
29
|
const useUtilityClasses = ownerState => {
|
|
32
30
|
const {
|
|
33
31
|
classes,
|
|
34
|
-
id
|
|
32
|
+
id,
|
|
33
|
+
isHighlighted,
|
|
34
|
+
isFaded
|
|
35
35
|
} = ownerState;
|
|
36
36
|
const slots = {
|
|
37
|
-
root: ['root', `series-${id}
|
|
37
|
+
root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
|
|
38
38
|
};
|
|
39
39
|
return (0, _composeClasses.default)(slots, getBarElementUtilityClass, classes);
|
|
40
40
|
};
|
|
41
|
-
const BarElementPath = exports.BarElementPath = (0, _styles.styled)(_web.animated.rect, {
|
|
42
|
-
name: 'MuiBarElement',
|
|
43
|
-
slot: 'Root',
|
|
44
|
-
overridesResolver: (_, styles) => styles.root
|
|
45
|
-
})(({
|
|
46
|
-
ownerState
|
|
47
|
-
}) => ({
|
|
48
|
-
stroke: 'none',
|
|
49
|
-
fill: ownerState.isHighlighted ? (0, _d3Color.color)(ownerState.color).brighter(0.5).formatHex() : ownerState.color,
|
|
50
|
-
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
|
|
51
|
-
opacity: ownerState.isFaded && 0.3 || 1
|
|
52
|
-
}));
|
|
53
41
|
function BarElement(props) {
|
|
54
42
|
const {
|
|
55
43
|
id,
|
|
@@ -79,7 +67,7 @@ function BarElement(props) {
|
|
|
79
67
|
isHighlighted
|
|
80
68
|
};
|
|
81
69
|
const classes = useUtilityClasses(ownerState);
|
|
82
|
-
const Bar = slots?.bar ??
|
|
70
|
+
const Bar = slots?.bar ?? _AnimatedBarElement.AnimatedBarElement;
|
|
83
71
|
const barProps = (0, _useSlotProps.default)({
|
|
84
72
|
elementType: Bar,
|
|
85
73
|
externalSlotProps: slotProps?.bar,
|
|
@@ -91,7 +79,9 @@ function BarElement(props) {
|
|
|
91
79
|
}), {
|
|
92
80
|
style,
|
|
93
81
|
onClick,
|
|
94
|
-
cursor: onClick ? 'pointer' : 'unset'
|
|
82
|
+
cursor: onClick ? 'pointer' : 'unset',
|
|
83
|
+
stroke: 'none',
|
|
84
|
+
fill: color
|
|
95
85
|
}),
|
|
96
86
|
className: classes.root,
|
|
97
87
|
ownerState
|
package/node/BarChart/BarPlot.js
CHANGED
|
@@ -12,6 +12,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _web = require("@react-spring/web");
|
|
15
|
+
var _styles = require("@mui/material/styles");
|
|
15
16
|
var _CartesianProvider = require("../context/CartesianProvider");
|
|
16
17
|
var _BarElement = require("./BarElement");
|
|
17
18
|
var _getColor = _interopRequireDefault(require("./getColor"));
|
|
@@ -185,6 +186,15 @@ const enterStyle = ({
|
|
|
185
186
|
height,
|
|
186
187
|
width
|
|
187
188
|
});
|
|
189
|
+
const BarPlotRoot = (0, _styles.styled)('g', {
|
|
190
|
+
name: 'MuiBarPlot',
|
|
191
|
+
slot: 'Root',
|
|
192
|
+
overridesResolver: (_, styles) => styles.root
|
|
193
|
+
})({
|
|
194
|
+
[`& .${_BarElement.barElementClasses.root}`]: {
|
|
195
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
196
|
+
}
|
|
197
|
+
});
|
|
188
198
|
|
|
189
199
|
/**
|
|
190
200
|
* Demos:
|
|
@@ -227,7 +237,7 @@ function BarPlot(props) {
|
|
|
227
237
|
update: enterStyle,
|
|
228
238
|
immediate: skipAnimation
|
|
229
239
|
});
|
|
230
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(
|
|
240
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(BarPlotRoot, {
|
|
231
241
|
children: [!withoutBorderRadius && maskTransition((style, {
|
|
232
242
|
id,
|
|
233
243
|
hasPositive,
|
|
@@ -10,7 +10,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
10
10
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
11
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
12
12
|
var _constants = require("../constants");
|
|
13
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "
|
|
13
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAxisClick", "axisHighlight", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend"];
|
|
14
14
|
/**
|
|
15
15
|
* A helper function that extracts BarChartProps from the input props
|
|
16
16
|
* and returns an object with props for the children components of BarChart.
|
|
@@ -29,7 +29,6 @@ const useBarChartProps = props => {
|
|
|
29
29
|
colors,
|
|
30
30
|
dataset,
|
|
31
31
|
sx,
|
|
32
|
-
tooltip,
|
|
33
32
|
onAxisClick,
|
|
34
33
|
axisHighlight,
|
|
35
34
|
grid,
|
|
@@ -80,7 +79,7 @@ const useBarChartProps = props => {
|
|
|
80
79
|
sx,
|
|
81
80
|
highlightedItem,
|
|
82
81
|
onHighlightChange,
|
|
83
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
82
|
+
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
84
83
|
className,
|
|
85
84
|
skipAnimation
|
|
86
85
|
});
|
|
@@ -126,10 +125,6 @@ const useBarChartProps = props => {
|
|
|
126
125
|
slots,
|
|
127
126
|
slotProps
|
|
128
127
|
};
|
|
129
|
-
const tooltipProps = (0, _extends2.default)({}, tooltip, {
|
|
130
|
-
slots,
|
|
131
|
-
slotProps
|
|
132
|
-
});
|
|
133
128
|
return {
|
|
134
129
|
chartContainerProps,
|
|
135
130
|
barPlotProps,
|
|
@@ -141,7 +136,6 @@ const useBarChartProps = props => {
|
|
|
141
136
|
chartsAxisProps,
|
|
142
137
|
axisHighlightProps,
|
|
143
138
|
legendProps,
|
|
144
|
-
tooltipProps,
|
|
145
139
|
children
|
|
146
140
|
};
|
|
147
141
|
};
|
|
@@ -13,15 +13,21 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _ChartDataProvider = require("../context/ChartDataProvider");
|
|
14
14
|
var _ResizableContainer = require("./ResizableContainer");
|
|
15
15
|
var _useChartContainerProps = require("./useChartContainerProps");
|
|
16
|
+
var _ChartsSurface = require("../ChartsSurface");
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
18
|
const ChartContainer = exports.ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
18
19
|
const {
|
|
19
|
-
hasIntrinsicSize,
|
|
20
20
|
chartDataProviderProps,
|
|
21
|
-
|
|
21
|
+
children,
|
|
22
|
+
resizableContainerProps,
|
|
23
|
+
chartsSurfaceProps
|
|
22
24
|
} = (0, _useChartContainerProps.useChartContainerProps)(props, ref);
|
|
23
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
24
|
-
children:
|
|
25
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartDataProvider.ChartDataProvider, (0, _extends2.default)({}, chartDataProviderProps, {
|
|
26
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResizableContainer.ResizableContainer, (0, _extends2.default)({}, resizableContainerProps, {
|
|
27
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsSurface.ChartsSurface, (0, _extends2.default)({}, chartsSurfaceProps, {
|
|
28
|
+
children: children
|
|
29
|
+
}))
|
|
30
|
+
}))
|
|
25
31
|
}));
|
|
26
32
|
});
|
|
27
33
|
process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
@@ -81,16 +87,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
81
87
|
* If not provided, the container supports line, bar, scatter and pie charts.
|
|
82
88
|
*/
|
|
83
89
|
plugins: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
84
|
-
/**
|
|
85
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
86
|
-
* before it renders for the first time.
|
|
87
|
-
*
|
|
88
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
89
|
-
* the first render, like when used inside a grid.
|
|
90
|
-
*
|
|
91
|
-
* @default false
|
|
92
|
-
*/
|
|
93
|
-
resolveSizeBeforeRender: _propTypes.default.bool,
|
|
94
90
|
/**
|
|
95
91
|
* The array of series to display.
|
|
96
92
|
* Each type of series has its own specificity.
|
|
@@ -104,12 +100,6 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
104
100
|
skipAnimation: _propTypes.default.bool,
|
|
105
101
|
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]),
|
|
106
102
|
title: _propTypes.default.string,
|
|
107
|
-
viewBox: _propTypes.default.shape({
|
|
108
|
-
height: _propTypes.default.number,
|
|
109
|
-
width: _propTypes.default.number,
|
|
110
|
-
x: _propTypes.default.number,
|
|
111
|
-
y: _propTypes.default.number
|
|
112
|
-
}),
|
|
113
103
|
/**
|
|
114
104
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
115
105
|
*/
|
|
@@ -1,16 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
3
5
|
Object.defineProperty(exports, "__esModule", {
|
|
4
6
|
value: true
|
|
5
7
|
});
|
|
6
|
-
exports.ResizableContainer =
|
|
8
|
+
exports.ResizableContainer = ResizableContainer;
|
|
9
|
+
exports.ResizableContainerRoot = void 0;
|
|
10
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var React = _interopRequireWildcard(require("react"));
|
|
12
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
7
13
|
var _styles = require("@mui/material/styles");
|
|
14
|
+
var _SizeProvider = require("../context/SizeProvider");
|
|
15
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
8
16
|
/**
|
|
9
17
|
* Wrapping div that take the shape of its parent.
|
|
10
18
|
*
|
|
11
19
|
* @ignore - do not document.
|
|
12
20
|
*/
|
|
13
|
-
const
|
|
21
|
+
const ResizableContainerRoot = exports.ResizableContainerRoot = (0, _styles.styled)('div', {
|
|
14
22
|
name: 'MuiResponsiveChart',
|
|
15
23
|
slot: 'Container'
|
|
16
24
|
})(({
|
|
@@ -29,4 +37,32 @@ const ResizableContainer = exports.ResizableContainer = (0, _styles.styled)('div
|
|
|
29
37
|
width: '100%',
|
|
30
38
|
height: '100%'
|
|
31
39
|
}
|
|
32
|
-
}));
|
|
40
|
+
}));
|
|
41
|
+
|
|
42
|
+
/**
|
|
43
|
+
* Wrapping div that take the shape of its parent.
|
|
44
|
+
*
|
|
45
|
+
* @ignore - do not document.
|
|
46
|
+
*/
|
|
47
|
+
function ResizableContainer(props) {
|
|
48
|
+
const {
|
|
49
|
+
inHeight,
|
|
50
|
+
inWidth,
|
|
51
|
+
containerRef
|
|
52
|
+
} = (0, _SizeProvider.useSize)();
|
|
53
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ResizableContainerRoot, (0, _extends2.default)({}, props, {
|
|
54
|
+
ownerState: {
|
|
55
|
+
width: inWidth,
|
|
56
|
+
height: inHeight
|
|
57
|
+
},
|
|
58
|
+
ref: containerRef,
|
|
59
|
+
children: props.children
|
|
60
|
+
}));
|
|
61
|
+
}
|
|
62
|
+
process.env.NODE_ENV !== "production" ? ResizableContainer.propTypes = {
|
|
63
|
+
// ----------------------------- Warning --------------------------------
|
|
64
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
65
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
66
|
+
// ----------------------------------------------------------------------
|
|
67
|
+
children: _propTypes.default.node
|
|
68
|
+
} : void 0;
|
|
@@ -6,15 +6,12 @@ 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"));
|
|
10
9
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
-
|
|
12
|
-
const _excluded = ["width", "height", "resolveSizeBeforeRender", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "viewBox", "xAxis", "yAxis", "zAxis", "skipAnimation"];
|
|
10
|
+
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "disableAxisListener", "highlightedItem", "onHighlightChange", "plugins", "sx", "title", "xAxis", "yAxis", "zAxis", "skipAnimation"];
|
|
13
11
|
const useChartContainerProps = (props, ref) => {
|
|
14
12
|
const {
|
|
15
13
|
width,
|
|
16
14
|
height,
|
|
17
|
-
resolveSizeBeforeRender,
|
|
18
15
|
margin,
|
|
19
16
|
children,
|
|
20
17
|
series,
|
|
@@ -27,51 +24,40 @@ const useChartContainerProps = (props, ref) => {
|
|
|
27
24
|
plugins,
|
|
28
25
|
sx,
|
|
29
26
|
title,
|
|
30
|
-
viewBox,
|
|
31
27
|
xAxis,
|
|
32
28
|
yAxis,
|
|
33
29
|
zAxis,
|
|
34
30
|
skipAnimation
|
|
35
31
|
} = props,
|
|
36
32
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
37
|
-
const
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
height
|
|
46
|
-
},
|
|
47
|
-
ref: containerRef
|
|
48
|
-
});
|
|
33
|
+
const resizableContainerProps = other;
|
|
34
|
+
const chartsSurfaceProps = {
|
|
35
|
+
title,
|
|
36
|
+
desc,
|
|
37
|
+
sx,
|
|
38
|
+
disableAxisListener,
|
|
39
|
+
ref
|
|
40
|
+
};
|
|
49
41
|
const chartDataProviderProps = {
|
|
50
42
|
margin,
|
|
51
|
-
children,
|
|
52
43
|
series,
|
|
53
44
|
colors,
|
|
54
45
|
dataset,
|
|
55
|
-
desc,
|
|
56
|
-
disableAxisListener,
|
|
57
46
|
highlightedItem,
|
|
58
47
|
onHighlightChange,
|
|
59
48
|
plugins,
|
|
60
|
-
sx,
|
|
61
|
-
title,
|
|
62
|
-
viewBox,
|
|
63
49
|
xAxis,
|
|
64
50
|
yAxis,
|
|
65
51
|
zAxis,
|
|
66
52
|
skipAnimation,
|
|
67
|
-
width
|
|
68
|
-
height
|
|
69
|
-
ref
|
|
53
|
+
width,
|
|
54
|
+
height
|
|
70
55
|
};
|
|
71
56
|
return {
|
|
72
|
-
hasIntrinsicSize: Boolean(dWidth && dHeight),
|
|
73
57
|
chartDataProviderProps,
|
|
74
|
-
|
|
58
|
+
resizableContainerProps,
|
|
59
|
+
chartsSurfaceProps,
|
|
60
|
+
children
|
|
75
61
|
};
|
|
76
62
|
};
|
|
77
63
|
exports.useChartContainerProps = useChartContainerProps;
|
|
@@ -1,66 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.ChartsAxisHighlight = ChartsAxisHighlight;
|
|
10
|
-
exports.chartsAxisHighlightClasses = exports.ChartsAxisHighlightPath = void 0;
|
|
11
|
-
exports.getAxisHighlightUtilityClass = getAxisHighlightUtilityClass;
|
|
12
|
-
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
13
10
|
var React = _interopRequireWildcard(require("react"));
|
|
14
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
15
12
|
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
16
|
-
var
|
|
17
|
-
var
|
|
18
|
-
var
|
|
19
|
-
var _InteractionProvider = require("../context/InteractionProvider");
|
|
20
|
-
var _CartesianProvider = require("../context/CartesianProvider");
|
|
21
|
-
var _useScale = require("../hooks/useScale");
|
|
22
|
-
var _isBandScale = require("../internals/isBandScale");
|
|
13
|
+
var _chartsAxisHighlightClasses = require("./chartsAxisHighlightClasses");
|
|
14
|
+
var _ChartsYAxisHighlight = _interopRequireDefault(require("./ChartsYAxisHighlight"));
|
|
15
|
+
var _ChartsXAxisHighlight = _interopRequireDefault(require("./ChartsXAxisHighlight"));
|
|
23
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
function getAxisHighlightUtilityClass(slot) {
|
|
25
|
-
return (0, _generateUtilityClass.default)('MuiChartsAxisHighlight', slot);
|
|
26
|
-
}
|
|
27
|
-
const chartsAxisHighlightClasses = exports.chartsAxisHighlightClasses = (0, _generateUtilityClasses.default)('MuiChartsAxisHighlight', ['root']);
|
|
28
17
|
const useUtilityClasses = () => {
|
|
29
18
|
const slots = {
|
|
30
19
|
root: ['root']
|
|
31
20
|
};
|
|
32
|
-
return (0, _composeClasses.default)(slots, getAxisHighlightUtilityClass);
|
|
21
|
+
return (0, _composeClasses.default)(slots, _chartsAxisHighlightClasses.getAxisHighlightUtilityClass);
|
|
33
22
|
};
|
|
34
|
-
|
|
35
|
-
name: 'MuiChartsAxisHighlight',
|
|
36
|
-
slot: 'Root',
|
|
37
|
-
overridesResolver: (_, styles) => styles.root
|
|
38
|
-
})(({
|
|
39
|
-
theme
|
|
40
|
-
}) => ({
|
|
41
|
-
pointerEvents: 'none',
|
|
42
|
-
variants: [{
|
|
43
|
-
props: {
|
|
44
|
-
axisHighlight: 'band'
|
|
45
|
-
},
|
|
46
|
-
style: (0, _extends2.default)({
|
|
47
|
-
fill: 'white',
|
|
48
|
-
fillOpacity: 0.1
|
|
49
|
-
}, theme.applyStyles('light', {
|
|
50
|
-
fill: 'gray'
|
|
51
|
-
}))
|
|
52
|
-
}, {
|
|
53
|
-
props: {
|
|
54
|
-
axisHighlight: 'line'
|
|
55
|
-
},
|
|
56
|
-
style: (0, _extends2.default)({
|
|
57
|
-
strokeDasharray: '5 2',
|
|
58
|
-
stroke: '#ffffff'
|
|
59
|
-
}, theme.applyStyles('light', {
|
|
60
|
-
stroke: '#000000'
|
|
61
|
-
}))
|
|
62
|
-
}]
|
|
63
|
-
}));
|
|
23
|
+
|
|
64
24
|
/**
|
|
65
25
|
* Demos:
|
|
66
26
|
*
|
|
@@ -75,62 +35,14 @@ function ChartsAxisHighlight(props) {
|
|
|
75
35
|
x: xAxisHighlight,
|
|
76
36
|
y: yAxisHighlight
|
|
77
37
|
} = props;
|
|
78
|
-
const {
|
|
79
|
-
xAxisIds,
|
|
80
|
-
xAxis,
|
|
81
|
-
yAxisIds,
|
|
82
|
-
yAxis
|
|
83
|
-
} = (0, _CartesianProvider.useCartesianContext)();
|
|
84
38
|
const classes = useUtilityClasses();
|
|
85
|
-
const USED_X_AXIS_ID = xAxisIds[0];
|
|
86
|
-
const USED_Y_AXIS_ID = yAxisIds[0];
|
|
87
|
-
const xScale = xAxis[USED_X_AXIS_ID].scale;
|
|
88
|
-
const yScale = yAxis[USED_Y_AXIS_ID].scale;
|
|
89
|
-
const {
|
|
90
|
-
axis
|
|
91
|
-
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
92
|
-
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
93
|
-
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
94
|
-
const axisX = axis.x;
|
|
95
|
-
const axisY = axis.y;
|
|
96
|
-
const isBandScaleX = xAxisHighlight === 'band' && axisX !== null && (0, _isBandScale.isBandScale)(xScale);
|
|
97
|
-
const isBandScaleY = yAxisHighlight === 'band' && axisY !== null && (0, _isBandScale.isBandScale)(yScale);
|
|
98
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
99
|
-
const isXError = isBandScaleX && xScale(axisX.value) === undefined;
|
|
100
|
-
const isYError = isBandScaleY && yScale(axisY.value) === undefined;
|
|
101
|
-
if (isXError || isYError) {
|
|
102
|
-
console.error([`MUI X: 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'));
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
106
|
-
children: [
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
axisHighlight: 'band'
|
|
113
|
-
}
|
|
114
|
-
}), isBandScaleY && yScale(axisY.value) !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsAxisHighlightPath, {
|
|
115
|
-
d: `M ${xScale.range()[0]} ${
|
|
116
|
-
// @ts-expect-error, yScale value is checked in the statement above
|
|
117
|
-
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`,
|
|
118
|
-
className: classes.root,
|
|
119
|
-
ownerState: {
|
|
120
|
-
axisHighlight: 'band'
|
|
121
|
-
}
|
|
122
|
-
}), xAxisHighlight === 'line' && axis.x !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsAxisHighlightPath, {
|
|
123
|
-
d: `M ${getXPosition(axis.x.value)} ${yScale.range()[0]} L ${getXPosition(axis.x.value)} ${yScale.range()[1]}`,
|
|
124
|
-
className: classes.root,
|
|
125
|
-
ownerState: {
|
|
126
|
-
axisHighlight: 'line'
|
|
127
|
-
}
|
|
128
|
-
}), yAxisHighlight === 'line' && axis.y !== null && /*#__PURE__*/(0, _jsxRuntime.jsx)(ChartsAxisHighlightPath, {
|
|
129
|
-
d: `M ${xScale.range()[0]} ${getYPosition(axis.y.value)} L ${xScale.range()[1]} ${getYPosition(axis.y.value)}`,
|
|
130
|
-
className: classes.root,
|
|
131
|
-
ownerState: {
|
|
132
|
-
axisHighlight: 'line'
|
|
133
|
-
}
|
|
40
|
+
children: [xAxisHighlight && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsXAxisHighlight.default, {
|
|
41
|
+
type: xAxisHighlight,
|
|
42
|
+
classes: classes
|
|
43
|
+
}), yAxisHighlight && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsYAxisHighlight.default, {
|
|
44
|
+
type: yAxisHighlight,
|
|
45
|
+
classes: classes
|
|
134
46
|
})]
|
|
135
47
|
});
|
|
136
48
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.ChartsAxisHighlightPath = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _styles = require("@mui/material/styles");
|
|
11
|
+
const ChartsAxisHighlightPath = exports.ChartsAxisHighlightPath = (0, _styles.styled)('path', {
|
|
12
|
+
name: 'MuiChartsAxisHighlight',
|
|
13
|
+
slot: 'Root',
|
|
14
|
+
overridesResolver: (_, styles) => styles.root
|
|
15
|
+
})(({
|
|
16
|
+
theme
|
|
17
|
+
}) => ({
|
|
18
|
+
pointerEvents: 'none',
|
|
19
|
+
variants: [{
|
|
20
|
+
props: {
|
|
21
|
+
axisHighlight: 'band'
|
|
22
|
+
},
|
|
23
|
+
style: (0, _extends2.default)({
|
|
24
|
+
fill: 'white',
|
|
25
|
+
fillOpacity: 0.1
|
|
26
|
+
}, theme.applyStyles('light', {
|
|
27
|
+
fill: 'gray'
|
|
28
|
+
}))
|
|
29
|
+
}, {
|
|
30
|
+
props: {
|
|
31
|
+
axisHighlight: 'line'
|
|
32
|
+
},
|
|
33
|
+
style: (0, _extends2.default)({
|
|
34
|
+
strokeDasharray: '5 2',
|
|
35
|
+
stroke: '#ffffff'
|
|
36
|
+
}, theme.applyStyles('light', {
|
|
37
|
+
stroke: '#000000'
|
|
38
|
+
}))
|
|
39
|
+
}]
|
|
40
|
+
}));
|