@mui/x-charts 8.22.1 → 8.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +39 -0
- package/BarChart/BarChart.plugins.d.ts +2 -1
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/BarElement.js +1 -1
- package/BarChart/BarLabel/BarLabel.d.ts +2 -0
- package/BarChart/BarLabel/BarLabel.js +8 -3
- package/BarChart/BarLabel/BarLabelItem.d.ts +2 -0
- package/BarChart/BarLabel/BarLabelItem.js +4 -2
- package/BarChart/BarPlot.d.ts +12 -2
- package/BarChart/BarPlot.js +29 -86
- package/BarChart/BatchBarPlot/BarGroup.d.ts +15 -0
- package/BarChart/BatchBarPlot/BarGroup.js +142 -0
- package/BarChart/BatchBarPlot/BatchBarPlot.d.ts +12 -0
- package/BarChart/BatchBarPlot/BatchBarPlot.js +140 -0
- package/BarChart/BatchBarPlot/index.d.ts +1 -0
- package/BarChart/BatchBarPlot/index.js +12 -0
- package/BarChart/BatchBarPlot/useCreateBarPaths.d.ts +8 -0
- package/BarChart/BatchBarPlot/useCreateBarPaths.js +53 -0
- package/BarChart/FocusedBar.js +6 -2
- package/BarChart/IndividualBarPlot.d.ts +21 -0
- package/BarChart/IndividualBarPlot.js +106 -0
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -1
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
- package/BarChart/seriesConfig/bar/keyboardFocusHandler.js +23 -0
- package/BarChart/seriesConfig/bar/legend.js +1 -0
- package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -2
- package/BarChart/seriesConfig/index.js +5 -1
- package/BarChart/types.d.ts +2 -0
- package/BarChart/useBarChartProps.d.ts +6 -2
- package/BarChart/useBarChartProps.js +4 -2
- package/BarChart/useBarPlotData.d.ts +1 -1
- package/BarChart/useBarPlotData.js +23 -4
- package/BarChart/useRegisterItemClickHandlers.d.ts +6 -0
- package/BarChart/useRegisterItemClickHandlers.js +72 -0
- package/CHANGELOG.md +211 -0
- package/ChartContainer/ChartContainer.js +34 -0
- package/ChartContainer/useChartContainerProps.js +6 -2
- package/ChartsLegend/ChartsLegend.js +2 -2
- package/ChartsLegend/legendContext.types.d.ts +12 -0
- package/ChartsLegend/onClickContextBuilder.js +2 -1
- package/ChartsOverlay/ChartsLoadingOverlay.js +4 -1
- package/ChartsOverlay/ChartsNoDataOverlay.js +4 -1
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsReferenceLine/common.js +4 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +25 -21
- package/Gauge/GaugeContainer.js +4 -1
- package/LineChart/AnimatedLine.js +7 -3
- package/LineChart/AppearingMask.js +4 -1
- package/LineChart/CircleMarkElement.d.ts +5 -0
- package/LineChart/CircleMarkElement.js +13 -5
- package/LineChart/FocusedLineMark.js +6 -2
- package/LineChart/LineChart.js +30 -0
- package/LineChart/LineChart.plugins.d.ts +2 -1
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/LineElement.d.ts +4 -0
- package/LineChart/LineElement.js +7 -3
- package/LineChart/MarkElement.d.ts +5 -0
- package/LineChart/MarkElement.js +17 -10
- package/LineChart/markElementClasses.d.ts +0 -1
- package/LineChart/seriesConfig/index.js +5 -1
- package/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/LineChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/LineChart/seriesConfig/legend.js +1 -0
- package/LineChart/seriesConfig/seriesProcessor.js +2 -2
- package/PieChart/FocusedPieArc.js +6 -3
- package/PieChart/PieArcLabel.d.ts +2 -0
- package/PieChart/PieArcLabel.js +5 -2
- package/PieChart/PieChart.js +35 -5
- package/PieChart/PieChart.plugins.d.ts +2 -1
- package/PieChart/PieChart.plugins.js +2 -1
- package/PieChart/dataTransform/useTransformData.js +1 -1
- package/PieChart/seriesConfig/index.js +5 -1
- package/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/PieChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/PieChart/seriesConfig/legend.js +6 -3
- package/RadarChart/RadarChart.js +30 -0
- package/RadarChart/RadarChart.plugins.d.ts +3 -2
- package/RadarChart/RadarChart.plugins.js +2 -1
- package/RadarChart/seriesConfig/index.js +3 -1
- package/RadarChart/seriesConfig/legend.js +1 -0
- package/ScatterChart/BatchScatter.js +8 -14
- package/ScatterChart/FocusedScatterMark.js +1 -1
- package/ScatterChart/ScatterChart.js +30 -0
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/seriesConfig/index.js +5 -1
- package/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/ScatterChart/seriesConfig/keyboardFocusHandler.js +23 -0
- package/ScatterChart/seriesConfig/legend.js +1 -0
- package/SparkLineChart/SparkLineChart.js +46 -0
- package/esm/BarChart/BarChart.js +39 -0
- package/esm/BarChart/BarChart.plugins.d.ts +2 -1
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/BarElement.js +1 -1
- package/esm/BarChart/BarLabel/BarLabel.d.ts +2 -0
- package/esm/BarChart/BarLabel/BarLabel.js +8 -3
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +2 -0
- package/esm/BarChart/BarLabel/BarLabelItem.js +4 -2
- package/esm/BarChart/BarPlot.d.ts +12 -2
- package/esm/BarChart/BarPlot.js +29 -86
- package/esm/BarChart/BatchBarPlot/BarGroup.d.ts +15 -0
- package/esm/BarChart/BatchBarPlot/BarGroup.js +134 -0
- package/esm/BarChart/BatchBarPlot/BatchBarPlot.d.ts +12 -0
- package/esm/BarChart/BatchBarPlot/BatchBarPlot.js +133 -0
- package/esm/BarChart/BatchBarPlot/index.d.ts +1 -0
- package/esm/BarChart/BatchBarPlot/index.js +1 -0
- package/esm/BarChart/BatchBarPlot/useCreateBarPaths.d.ts +8 -0
- package/esm/BarChart/BatchBarPlot/useCreateBarPaths.js +46 -0
- package/esm/BarChart/FocusedBar.js +6 -2
- package/esm/BarChart/IndividualBarPlot.d.ts +21 -0
- package/esm/BarChart/IndividualBarPlot.js +98 -0
- package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +1 -1
- package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.d.ts +3 -0
- package/esm/BarChart/seriesConfig/bar/keyboardFocusHandler.js +17 -0
- package/esm/BarChart/seriesConfig/bar/legend.js +1 -0
- package/esm/BarChart/seriesConfig/bar/seriesProcessor.js +1 -1
- package/esm/BarChart/seriesConfig/index.js +5 -1
- package/esm/BarChart/types.d.ts +2 -0
- package/esm/BarChart/useBarChartProps.d.ts +6 -2
- package/esm/BarChart/useBarChartProps.js +4 -3
- package/esm/BarChart/useBarPlotData.d.ts +1 -1
- package/esm/BarChart/useBarPlotData.js +20 -1
- package/esm/BarChart/useRegisterItemClickHandlers.d.ts +6 -0
- package/esm/BarChart/useRegisterItemClickHandlers.js +67 -0
- package/esm/ChartContainer/ChartContainer.js +34 -0
- package/esm/ChartContainer/useChartContainerProps.js +6 -2
- package/esm/ChartsLegend/ChartsLegend.js +2 -2
- package/esm/ChartsLegend/legendContext.types.d.ts +12 -0
- package/esm/ChartsLegend/onClickContextBuilder.js +2 -1
- package/esm/ChartsOverlay/ChartsLoadingOverlay.js +4 -1
- package/esm/ChartsOverlay/ChartsNoDataOverlay.js +4 -1
- package/esm/ChartsReferenceLine/common.d.ts +1 -1
- package/esm/ChartsReferenceLine/common.js +4 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +26 -22
- package/esm/Gauge/GaugeContainer.js +4 -1
- package/esm/LineChart/AnimatedLine.js +7 -3
- package/esm/LineChart/AppearingMask.js +4 -1
- package/esm/LineChart/CircleMarkElement.d.ts +5 -0
- package/esm/LineChart/CircleMarkElement.js +13 -5
- package/esm/LineChart/FocusedLineMark.js +6 -2
- package/esm/LineChart/LineChart.js +30 -0
- package/esm/LineChart/LineChart.plugins.d.ts +2 -1
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/LineElement.d.ts +4 -0
- package/esm/LineChart/LineElement.js +7 -3
- package/esm/LineChart/MarkElement.d.ts +5 -0
- package/esm/LineChart/MarkElement.js +17 -10
- package/esm/LineChart/markElementClasses.d.ts +0 -1
- package/esm/LineChart/seriesConfig/index.js +5 -1
- package/esm/LineChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/LineChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/LineChart/seriesConfig/legend.js +1 -0
- package/esm/LineChart/seriesConfig/seriesProcessor.js +1 -1
- package/esm/PieChart/FocusedPieArc.js +5 -2
- package/esm/PieChart/PieArcLabel.d.ts +2 -0
- package/esm/PieChart/PieArcLabel.js +5 -2
- package/esm/PieChart/PieChart.js +35 -5
- package/esm/PieChart/PieChart.plugins.d.ts +2 -1
- package/esm/PieChart/PieChart.plugins.js +2 -1
- package/esm/PieChart/dataTransform/useTransformData.js +1 -1
- package/esm/PieChart/seriesConfig/index.js +5 -1
- package/esm/PieChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/PieChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/PieChart/seriesConfig/legend.js +6 -3
- package/esm/RadarChart/RadarChart.js +30 -0
- package/esm/RadarChart/RadarChart.plugins.d.ts +3 -2
- package/esm/RadarChart/RadarChart.plugins.js +2 -1
- package/esm/RadarChart/seriesConfig/index.js +3 -1
- package/esm/RadarChart/seriesConfig/legend.js +1 -0
- package/esm/ScatterChart/BatchScatter.js +5 -11
- package/esm/ScatterChart/FocusedScatterMark.js +1 -1
- package/esm/ScatterChart/ScatterChart.js +30 -0
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
- package/esm/ScatterChart/seriesConfig/index.js +5 -1
- package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.d.ts +3 -0
- package/esm/ScatterChart/seriesConfig/keyboardFocusHandler.js +17 -0
- package/esm/ScatterChart/seriesConfig/legend.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +46 -0
- package/esm/hooks/useFocusedItem.d.ts +1 -12
- package/esm/hooks/useFocusedItem.js +3 -10
- package/esm/hooks/useIsItemFocused.d.ts +4 -3
- package/esm/hooks/useIsItemFocused.js +1 -1
- package/esm/hooks/useIsItemFocusedGetter.d.ts +3 -2
- package/esm/hooks/useIsItemFocusedGetter.js +2 -1
- package/esm/index.js +1 -1
- package/esm/internals/appendAtKey.d.ts +8 -0
- package/esm/internals/appendAtKey.js +17 -0
- package/esm/internals/commonNextFocusItem.d.ts +14 -0
- package/esm/internals/commonNextFocusItem.js +88 -0
- package/esm/internals/getBarDimensions.d.ts +1 -2
- package/esm/internals/identifierSerializer.d.ts +9 -0
- package/esm/internals/identifierSerializer.js +6 -0
- package/esm/internals/index.d.ts +7 -3
- package/esm/internals/index.js +7 -3
- package/esm/internals/invertScale.d.ts +6 -2
- package/esm/internals/invertScale.js +9 -1
- package/esm/internals/plugins/allPlugins.d.ts +4 -3
- package/esm/internals/plugins/allPlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.d.ts +14 -0
- package/esm/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.js +18 -0
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +8 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +12 -1
- package/esm/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +11 -0
- package/esm/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +74 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +20 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +10 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +83 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +12 -105
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +9 -15
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +6 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +18 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.d.ts +7 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +9 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +18 -0
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -10
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/index.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.js +5 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js +78 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.d.ts +16 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.js +19 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.d.ts +90 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.d.ts +4 -0
- package/esm/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.js +11 -0
- package/esm/internals/plugins/models/seriesConfig/identifierSerializer.types.d.ts +2 -0
- package/esm/internals/plugins/models/seriesConfig/identifierSerializer.types.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/index.d.ts +2 -1
- package/esm/internals/plugins/models/seriesConfig/index.js +2 -1
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +9 -0
- package/esm/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/esm/internals/seriesHasData.d.ts +4 -0
- package/esm/internals/seriesHasData.js +8 -0
- package/esm/internals/stacking/index.d.ts +1 -0
- package/esm/internals/stacking/index.js +1 -0
- package/esm/internals/stacking/offset/index.d.ts +1 -0
- package/esm/internals/stacking/offset/index.js +1 -0
- package/esm/internals/stacking/offset/offsetDiverging.d.ts +8 -0
- package/esm/internals/stacking/offset/offsetDiverging.js +47 -0
- package/esm/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
- package/esm/internals/{stackSeries.js → stacking/stackSeries.js} +8 -6
- package/esm/models/axis.d.ts +5 -4
- package/esm/models/featureFlags.d.ts +1 -0
- package/esm/models/featureFlags.js +1 -0
- package/esm/models/index.d.ts +1 -0
- package/esm/models/index.js +1 -0
- package/esm/models/seriesType/index.d.ts +3 -1
- package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
- package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.js +1 -0
- package/hooks/useFocusedItem.d.ts +1 -12
- package/hooks/useFocusedItem.js +1 -10
- package/hooks/useIsItemFocused.d.ts +4 -3
- package/hooks/useIsItemFocused.js +1 -1
- package/hooks/useIsItemFocusedGetter.d.ts +3 -2
- package/hooks/useIsItemFocusedGetter.js +2 -1
- package/index.js +1 -1
- package/internals/appendAtKey.d.ts +8 -0
- package/internals/appendAtKey.js +23 -0
- package/internals/commonNextFocusItem.d.ts +14 -0
- package/internals/commonNextFocusItem.js +97 -0
- package/internals/getBarDimensions.d.ts +1 -2
- package/internals/identifierSerializer.d.ts +9 -0
- package/internals/identifierSerializer.js +16 -0
- package/internals/index.d.ts +7 -3
- package/internals/index.js +55 -11
- package/internals/invertScale.d.ts +6 -2
- package/internals/invertScale.js +10 -1
- package/internals/plugins/allPlugins.d.ts +4 -3
- package/internals/plugins/allPlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.d.ts +14 -0
- package/internals/plugins/corePlugins/useChartSeries/serializeIdentifier.js +25 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +8 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +12 -1
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.d.ts +11 -0
- package/internals/plugins/featurePlugins/shared/useRegisterPointerInteractions.js +81 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +20 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +10 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +89 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts +13 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +11 -104
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +5 -31
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +10 -16
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +6 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +12 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.d.ts +15 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +23 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.d.ts +7 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +15 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.d.ts +11 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js +23 -0
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -10
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.js +1 -1
- package/internals/plugins/featurePlugins/useChartVisibilityManager/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/index.js +39 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/isIdentifierVisible.js +12 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.js +85 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.d.ts +16 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.selectors.js +25 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.d.ts +90 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/useChartVisibilityManager.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.d.ts +4 -0
- package/internals/plugins/featurePlugins/useChartVisibilityManager/visibilityParamToMap.js +18 -0
- package/internals/plugins/models/seriesConfig/identifierSerializer.types.d.ts +2 -0
- package/internals/plugins/models/seriesConfig/identifierSerializer.types.js +5 -0
- package/internals/plugins/models/seriesConfig/index.d.ts +2 -1
- package/internals/plugins/models/seriesConfig/index.js +11 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +9 -0
- package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
- package/internals/seriesHasData.d.ts +4 -0
- package/internals/seriesHasData.js +14 -0
- package/internals/stacking/index.d.ts +1 -0
- package/internals/stacking/index.js +16 -0
- package/internals/stacking/offset/index.d.ts +1 -0
- package/internals/stacking/offset/index.js +16 -0
- package/internals/stacking/offset/offsetDiverging.d.ts +8 -0
- package/internals/stacking/offset/offsetDiverging.js +53 -0
- package/internals/{stackSeries.d.ts → stacking/stackSeries.d.ts} +8 -8
- package/internals/{stackSeries.js → stacking/stackSeries.js} +3 -1
- package/models/axis.d.ts +5 -4
- package/models/featureFlags.d.ts +1 -0
- package/models/featureFlags.js +5 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/seriesType/index.d.ts +3 -1
- package/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
- package/moduleAugmentation/barChartBatchRendererOnItemClick.js +5 -0
- package/package.json +14 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -92
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.d.ts +0 -3
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/isFocusableSeriesType.js +0 -10
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +0 -21
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +0 -99
package/BarChart/BarChart.js
CHANGED
|
@@ -141,6 +141,31 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
141
141
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
142
142
|
*/
|
|
143
143
|
height: _propTypes.default.number,
|
|
144
|
+
/**
|
|
145
|
+
* List of hidden series and/or items.
|
|
146
|
+
*
|
|
147
|
+
* Different chart types use different keys.
|
|
148
|
+
*
|
|
149
|
+
* @example
|
|
150
|
+
* ```ts
|
|
151
|
+
* [
|
|
152
|
+
* {
|
|
153
|
+
* type: 'pie',
|
|
154
|
+
* seriesId: 'series-1',
|
|
155
|
+
* dataIndex: 3,
|
|
156
|
+
* },
|
|
157
|
+
* {
|
|
158
|
+
* type: 'line',
|
|
159
|
+
* seriesId: 'series-2',
|
|
160
|
+
* }
|
|
161
|
+
* ]
|
|
162
|
+
* ```
|
|
163
|
+
*/
|
|
164
|
+
hiddenItems: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
165
|
+
dataIndex: _propTypes.default.number,
|
|
166
|
+
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
167
|
+
type: _propTypes.default.oneOf(['bar']).isRequired
|
|
168
|
+
})),
|
|
144
169
|
/**
|
|
145
170
|
* If `true`, the legend is not rendered.
|
|
146
171
|
*/
|
|
@@ -199,6 +224,11 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
199
224
|
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
200
225
|
*/
|
|
201
226
|
onAxisClick: _propTypes.default.func,
|
|
227
|
+
/**
|
|
228
|
+
* Callback fired when any hidden identifiers change.
|
|
229
|
+
* @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
|
|
230
|
+
*/
|
|
231
|
+
onHiddenItemsChange: _propTypes.default.func,
|
|
202
232
|
/**
|
|
203
233
|
* The callback fired when the highlighted item changes.
|
|
204
234
|
*
|
|
@@ -219,6 +249,15 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
219
249
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
220
250
|
*/
|
|
221
251
|
onItemClick: _propTypes.default.func,
|
|
252
|
+
/**
|
|
253
|
+
* The type of renderer to use for the bar plot.
|
|
254
|
+
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
255
|
+
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
256
|
+
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
257
|
+
*
|
|
258
|
+
* @default 'svg-single'
|
|
259
|
+
*/
|
|
260
|
+
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-single']),
|
|
222
261
|
/**
|
|
223
262
|
* The series to display in the bar chart.
|
|
224
263
|
* An array of [[BarSeries]] objects.
|
|
@@ -6,5 +6,6 @@ import { type UseChartHighlightSignature } from "../internals/plugins/featurePlu
|
|
|
6
6
|
import { type UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
7
7
|
import { type ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
8
8
|
import { type UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
9
|
-
|
|
9
|
+
import { type UseChartVisibilityManagerSignature } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
10
|
+
export type BarChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'bar'>, UseChartHighlightSignature, UseChartVisibilityManagerSignature<'bar'>, UseChartKeyboardNavigationSignature];
|
|
10
11
|
export declare const BAR_CHART_PLUGINS: ConvertSignaturesIntoPlugins<BarChartPluginSignatures>;
|
|
@@ -11,4 +11,5 @@ var _useChartInteraction = require("../internals/plugins/featurePlugins/useChart
|
|
|
11
11
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
12
12
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
13
13
|
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
14
|
-
|
|
14
|
+
var _useChartVisibilityManager = require("../internals/plugins/featurePlugins/useChartVisibilityManager");
|
|
15
|
+
const BAR_CHART_PLUGINS = exports.BAR_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartVisibilityManager.useChartVisibilityManager, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
package/BarChart/BarElement.js
CHANGED
|
@@ -50,7 +50,7 @@ function BarElement(props) {
|
|
|
50
50
|
isHighlighted
|
|
51
51
|
} = (0, _useItemHighlighted.useItemHighlighted)(itemIdentifier);
|
|
52
52
|
const isFocused = (0, _useIsItemFocused.useIsItemFocused)(React.useMemo(() => ({
|
|
53
|
-
|
|
53
|
+
type: 'bar',
|
|
54
54
|
seriesId: id,
|
|
55
55
|
dataIndex
|
|
56
56
|
}), [id, dataIndex]));
|
|
@@ -32,6 +32,8 @@ export type BarLabelProps = Omit<React.SVGProps<SVGTextElement>, 'ref' | 'id' |
|
|
|
32
32
|
* @default 'center'
|
|
33
33
|
*/
|
|
34
34
|
placement?: 'center' | 'outside';
|
|
35
|
+
/** If true, the bar label is hidden. */
|
|
36
|
+
hidden?: boolean;
|
|
35
37
|
};
|
|
36
38
|
declare function BarLabel(inProps: BarLabelProps): React.JSX.Element;
|
|
37
39
|
declare namespace BarLabel {
|
|
@@ -17,7 +17,7 @@ var _useAnimateBarLabel = require("../../hooks/animation/useAnimateBarLabel");
|
|
|
17
17
|
var _barLabelClasses = require("./barLabelClasses");
|
|
18
18
|
var _animation = require("../../internals/animation/animation");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["seriesId", "dataIndex", "color", "isFaded", "isHighlighted", "classes", "skipAnimation", "layout", "xOrigin", "yOrigin", "placement"];
|
|
20
|
+
const _excluded = ["seriesId", "dataIndex", "color", "isFaded", "isHighlighted", "classes", "skipAnimation", "layout", "xOrigin", "yOrigin", "placement", "hidden"];
|
|
21
21
|
const BarLabelComponent = exports.BarLabelComponent = (0, _styles.styled)('text', {
|
|
22
22
|
name: 'MuiBarLabel',
|
|
23
23
|
slot: 'Root',
|
|
@@ -42,7 +42,8 @@ function BarLabel(inProps) {
|
|
|
42
42
|
name: 'MuiBarLabel'
|
|
43
43
|
});
|
|
44
44
|
const {
|
|
45
|
-
isFaded
|
|
45
|
+
isFaded,
|
|
46
|
+
hidden
|
|
46
47
|
} = props,
|
|
47
48
|
otherProps = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
48
49
|
const animatedProps = (0, _useAnimateBarLabel.useAnimateBarLabel)(props);
|
|
@@ -52,7 +53,7 @@ function BarLabel(inProps) {
|
|
|
52
53
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(BarLabelComponent, (0, _extends2.default)({
|
|
53
54
|
textAnchor: textAnchor,
|
|
54
55
|
dominantBaseline: dominantBaseline,
|
|
55
|
-
opacity: fadedOpacity
|
|
56
|
+
opacity: hidden ? 0 : fadedOpacity
|
|
56
57
|
}, otherProps, animatedProps));
|
|
57
58
|
}
|
|
58
59
|
function getTextAnchor({
|
|
@@ -94,6 +95,10 @@ process.env.NODE_ENV !== "production" ? BarLabel.propTypes = {
|
|
|
94
95
|
* Height of the bar this label belongs to.
|
|
95
96
|
*/
|
|
96
97
|
height: _propTypes.default.number.isRequired,
|
|
98
|
+
/**
|
|
99
|
+
* If true, the bar label is hidden.
|
|
100
|
+
*/
|
|
101
|
+
hidden: _propTypes.default.bool,
|
|
97
102
|
isFaded: _propTypes.default.bool.isRequired,
|
|
98
103
|
isHighlighted: _propTypes.default.bool.isRequired,
|
|
99
104
|
layout: _propTypes.default.oneOf(['horizontal', 'vertical']).isRequired,
|
|
@@ -74,6 +74,8 @@ export type BarLabelItemProps<V extends BarValueType | null> = Omit<BarLabelOwne
|
|
|
74
74
|
* @default 'center'
|
|
75
75
|
*/
|
|
76
76
|
barLabelPlacement?: BarLabelProps['placement'];
|
|
77
|
+
/** If true, the bar label is hidden. */
|
|
78
|
+
hidden?: boolean;
|
|
77
79
|
};
|
|
78
80
|
/**
|
|
79
81
|
* @ignore - internal component.
|
|
@@ -16,7 +16,7 @@ var _getBarLabel = require("./getBarLabel");
|
|
|
16
16
|
var _BarLabel = require("./BarLabel");
|
|
17
17
|
var _useItemHighlighted = require("../../hooks/useItemHighlighted");
|
|
18
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["seriesId", "classes", "color", "dataIndex", "barLabel", "slots", "slotProps", "xOrigin", "yOrigin", "x", "y", "width", "height", "value", "skipAnimation", "layout", "barLabelPlacement"],
|
|
19
|
+
const _excluded = ["seriesId", "classes", "color", "dataIndex", "barLabel", "slots", "slotProps", "xOrigin", "yOrigin", "x", "y", "width", "height", "value", "skipAnimation", "layout", "barLabelPlacement", "hidden"],
|
|
20
20
|
_excluded2 = ["ownerState"];
|
|
21
21
|
/**
|
|
22
22
|
* @ignore - internal component.
|
|
@@ -39,7 +39,8 @@ function BarLabelItem(props) {
|
|
|
39
39
|
value,
|
|
40
40
|
skipAnimation,
|
|
41
41
|
layout,
|
|
42
|
-
barLabelPlacement
|
|
42
|
+
barLabelPlacement,
|
|
43
|
+
hidden
|
|
43
44
|
} = props,
|
|
44
45
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
45
46
|
const {
|
|
@@ -95,6 +96,7 @@ function BarLabelItem(props) {
|
|
|
95
96
|
return null;
|
|
96
97
|
}
|
|
97
98
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Component, (0, _extends2.default)({}, barLabelProps, barLabelOwnerState, {
|
|
99
|
+
hidden: hidden,
|
|
98
100
|
children: formattedLabelText
|
|
99
101
|
}));
|
|
100
102
|
}
|
package/BarChart/BarPlot.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { type BarElementSlotProps, type BarElementSlots } from "./BarElement.js"
|
|
|
3
3
|
import { type BarItemIdentifier } from "../models/index.js";
|
|
4
4
|
import { type BarLabelSlotProps, type BarLabelSlots } from "./BarLabel/BarLabelItem.js";
|
|
5
5
|
import type { BarItem, BarLabelContext } from "./BarLabel/index.js";
|
|
6
|
+
import { type RendererType } from "../ScatterChart/index.js";
|
|
6
7
|
export interface BarPlotSlots extends BarElementSlots, BarLabelSlots {}
|
|
7
8
|
export interface BarPlotSlotProps extends BarElementSlotProps, BarLabelSlotProps {}
|
|
8
9
|
export interface BarPlotProps {
|
|
@@ -16,7 +17,7 @@ export interface BarPlotProps {
|
|
|
16
17
|
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
17
18
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
18
19
|
*/
|
|
19
|
-
onItemClick
|
|
20
|
+
onItemClick?(event: React.MouseEvent<SVGElement, MouseEvent>, barItemIdentifier: BarItemIdentifier): void;
|
|
20
21
|
/**
|
|
21
22
|
* Defines the border radius of the bar element.
|
|
22
23
|
*/
|
|
@@ -30,6 +31,15 @@ export interface BarPlotProps {
|
|
|
30
31
|
* @returns {string} The formatted label.
|
|
31
32
|
*/
|
|
32
33
|
barLabel?: 'value' | ((item: BarItem, context: BarLabelContext) => string | null | undefined);
|
|
34
|
+
/**
|
|
35
|
+
* The type of renderer to use for the bar plot.
|
|
36
|
+
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
37
|
+
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
38
|
+
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
39
|
+
*
|
|
40
|
+
* @default 'svg-single'
|
|
41
|
+
*/
|
|
42
|
+
renderer?: RendererType;
|
|
33
43
|
/**
|
|
34
44
|
* The props used for each component slot.
|
|
35
45
|
* @default {}
|
|
@@ -52,7 +62,7 @@ export interface BarPlotProps {
|
|
|
52
62
|
*
|
|
53
63
|
* - [BarPlot API](https://mui.com/x/api/charts/bar-plot/)
|
|
54
64
|
*/
|
|
55
|
-
declare function BarPlot(props: BarPlotProps):
|
|
65
|
+
declare function BarPlot(props: BarPlotProps): React.JSX.Element;
|
|
56
66
|
declare namespace BarPlot {
|
|
57
67
|
var propTypes: any;
|
|
58
68
|
}
|
package/BarChart/BarPlot.js
CHANGED
|
@@ -13,17 +13,17 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
15
|
var _barElementClasses = require("./barElementClasses");
|
|
16
|
-
var _BarElement = require("./BarElement");
|
|
17
16
|
var _hooks = require("../hooks");
|
|
18
|
-
var _BarClipPath = require("./BarClipPath");
|
|
19
17
|
var _BarLabelPlot = require("./BarLabel/BarLabelPlot");
|
|
20
18
|
var _useSkipAnimation = require("../hooks/useSkipAnimation");
|
|
21
19
|
var _useInternalIsZoomInteracting = require("../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting");
|
|
22
20
|
var _useBarPlotData = require("./useBarPlotData");
|
|
23
21
|
var _barClasses = require("./barClasses");
|
|
24
22
|
var _animation = require("../internals/animation/animation");
|
|
23
|
+
var _IndividualBarPlot = require("./IndividualBarPlot");
|
|
24
|
+
var _BatchBarPlot = require("./BatchBarPlot");
|
|
25
25
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel"];
|
|
26
|
+
const _excluded = ["skipAnimation", "onItemClick", "borderRadius", "barLabel", "renderer"];
|
|
27
27
|
const BarPlotRoot = (0, _styles.styled)('g', {
|
|
28
28
|
name: 'MuiBarPlot',
|
|
29
29
|
slot: 'Root'
|
|
@@ -51,11 +51,13 @@ function BarPlot(props) {
|
|
|
51
51
|
skipAnimation: inSkipAnimation,
|
|
52
52
|
onItemClick,
|
|
53
53
|
borderRadius,
|
|
54
|
-
barLabel
|
|
54
|
+
barLabel,
|
|
55
|
+
renderer
|
|
55
56
|
} = props,
|
|
56
57
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
57
58
|
const isZoomInteracting = (0, _useInternalIsZoomInteracting.useInternalIsZoomInteracting)();
|
|
58
59
|
const skipAnimation = (0, _useSkipAnimation.useSkipAnimation)(isZoomInteracting || inSkipAnimation);
|
|
60
|
+
const batchSkipAnimation = (0, _useSkipAnimation.useSkipAnimation)(inSkipAnimation);
|
|
59
61
|
const {
|
|
60
62
|
xAxis: xAxes
|
|
61
63
|
} = (0, _hooks.useXAxes)();
|
|
@@ -66,86 +68,22 @@ function BarPlot(props) {
|
|
|
66
68
|
completedData,
|
|
67
69
|
masksData
|
|
68
70
|
} = (0, _useBarPlotData.useBarPlotData)((0, _hooks.useDrawingArea)(), xAxes, yAxes);
|
|
69
|
-
const withoutBorderRadius = !borderRadius || borderRadius <= 0;
|
|
70
71
|
const classes = (0, _barClasses.useUtilityClasses)();
|
|
72
|
+
const BarElementPlot = renderer === 'svg-batch' ? _BatchBarPlot.BatchBarPlot : _IndividualBarPlot.IndividualBarPlot;
|
|
71
73
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(BarPlotRoot, {
|
|
72
74
|
className: classes.root,
|
|
73
|
-
children: [
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
}) => {
|
|
85
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarClipPath.BarClipPath, {
|
|
86
|
-
maskId: id,
|
|
87
|
-
borderRadius: borderRadius,
|
|
88
|
-
hasNegative: hasNegative,
|
|
89
|
-
hasPositive: hasPositive,
|
|
90
|
-
layout: layout,
|
|
91
|
-
x: x,
|
|
92
|
-
y: y,
|
|
93
|
-
xOrigin: xOrigin,
|
|
94
|
-
yOrigin: yOrigin,
|
|
95
|
-
width: width,
|
|
96
|
-
height: height,
|
|
97
|
-
skipAnimation: skipAnimation ?? false
|
|
98
|
-
}, id);
|
|
99
|
-
}), completedData.map(({
|
|
100
|
-
seriesId,
|
|
101
|
-
layout,
|
|
102
|
-
xOrigin,
|
|
103
|
-
yOrigin,
|
|
104
|
-
data
|
|
105
|
-
}) => {
|
|
106
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
107
|
-
"data-series": seriesId,
|
|
108
|
-
className: classes.series,
|
|
109
|
-
children: data.map(({
|
|
110
|
-
dataIndex,
|
|
111
|
-
color,
|
|
112
|
-
maskId,
|
|
113
|
-
x,
|
|
114
|
-
y,
|
|
115
|
-
width,
|
|
116
|
-
height
|
|
117
|
-
}) => {
|
|
118
|
-
const barElement = /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarElement.BarElement, (0, _extends2.default)({
|
|
119
|
-
id: seriesId,
|
|
120
|
-
dataIndex: dataIndex,
|
|
121
|
-
color: color,
|
|
122
|
-
skipAnimation: skipAnimation ?? false,
|
|
123
|
-
layout: layout ?? 'vertical',
|
|
124
|
-
x: x,
|
|
125
|
-
xOrigin: xOrigin,
|
|
126
|
-
y: y,
|
|
127
|
-
yOrigin: yOrigin,
|
|
128
|
-
width: width,
|
|
129
|
-
height: height
|
|
130
|
-
}, other, {
|
|
131
|
-
onClick: onItemClick && (event => {
|
|
132
|
-
onItemClick(event, {
|
|
133
|
-
type: 'bar',
|
|
134
|
-
seriesId,
|
|
135
|
-
dataIndex
|
|
136
|
-
});
|
|
137
|
-
})
|
|
138
|
-
}), dataIndex);
|
|
139
|
-
if (withoutBorderRadius) {
|
|
140
|
-
return barElement;
|
|
141
|
-
}
|
|
142
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
143
|
-
clipPath: `url(#${maskId})`,
|
|
144
|
-
children: barElement
|
|
145
|
-
}, dataIndex);
|
|
146
|
-
})
|
|
147
|
-
}, seriesId);
|
|
148
|
-
}), completedData.map(processedSeries => /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarLabelPlot.BarLabelPlot, (0, _extends2.default)({
|
|
75
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(BarElementPlot, (0, _extends2.default)({
|
|
76
|
+
completedData: completedData,
|
|
77
|
+
masksData: masksData
|
|
78
|
+
/* The batch renderer doesn't animate bars after the initial mount. Providing skipAnimation was causing an issue
|
|
79
|
+
* where bars would animate again after a zoom interaction because skipAnimation would change from true to false. */,
|
|
80
|
+
skipAnimation: renderer === 'svg-batch' ? batchSkipAnimation : skipAnimation,
|
|
81
|
+
onItemClick:
|
|
82
|
+
/* `onItemClick` accepts a `MouseEvent` when the renderer is "svg-batch" and a `React.MouseEvent` otherwise,
|
|
83
|
+
* so we need this cast to prevent TypeScript from complaining. */
|
|
84
|
+
onItemClick,
|
|
85
|
+
borderRadius: borderRadius
|
|
86
|
+
}, other)), completedData.map(processedSeries => /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarLabelPlot.BarLabelPlot, (0, _extends2.default)({
|
|
149
87
|
className: classes.seriesLabels,
|
|
150
88
|
processedSeries: processedSeries,
|
|
151
89
|
skipAnimation: skipAnimation,
|
|
@@ -159,6 +97,7 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
|
|
|
159
97
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
160
98
|
// ----------------------------------------------------------------------
|
|
161
99
|
/**
|
|
100
|
+
* @deprecated Use `barLabel` in the chart series instead.
|
|
162
101
|
* If provided, the function will be used to format the label of the bar.
|
|
163
102
|
* It can be set to 'value' to display the current value.
|
|
164
103
|
* @param {BarItem} item The item to format.
|
|
@@ -166,11 +105,6 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
|
|
|
166
105
|
* @returns {string} The formatted label.
|
|
167
106
|
*/
|
|
168
107
|
barLabel: _propTypes.default.oneOfType([_propTypes.default.oneOf(['value']), _propTypes.default.func]),
|
|
169
|
-
/**
|
|
170
|
-
* The placement of the bar label.
|
|
171
|
-
* It controls whether the label is rendered inside or outside the bar.
|
|
172
|
-
*/
|
|
173
|
-
barLabelPlacement: _propTypes.default.oneOf(['outside', 'inside']),
|
|
174
108
|
/**
|
|
175
109
|
* Defines the border radius of the bar element.
|
|
176
110
|
*/
|
|
@@ -181,6 +115,15 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
|
|
|
181
115
|
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
182
116
|
*/
|
|
183
117
|
onItemClick: _propTypes.default.func,
|
|
118
|
+
/**
|
|
119
|
+
* The type of renderer to use for the bar plot.
|
|
120
|
+
* - `svg-single`: Renders every bar in a `<rect />` element.
|
|
121
|
+
* - `svg-batch`: Batch renders bars in `<path />` elements for better performance with large datasets, at the cost of some limitations.
|
|
122
|
+
* Read more: https://mui.com/x/react-charts/bars/#performance
|
|
123
|
+
*
|
|
124
|
+
* @default 'svg-single'
|
|
125
|
+
*/
|
|
126
|
+
renderer: _propTypes.default.oneOf(['svg-batch', 'svg-single']),
|
|
184
127
|
/**
|
|
185
128
|
* If `true`, animations are skipped.
|
|
186
129
|
* @default undefined
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
interface BarGroupProps extends React.HTMLAttributes<SVGGElement> {
|
|
3
|
+
skipAnimation: boolean;
|
|
4
|
+
layout: 'horizontal' | 'vertical' | undefined;
|
|
5
|
+
xOrigin: number;
|
|
6
|
+
yOrigin: number;
|
|
7
|
+
}
|
|
8
|
+
export declare function BarGroup({
|
|
9
|
+
skipAnimation,
|
|
10
|
+
layout,
|
|
11
|
+
xOrigin,
|
|
12
|
+
yOrigin,
|
|
13
|
+
...props
|
|
14
|
+
}: BarGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
4
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports.BarGroup = BarGroup;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
|
+
var _styles = require("@mui/material/styles");
|
|
12
|
+
var React = _interopRequireWildcard(require("react"));
|
|
13
|
+
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
14
|
+
var _useStore = require("../../internals/store/useStore");
|
|
15
|
+
var _useChartDimensions = require("../../internals/plugins/corePlugins/useChartDimensions");
|
|
16
|
+
var _animation = require("../../internals/animation/animation");
|
|
17
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
+
const _excluded = ["skipAnimation", "layout", "xOrigin", "yOrigin"],
|
|
19
|
+
_excluded2 = ["children", "layout", "xOrigin", "yOrigin"];
|
|
20
|
+
const PathGroup = (0, _styles.styled)('g')({
|
|
21
|
+
'&[data-faded="true"]': {
|
|
22
|
+
opacity: 0.3
|
|
23
|
+
},
|
|
24
|
+
'& path': {
|
|
25
|
+
/* The browser must do hit testing to know which element a pointer is interacting with.
|
|
26
|
+
* With many data points, we create many paths causing significant time to be spent in the hit test phase.
|
|
27
|
+
* To fix this issue, we disable pointer events for the descendant paths.
|
|
28
|
+
*
|
|
29
|
+
* Ideally, users should be able to override this in case they need pointer events to be enabled,
|
|
30
|
+
* but it can affect performance negatively, especially with many data points. */
|
|
31
|
+
pointerEvents: 'none'
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
function BarGroup(_ref) {
|
|
35
|
+
let {
|
|
36
|
+
skipAnimation,
|
|
37
|
+
layout,
|
|
38
|
+
xOrigin,
|
|
39
|
+
yOrigin
|
|
40
|
+
} = _ref,
|
|
41
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
42
|
+
if (skipAnimation) {
|
|
43
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PathGroup, (0, _extends2.default)({}, props));
|
|
44
|
+
}
|
|
45
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedGroup, (0, _extends2.default)({}, props, {
|
|
46
|
+
layout: layout,
|
|
47
|
+
xOrigin: xOrigin,
|
|
48
|
+
yOrigin: yOrigin
|
|
49
|
+
}));
|
|
50
|
+
}
|
|
51
|
+
const AnimatedRect = (0, _styles.styled)('rect')({
|
|
52
|
+
'@keyframes scaleInX': {
|
|
53
|
+
from: {
|
|
54
|
+
transform: 'scaleX(0)'
|
|
55
|
+
},
|
|
56
|
+
to: {
|
|
57
|
+
transform: 'scaleX(1)'
|
|
58
|
+
}
|
|
59
|
+
},
|
|
60
|
+
'@keyframes scaleInY': {
|
|
61
|
+
from: {
|
|
62
|
+
transform: 'scaleY(0)'
|
|
63
|
+
},
|
|
64
|
+
to: {
|
|
65
|
+
transform: 'scaleY(1)'
|
|
66
|
+
}
|
|
67
|
+
},
|
|
68
|
+
animationDuration: `${_animation.ANIMATION_DURATION_MS}ms`,
|
|
69
|
+
animationFillMode: 'forwards',
|
|
70
|
+
'&[data-orientation="horizontal"]': {
|
|
71
|
+
animationName: 'scaleInX'
|
|
72
|
+
},
|
|
73
|
+
'&[data-orientation="vertical"]': {
|
|
74
|
+
animationName: 'scaleInY'
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
function AnimatedGroup(_ref2) {
|
|
78
|
+
let {
|
|
79
|
+
children,
|
|
80
|
+
layout,
|
|
81
|
+
xOrigin,
|
|
82
|
+
yOrigin
|
|
83
|
+
} = _ref2,
|
|
84
|
+
props = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
|
|
85
|
+
const store = (0, _useStore.useStore)();
|
|
86
|
+
const drawingArea = store.use(_useChartDimensions.selectorChartDrawingArea);
|
|
87
|
+
const clipPathId = (0, _useId.default)();
|
|
88
|
+
const animateChildren = [];
|
|
89
|
+
if (layout === 'horizontal') {
|
|
90
|
+
animateChildren.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedRect, {
|
|
91
|
+
"data-orientation": "horizontal",
|
|
92
|
+
x: drawingArea.left,
|
|
93
|
+
width: xOrigin - drawingArea.left,
|
|
94
|
+
y: drawingArea.top,
|
|
95
|
+
height: drawingArea.height,
|
|
96
|
+
style: {
|
|
97
|
+
transformOrigin: `${xOrigin}px ${drawingArea.top + drawingArea.height / 2}px`
|
|
98
|
+
}
|
|
99
|
+
}, "left"));
|
|
100
|
+
animateChildren.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedRect, {
|
|
101
|
+
"data-orientation": "horizontal",
|
|
102
|
+
x: xOrigin,
|
|
103
|
+
width: drawingArea.left + drawingArea.width - xOrigin,
|
|
104
|
+
y: drawingArea.top,
|
|
105
|
+
height: drawingArea.height,
|
|
106
|
+
style: {
|
|
107
|
+
transformOrigin: `${xOrigin}px ${drawingArea.top + drawingArea.height / 2}px`
|
|
108
|
+
}
|
|
109
|
+
}, "right"));
|
|
110
|
+
} else {
|
|
111
|
+
animateChildren.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedRect, {
|
|
112
|
+
"data-orientation": "vertical",
|
|
113
|
+
x: drawingArea.left,
|
|
114
|
+
width: drawingArea.width,
|
|
115
|
+
y: drawingArea.top,
|
|
116
|
+
height: yOrigin - drawingArea.top,
|
|
117
|
+
style: {
|
|
118
|
+
transformOrigin: `${drawingArea.left + drawingArea.width / 2}px ${yOrigin}px`
|
|
119
|
+
}
|
|
120
|
+
}, "top"));
|
|
121
|
+
animateChildren.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedRect, {
|
|
122
|
+
"data-orientation": "vertical",
|
|
123
|
+
x: drawingArea.left,
|
|
124
|
+
width: drawingArea.width,
|
|
125
|
+
y: yOrigin,
|
|
126
|
+
height: drawingArea.top + drawingArea.height - yOrigin,
|
|
127
|
+
style: {
|
|
128
|
+
transformOrigin: `${drawingArea.left + drawingArea.width / 2}px ${yOrigin}px`
|
|
129
|
+
}
|
|
130
|
+
}, "bottom"));
|
|
131
|
+
}
|
|
132
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
133
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)("clipPath", {
|
|
134
|
+
id: clipPathId,
|
|
135
|
+
children: animateChildren
|
|
136
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(PathGroup, (0, _extends2.default)({
|
|
137
|
+
clipPath: `url(#${clipPathId})`
|
|
138
|
+
}, props, {
|
|
139
|
+
children: children
|
|
140
|
+
}))]
|
|
141
|
+
});
|
|
142
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { BarItemIdentifier } from "../../models/index.js";
|
|
2
|
+
import { type IndividualBarPlotProps } from "../IndividualBarPlot.js";
|
|
3
|
+
interface BatchBarPlotProps extends Omit<IndividualBarPlotProps, 'onItemClick'> {
|
|
4
|
+
onItemClick?: (event: MouseEvent, barItemIdentifier: BarItemIdentifier) => void;
|
|
5
|
+
}
|
|
6
|
+
export declare function BatchBarPlot({
|
|
7
|
+
completedData,
|
|
8
|
+
borderRadius,
|
|
9
|
+
onItemClick,
|
|
10
|
+
skipAnimation
|
|
11
|
+
}: BatchBarPlotProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export {};
|