@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
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { KeyboardFocusHandler } from "../../../internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.js";
|
|
2
|
+
declare const keyboardFocusHandler: KeyboardFocusHandler<'bar', 'bar' | 'line' | 'scatter'>;
|
|
3
|
+
export default keyboardFocusHandler;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { createGetNextIndexFocusedItem, createGetPreviousIndexFocusedItem, createGetNextSeriesFocusedItem, createGetPreviousSeriesFocusedItem } from "../../../internals/commonNextFocusItem.js";
|
|
2
|
+
const outSeriesTypes = new Set(['bar', 'line', 'scatter']);
|
|
3
|
+
const keyboardFocusHandler = event => {
|
|
4
|
+
switch (event.key) {
|
|
5
|
+
case 'ArrowRight':
|
|
6
|
+
return createGetNextIndexFocusedItem(outSeriesTypes);
|
|
7
|
+
case 'ArrowLeft':
|
|
8
|
+
return createGetPreviousIndexFocusedItem(outSeriesTypes);
|
|
9
|
+
case 'ArrowDown':
|
|
10
|
+
return createGetPreviousSeriesFocusedItem(outSeriesTypes);
|
|
11
|
+
case 'ArrowUp':
|
|
12
|
+
return createGetNextSeriesFocusedItem(outSeriesTypes);
|
|
13
|
+
default:
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
};
|
|
17
|
+
export default keyboardFocusHandler;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import { stack as d3Stack } from '@mui/x-charts-vendor/d3-shape';
|
|
3
3
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
4
|
-
import { getStackingGroups } from "../../../internals/
|
|
4
|
+
import { getStackingGroups } from "../../../internals/stacking/index.js";
|
|
5
5
|
const barValueFormatter = v => v == null ? '' : v.toLocaleString();
|
|
6
6
|
const seriesProcessor = (params, dataset) => {
|
|
7
7
|
const {
|
|
@@ -2,9 +2,11 @@ import { getExtremumX, getExtremumY } from "./bar/extremums.js";
|
|
|
2
2
|
import seriesProcessor from "./bar/seriesProcessor.js";
|
|
3
3
|
import legendGetter from "./bar/legend.js";
|
|
4
4
|
import getColor from "./bar/getColor.js";
|
|
5
|
+
import keyboardFocusHandler from "./bar/keyboardFocusHandler.js";
|
|
5
6
|
import tooltipGetter, { axisTooltipGetter } from "./bar/tooltip.js";
|
|
6
7
|
import tooltipItemPositionGetter from "./bar/tooltipPosition.js";
|
|
7
8
|
import { getSeriesWithDefaultValues } from "./bar/getSeriesWithDefaultValues.js";
|
|
9
|
+
import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
|
|
8
10
|
export const barSeriesConfig = {
|
|
9
11
|
seriesProcessor,
|
|
10
12
|
colorProcessor: getColor,
|
|
@@ -14,5 +16,7 @@ export const barSeriesConfig = {
|
|
|
14
16
|
axisTooltipGetter,
|
|
15
17
|
xExtremumGetter: getExtremumX,
|
|
16
18
|
yExtremumGetter: getExtremumY,
|
|
17
|
-
getSeriesWithDefaultValues
|
|
19
|
+
getSeriesWithDefaultValues,
|
|
20
|
+
keyboardFocusHandler,
|
|
21
|
+
identifierSerializer: identifierSerializerSeriesIdDataIndex
|
|
18
22
|
};
|
package/esm/BarChart/types.d.ts
CHANGED
|
@@ -15,12 +15,14 @@ export interface ProcessedBarSeriesData {
|
|
|
15
15
|
xOrigin: number;
|
|
16
16
|
yOrigin: number;
|
|
17
17
|
}
|
|
18
|
+
export type BorderRadiusSide = 'top' | 'bottom' | 'left' | 'right';
|
|
18
19
|
export interface ProcessedBarData extends AnimationData {
|
|
19
20
|
seriesId: SeriesId;
|
|
20
21
|
dataIndex: number;
|
|
21
22
|
color: string;
|
|
22
23
|
value: number | null;
|
|
23
24
|
maskId: string;
|
|
25
|
+
borderRadiusSide?: BorderRadiusSide;
|
|
24
26
|
}
|
|
25
27
|
export interface MaskData extends AnimationData {
|
|
26
28
|
id: string;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import type
|
|
2
|
+
import { type BarChartProps, type BarSeries } from "./BarChart.js";
|
|
3
3
|
import { type ChartContainerProps } from "../ChartContainer/index.js";
|
|
4
4
|
import { type BarPlotProps } from "./BarPlot.js";
|
|
5
5
|
import { type ChartsGridProps } from "../ChartsGrid/index.js";
|
|
@@ -10,6 +10,10 @@ import { type ChartsAxisHighlightProps } from "../ChartsAxisHighlight/index.js";
|
|
|
10
10
|
import { type ChartsLegendSlotExtension } from "../ChartsLegend/index.js";
|
|
11
11
|
import type { ChartsWrapperProps } from "../ChartsWrapper/index.js";
|
|
12
12
|
import { type BarChartPluginSignatures } from "./BarChart.plugins.js";
|
|
13
|
+
export interface UseBarChartPropsExtensions {}
|
|
14
|
+
export type UseBarChartProps = Omit<BarChartProps, 'series'> & Omit<{
|
|
15
|
+
series: ReadonlyArray<BarSeries>;
|
|
16
|
+
}, keyof UseBarChartPropsExtensions> & UseBarChartPropsExtensions;
|
|
13
17
|
/**
|
|
14
18
|
* A helper function that extracts BarChartProps from the input props
|
|
15
19
|
* and returns an object with props for the children components of BarChart.
|
|
@@ -17,7 +21,7 @@ import { type BarChartPluginSignatures } from "./BarChart.plugins.js";
|
|
|
17
21
|
* @param props The input props for BarChart
|
|
18
22
|
* @returns An object with props for the children components of BarChart
|
|
19
23
|
*/
|
|
20
|
-
export declare const useBarChartProps: (props:
|
|
24
|
+
export declare const useBarChartProps: (props: UseBarChartProps) => {
|
|
21
25
|
chartsWrapperProps: Omit<ChartsWrapperProps, "children">;
|
|
22
26
|
chartContainerProps: ChartContainerProps<"bar", BarChartPluginSignatures>;
|
|
23
27
|
barPlotProps: BarPlotProps;
|
|
@@ -2,12 +2,11 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "axisHighlight", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend", "showToolbar", "brushConfig"];
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "axisHighlight", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "layout", "onItemClick", "highlightedItem", "onHighlightChange", "borderRadius", "barLabel", "className", "hideLegend", "showToolbar", "brushConfig", "renderer"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import useId from '@mui/utils/useId';
|
|
8
8
|
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from "../constants/index.js";
|
|
9
9
|
import { BAR_CHART_PLUGINS } from "./BarChart.plugins.js";
|
|
10
|
-
|
|
11
10
|
/**
|
|
12
11
|
* A helper function that extracts BarChartProps from the input props
|
|
13
12
|
* and returns an object with props for the children components of BarChart.
|
|
@@ -40,7 +39,8 @@ export const useBarChartProps = props => {
|
|
|
40
39
|
borderRadius,
|
|
41
40
|
barLabel,
|
|
42
41
|
className,
|
|
43
|
-
brushConfig
|
|
42
|
+
brushConfig,
|
|
43
|
+
renderer
|
|
44
44
|
} = props,
|
|
45
45
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
46
46
|
const id = useId();
|
|
@@ -105,6 +105,7 @@ export const useBarChartProps = props => {
|
|
|
105
105
|
slots,
|
|
106
106
|
slotProps,
|
|
107
107
|
borderRadius,
|
|
108
|
+
renderer,
|
|
108
109
|
barLabel
|
|
109
110
|
};
|
|
110
111
|
const gridProps = {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type ChartsXAxisProps, type ChartsYAxisProps } from "../models/axis.js";
|
|
2
|
-
import { type ChartDrawingArea } from "../hooks/index.js";
|
|
3
2
|
import { type MaskData, type ProcessedBarSeriesData } from "./types.js";
|
|
4
3
|
import { type ComputedAxisConfig } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.js";
|
|
4
|
+
import { type ChartDrawingArea } from "../hooks/useDrawingArea.js";
|
|
5
5
|
export declare function useBarPlotData(drawingArea: ChartDrawingArea, xAxes: ComputedAxisConfig<ChartsXAxisProps>, yAxes: ComputedAxisConfig<ChartsYAxisProps>): {
|
|
6
6
|
completedData: ProcessedBarSeriesData[];
|
|
7
7
|
masksData: MaskData[];
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import getColor from "./seriesConfig/bar/getColor.js";
|
|
3
|
-
import {
|
|
3
|
+
import { useXAxes, useYAxes } from "../hooks/useAxis.js";
|
|
4
4
|
import { checkBarChartScaleErrors } from "./checkBarChartScaleErrors.js";
|
|
5
5
|
import { useBarSeriesContext } from "../hooks/useBarSeries.js";
|
|
6
6
|
import { getBarDimensions } from "../internals/getBarDimensions.js";
|
|
7
|
+
import { useChartId } from "../hooks/useChartId.js";
|
|
7
8
|
export function useBarPlotData(drawingArea, xAxes, yAxes) {
|
|
8
9
|
const seriesData = useBarSeriesContext() ?? {
|
|
9
10
|
series: {},
|
|
@@ -25,6 +26,8 @@ export function useBarPlotData(drawingArea, xAxes, yAxes) {
|
|
|
25
26
|
const xMax = drawingArea.left + drawingArea.width;
|
|
26
27
|
const yMin = drawingArea.top;
|
|
27
28
|
const yMax = drawingArea.top + drawingArea.height;
|
|
29
|
+
const lastNegativePerIndex = new Map();
|
|
30
|
+
const lastPositivePerIndex = new Map();
|
|
28
31
|
return seriesIds.map(seriesId => {
|
|
29
32
|
const xAxisId = series[seriesId].xAxisId ?? defaultXAxisId;
|
|
30
33
|
const yAxisId = series[seriesId].yAxisId ?? defaultYAxisId;
|
|
@@ -66,6 +69,22 @@ export function useBarPlotData(drawingArea, xAxes, yAxes) {
|
|
|
66
69
|
if (result.x > xMax || result.x + result.width < xMin || result.y > yMax || result.y + result.height < yMin) {
|
|
67
70
|
continue;
|
|
68
71
|
}
|
|
72
|
+
const lastNegative = lastNegativePerIndex.get(dataIndex);
|
|
73
|
+
const lastPositive = lastPositivePerIndex.get(dataIndex);
|
|
74
|
+
const sign = (reverse ? -1 : 1) * Math.sign(result.value ?? 0);
|
|
75
|
+
if (sign > 0) {
|
|
76
|
+
if (lastPositive) {
|
|
77
|
+
delete lastPositive.borderRadiusSide;
|
|
78
|
+
}
|
|
79
|
+
result.borderRadiusSide = verticalLayout ? 'top' : 'right';
|
|
80
|
+
lastPositivePerIndex.set(dataIndex, result);
|
|
81
|
+
} else if (sign < 0) {
|
|
82
|
+
if (lastNegative) {
|
|
83
|
+
delete lastNegative.borderRadiusSide;
|
|
84
|
+
}
|
|
85
|
+
result.borderRadiusSide = verticalLayout ? 'bottom' : 'left';
|
|
86
|
+
lastNegativePerIndex.set(dataIndex, result);
|
|
87
|
+
}
|
|
69
88
|
if (!masks[result.maskId]) {
|
|
70
89
|
masks[result.maskId] = {
|
|
71
90
|
id: result.maskId,
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { type BarItemIdentifier } from "../models/seriesType/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Hook that registers pointer event handlers for chart item clicking.
|
|
4
|
+
* @param onItemClick Callback for item click events.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useRegisterItemClickHandlers(onItemClick: ((event: MouseEvent, barItemIdentifier: BarItemIdentifier) => void) | undefined): void;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { useSvgRef } from "../hooks/useSvgRef.js";
|
|
5
|
+
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
6
|
+
import { getSVGPoint } from "../internals/getSVGPoint.js";
|
|
7
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
8
|
+
import { selectorBarItemAtPosition } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Hook that registers pointer event handlers for chart item clicking.
|
|
12
|
+
* @param onItemClick Callback for item click events.
|
|
13
|
+
*/
|
|
14
|
+
export function useRegisterItemClickHandlers(onItemClick) {
|
|
15
|
+
const {
|
|
16
|
+
instance
|
|
17
|
+
} = useChartContext();
|
|
18
|
+
const svgRef = useSvgRef();
|
|
19
|
+
const store = useStore();
|
|
20
|
+
React.useEffect(() => {
|
|
21
|
+
const element = svgRef.current;
|
|
22
|
+
if (!element || !onItemClick) {
|
|
23
|
+
return undefined;
|
|
24
|
+
}
|
|
25
|
+
let lastPointerUp = null;
|
|
26
|
+
const onClick = function onClick(event) {
|
|
27
|
+
let point = event;
|
|
28
|
+
|
|
29
|
+
/* The click event doesn't contain decimal values in clientX/Y, but the pointermove does.
|
|
30
|
+
* This caused a problem when rendering many bars that were thinner than a pixel where the tooltip or the highlight
|
|
31
|
+
* would refer to a different bar than the click since those rely on the pointermove event.
|
|
32
|
+
* As a fix, we use the pointerup event to get the decimal values and check if the pointer up event was close enough
|
|
33
|
+
* to the click event (1px difference in each direction); if so, then we can use the pointerup's clientX/Y; if not,
|
|
34
|
+
* we default to the click event's clientX/Y. */
|
|
35
|
+
if (lastPointerUp) {
|
|
36
|
+
if (Math.abs(event.clientX - lastPointerUp.clientX) <= 1 && Math.abs(event.clientY - lastPointerUp.clientY) <= 1) {
|
|
37
|
+
point = {
|
|
38
|
+
clientX: lastPointerUp.clientX,
|
|
39
|
+
clientY: lastPointerUp.clientY
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
lastPointerUp = null;
|
|
44
|
+
const svgPoint = getSVGPoint(element, point);
|
|
45
|
+
if (!instance.isPointInside(svgPoint.x, svgPoint.y)) {
|
|
46
|
+
return;
|
|
47
|
+
}
|
|
48
|
+
const item = selectorBarItemAtPosition(store.state, svgPoint);
|
|
49
|
+
if (item) {
|
|
50
|
+
onItemClick(event, {
|
|
51
|
+
type: 'bar',
|
|
52
|
+
seriesId: item.seriesId,
|
|
53
|
+
dataIndex: item.dataIndex
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
const onPointerUp = function onPointerUp(event) {
|
|
58
|
+
lastPointerUp = event;
|
|
59
|
+
};
|
|
60
|
+
element.addEventListener('click', onClick);
|
|
61
|
+
element.addEventListener('pointerup', onPointerUp);
|
|
62
|
+
return () => {
|
|
63
|
+
element.removeEventListener('click', onClick);
|
|
64
|
+
element.removeEventListener('pointerup', onPointerUp);
|
|
65
|
+
};
|
|
66
|
+
}, [instance, onItemClick, store, svgRef]);
|
|
67
|
+
}
|
|
@@ -95,6 +95,35 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
95
95
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
96
96
|
*/
|
|
97
97
|
height: PropTypes.number,
|
|
98
|
+
/**
|
|
99
|
+
* List of hidden series and/or items.
|
|
100
|
+
*
|
|
101
|
+
* Different chart types use different keys.
|
|
102
|
+
*
|
|
103
|
+
* @example
|
|
104
|
+
* ```ts
|
|
105
|
+
* [
|
|
106
|
+
* {
|
|
107
|
+
* type: 'pie',
|
|
108
|
+
* seriesId: 'series-1',
|
|
109
|
+
* dataIndex: 3,
|
|
110
|
+
* },
|
|
111
|
+
* {
|
|
112
|
+
* type: 'line',
|
|
113
|
+
* seriesId: 'series-2',
|
|
114
|
+
* }
|
|
115
|
+
* ]
|
|
116
|
+
* ```
|
|
117
|
+
*/
|
|
118
|
+
hiddenItems: PropTypes.arrayOf(PropTypes.shape({
|
|
119
|
+
dataIndex: PropTypes.any,
|
|
120
|
+
seriesId: PropTypes.shape({
|
|
121
|
+
toLocaleString: PropTypes.func.isRequired,
|
|
122
|
+
toString: PropTypes.func.isRequired,
|
|
123
|
+
valueOf: PropTypes.func.isRequired
|
|
124
|
+
}),
|
|
125
|
+
type: PropTypes.object.isRequired
|
|
126
|
+
})),
|
|
98
127
|
/**
|
|
99
128
|
* The controlled axis highlight.
|
|
100
129
|
* Identified by the axis id, and data index.
|
|
@@ -139,6 +168,11 @@ process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
|
139
168
|
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
140
169
|
*/
|
|
141
170
|
onAxisClick: PropTypes.func,
|
|
171
|
+
/**
|
|
172
|
+
* Callback fired when any hidden identifiers change.
|
|
173
|
+
* @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
|
|
174
|
+
*/
|
|
175
|
+
onHiddenItemsChange: PropTypes.func,
|
|
142
176
|
/**
|
|
143
177
|
* The callback fired when the highlighted item changes.
|
|
144
178
|
*
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "highlightedAxis", "onHighlightedAxisChange", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps", "experimentalFeatures", "enableKeyboardNavigation", "brushConfig"];
|
|
5
|
+
const _excluded = ["width", "height", "margin", "children", "series", "colors", "dataset", "desc", "onAxisClick", "highlightedAxis", "onHighlightedAxisChange", "disableVoronoi", "voronoiMaxRadius", "onItemClick", "disableAxisListener", "highlightedItem", "onHighlightChange", "sx", "title", "xAxis", "yAxis", "zAxis", "rotationAxis", "radiusAxis", "skipAnimation", "seriesConfig", "plugins", "localeText", "slots", "slotProps", "experimentalFeatures", "enableKeyboardNavigation", "brushConfig", "onHiddenItemsChange", "hiddenItems"];
|
|
6
6
|
import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
|
|
7
7
|
export const useChartContainerProps = (props, ref) => {
|
|
8
8
|
const _ref = props,
|
|
@@ -39,7 +39,9 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
39
39
|
slotProps,
|
|
40
40
|
experimentalFeatures,
|
|
41
41
|
enableKeyboardNavigation,
|
|
42
|
-
brushConfig
|
|
42
|
+
brushConfig,
|
|
43
|
+
onHiddenItemsChange,
|
|
44
|
+
hiddenItems
|
|
43
45
|
} = _ref,
|
|
44
46
|
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
45
47
|
const chartsSurfaceProps = _extends({
|
|
@@ -75,6 +77,8 @@ export const useChartContainerProps = (props, ref) => {
|
|
|
75
77
|
experimentalFeatures,
|
|
76
78
|
enableKeyboardNavigation,
|
|
77
79
|
brushConfig,
|
|
80
|
+
onHiddenItemsChange,
|
|
81
|
+
hiddenItems,
|
|
78
82
|
plugins: plugins ?? DEFAULT_PLUGINS,
|
|
79
83
|
slots,
|
|
80
84
|
slotProps
|
|
@@ -82,7 +82,7 @@ const ChartsLegend = consumeSlots('MuiChartsLegend', 'legend', {
|
|
|
82
82
|
children: data.items.map((item, i) => {
|
|
83
83
|
return /*#__PURE__*/_jsx("li", {
|
|
84
84
|
className: classes?.item,
|
|
85
|
-
"data-series": item.
|
|
85
|
+
"data-series": item.seriesId,
|
|
86
86
|
children: /*#__PURE__*/_jsxs(Element, {
|
|
87
87
|
className: classes?.series,
|
|
88
88
|
role: onItemClick ? 'button' : undefined,
|
|
@@ -99,7 +99,7 @@ const ChartsLegend = consumeSlots('MuiChartsLegend', 'legend', {
|
|
|
99
99
|
children: item.label
|
|
100
100
|
})]
|
|
101
101
|
})
|
|
102
|
-
}, item.
|
|
102
|
+
}, `${item.seriesId}-${item.dataIndex}`);
|
|
103
103
|
})
|
|
104
104
|
}));
|
|
105
105
|
}));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { type ChartsLabelMarkProps } from "../ChartsLabel/ChartsLabelMark.js";
|
|
2
2
|
import { type PieItemId } from "../models/index.js";
|
|
3
3
|
import { type SeriesId } from "../models/seriesType/common.js";
|
|
4
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
4
5
|
interface LegendItemContextBase {
|
|
5
6
|
/**
|
|
6
7
|
* The color used in the legend
|
|
@@ -15,8 +16,14 @@ export interface LegendItemParams extends Partial<Omit<SeriesLegendItemContext,
|
|
|
15
16
|
/**
|
|
16
17
|
* The identifier of the legend element.
|
|
17
18
|
* Used for internal purpose such as `key` props
|
|
19
|
+
* @deprecated use `seriesId` and `dataIndex` instead
|
|
18
20
|
*/
|
|
19
21
|
id: number | string;
|
|
22
|
+
/**
|
|
23
|
+
* The type of the series
|
|
24
|
+
* This property is always defined, but marked as optional to avoid breaking changes. It will become required in a future major version.
|
|
25
|
+
*/
|
|
26
|
+
type?: ChartSeriesType;
|
|
20
27
|
markType: ChartsLabelMarkProps['type'];
|
|
21
28
|
}
|
|
22
29
|
export interface SeriesLegendItemContext extends LegendItemContextBase {
|
|
@@ -32,8 +39,13 @@ export interface SeriesLegendItemContext extends LegendItemContextBase {
|
|
|
32
39
|
seriesId: SeriesId;
|
|
33
40
|
/**
|
|
34
41
|
* The identifier of the pie item
|
|
42
|
+
* @deprecated use `dataIndex` instead
|
|
35
43
|
*/
|
|
36
44
|
itemId?: PieItemId;
|
|
45
|
+
/**
|
|
46
|
+
* The data index of the item in the series data array
|
|
47
|
+
*/
|
|
48
|
+
dataIndex?: number;
|
|
37
49
|
}
|
|
38
50
|
export interface PiecewiseColorLegendItemContext extends LegendItemContextBase {
|
|
39
51
|
/**
|
|
@@ -7,7 +7,10 @@ import { styled } from '@mui/material/styles';
|
|
|
7
7
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
8
8
|
import { useChartsLocalization } from "../hooks/useChartsLocalization.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
const StyledText = styled('text'
|
|
10
|
+
const StyledText = styled('text', {
|
|
11
|
+
slot: 'internal',
|
|
12
|
+
shouldForwardProp: undefined
|
|
13
|
+
})(({
|
|
11
14
|
theme
|
|
12
15
|
}) => _extends({}, theme.typography.body2, {
|
|
13
16
|
stroke: 'none',
|
|
@@ -7,7 +7,10 @@ import { styled } from '@mui/material/styles';
|
|
|
7
7
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
8
8
|
import { useChartsLocalization } from "../hooks/useChartsLocalization.js";
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
const StyledText = styled('text'
|
|
10
|
+
const StyledText = styled('text', {
|
|
11
|
+
slot: 'internal',
|
|
12
|
+
shouldForwardProp: undefined
|
|
13
|
+
})(({
|
|
11
14
|
theme
|
|
12
15
|
}) => _extends({}, theme.typography.body2, {
|
|
13
16
|
stroke: 'none',
|
|
@@ -40,4 +40,4 @@ export type CommonChartsReferenceLineProps = {
|
|
|
40
40
|
*/
|
|
41
41
|
classes?: Partial<ChartsReferenceLineClasses>;
|
|
42
42
|
};
|
|
43
|
-
export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, import("react").SVGProps<SVGGElement>, {}>;
|
|
43
|
+
export declare const ReferenceLineRoot: import("@emotion/styled").StyledComponent<import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme>, Pick<import("react").SVGProps<SVGGElement>, keyof import("react").SVGProps<SVGGElement>>, {}>;
|
|
@@ -3,7 +3,10 @@ import { styled } from '@mui/material/styles';
|
|
|
3
3
|
import { referenceLineClasses } from "./chartsReferenceLineClasses.js";
|
|
4
4
|
export const DEFAULT_SPACING = 5;
|
|
5
5
|
export const DEFAULT_SPACING_MIDDLE_OTHER_AXIS = 0;
|
|
6
|
-
export const ReferenceLineRoot = styled('g'
|
|
6
|
+
export const ReferenceLineRoot = styled('g', {
|
|
7
|
+
slot: 'internal',
|
|
8
|
+
shouldForwardProp: undefined
|
|
9
|
+
})(({
|
|
7
10
|
theme
|
|
8
11
|
}) => ({
|
|
9
12
|
[`& .${referenceLineClasses.line}`]: {
|
|
@@ -4,6 +4,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["trigger", "position", "anchor", "classes", "children"];
|
|
6
6
|
import * as React from 'react';
|
|
7
|
+
import * as ReactDOM from 'react-dom';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
9
10
|
import useLazyRef from '@mui/utils/useLazyRef';
|
|
@@ -21,7 +22,7 @@ import { selectorChartsInteractionPolarAxisTooltip } from "../internals/plugins/
|
|
|
21
22
|
import { useAxisSystem } from "../hooks/useAxisSystem.js";
|
|
22
23
|
import { useSvgRef } from "../hooks/index.js";
|
|
23
24
|
import { selectorBrushShouldPreventTooltip } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
24
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
25
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
25
26
|
const selectorReturnFalse = () => false;
|
|
26
27
|
const selectorReturnNull = () => null;
|
|
27
28
|
function getIsOpenSelector(trigger, axisSystem, shouldPreventBecauseOfBrush) {
|
|
@@ -72,6 +73,7 @@ function ChartsTooltipContainer(inProps) {
|
|
|
72
73
|
} = props,
|
|
73
74
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
74
75
|
const svgRef = useSvgRef();
|
|
76
|
+
const anchorRef = React.useRef(null);
|
|
75
77
|
const classes = useUtilityClasses(propClasses);
|
|
76
78
|
const pointerType = usePointerType();
|
|
77
79
|
const isFineMainPointer = useIsFineMainPointer();
|
|
@@ -93,18 +95,11 @@ function ChartsTooltipContainer(inProps) {
|
|
|
93
95
|
return () => {};
|
|
94
96
|
}
|
|
95
97
|
if (itemPosition !== null) {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
positionRef.current = {
|
|
99
|
-
x: svgElement.getBoundingClientRect().left + (itemPosition?.x ?? 0),
|
|
100
|
-
y: svgElement.getBoundingClientRect().top + (itemPosition?.y ?? 0)
|
|
101
|
-
};
|
|
102
|
-
popperRef.current?.update();
|
|
103
|
-
});
|
|
104
|
-
positionUpdate();
|
|
105
|
-
return () => positionUpdate.clear();
|
|
98
|
+
// Tooltip position is already handled by the anchor element
|
|
99
|
+
return undefined;
|
|
106
100
|
}
|
|
107
101
|
const pointerUpdate = rafThrottle((x, y) => {
|
|
102
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
108
103
|
positionRef.current = {
|
|
109
104
|
x,
|
|
110
105
|
y
|
|
@@ -124,7 +119,7 @@ function ChartsTooltipContainer(inProps) {
|
|
|
124
119
|
pointerUpdate.clear();
|
|
125
120
|
};
|
|
126
121
|
}, [svgRef, positionRef, itemPosition]);
|
|
127
|
-
const
|
|
122
|
+
const pointerAnchorEl = React.useMemo(() => ({
|
|
128
123
|
getBoundingClientRect: () => ({
|
|
129
124
|
x: positionRef.current.x,
|
|
130
125
|
y: positionRef.current.y,
|
|
@@ -166,16 +161,25 @@ function ChartsTooltipContainer(inProps) {
|
|
|
166
161
|
if (trigger === 'none') {
|
|
167
162
|
return null;
|
|
168
163
|
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
164
|
+
if (itemPosition !== null && anchorRef.current) {
|
|
165
|
+
anchorRef.current.setAttribute('x', String(itemPosition.x));
|
|
166
|
+
anchorRef.current.setAttribute('y', String(itemPosition.y));
|
|
167
|
+
}
|
|
168
|
+
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
169
|
+
children: [svgRef.current && /*#__PURE__*/ReactDOM.createPortal(/*#__PURE__*/_jsx("rect", {
|
|
170
|
+
ref: anchorRef,
|
|
171
|
+
display: "hidden"
|
|
172
|
+
}), svgRef.current), /*#__PURE__*/_jsx(NoSsr, {
|
|
173
|
+
children: isOpen && /*#__PURE__*/_jsx(ChartsTooltipRoot, _extends({}, other, {
|
|
174
|
+
className: classes?.root,
|
|
175
|
+
open: isOpen,
|
|
176
|
+
placement: other.placement ?? position ?? (pointerType !== null && isMouse ? 'right-start' : 'top'),
|
|
177
|
+
popperRef: popperRef,
|
|
178
|
+
anchorEl: itemPosition ? anchorRef.current : pointerAnchorEl,
|
|
179
|
+
modifiers: modifiers,
|
|
180
|
+
children: children
|
|
181
|
+
}))
|
|
182
|
+
})]
|
|
179
183
|
});
|
|
180
184
|
}
|
|
181
185
|
process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
|
|
@@ -11,7 +11,10 @@ import { GaugeProvider } from "./GaugeProvider.js";
|
|
|
11
11
|
import { ChartProvider } from "../context/ChartProvider/index.js";
|
|
12
12
|
import { defaultizeMargin } from "../internals/defaultizeMargin.js";
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
const GStyled = styled('g'
|
|
14
|
+
const GStyled = styled('g', {
|
|
15
|
+
slot: 'internal',
|
|
16
|
+
shouldForwardProp: undefined
|
|
17
|
+
})(({
|
|
15
18
|
theme
|
|
16
19
|
}) => ({
|
|
17
20
|
'& text': {
|
|
@@ -24,9 +24,12 @@ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props,
|
|
|
24
24
|
ownerState
|
|
25
25
|
} = props,
|
|
26
26
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
27
|
-
const animateProps = useAnimateLine(
|
|
27
|
+
const animateProps = useAnimateLine({
|
|
28
|
+
d: props.d,
|
|
29
|
+
skipAnimation,
|
|
28
30
|
ref
|
|
29
|
-
})
|
|
31
|
+
});
|
|
32
|
+
const fadedOpacity = ownerState.isFaded ? 0.3 : 1;
|
|
30
33
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
31
34
|
skipAnimation: skipAnimation,
|
|
32
35
|
id: `${ownerState.id}-line-clip`,
|
|
@@ -36,7 +39,7 @@ const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props,
|
|
|
36
39
|
strokeLinejoin: "round",
|
|
37
40
|
fill: "none",
|
|
38
41
|
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
39
|
-
opacity: ownerState.
|
|
42
|
+
opacity: ownerState.hidden ? 0 : fadedOpacity,
|
|
40
43
|
"data-series": ownerState.id,
|
|
41
44
|
"data-highlighted": ownerState.isHighlighted || undefined,
|
|
42
45
|
"data-faded": ownerState.isFaded || undefined
|
|
@@ -54,6 +57,7 @@ process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
|
|
54
57
|
classes: PropTypes.object,
|
|
55
58
|
color: PropTypes.string.isRequired,
|
|
56
59
|
gradientId: PropTypes.string,
|
|
60
|
+
hidden: PropTypes.bool,
|
|
57
61
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
58
62
|
isFaded: PropTypes.bool.isRequired,
|
|
59
63
|
isHighlighted: PropTypes.bool.isRequired
|
|
@@ -8,7 +8,10 @@ import { cleanId } from "../internals/cleanId.js";
|
|
|
8
8
|
import { useChartId, useDrawingArea } from "../hooks/index.js";
|
|
9
9
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
10
|
export const appearingMaskClasses = generateUtilityClasses('MuiAppearingMask', ['animate']);
|
|
11
|
-
const AnimatedRect = styled('rect'
|
|
11
|
+
const AnimatedRect = styled('rect', {
|
|
12
|
+
slot: 'internal',
|
|
13
|
+
shouldForwardProp: undefined
|
|
14
|
+
})({
|
|
12
15
|
animationName: 'animate-width',
|
|
13
16
|
animationTimingFunction: ANIMATION_TIMING_FUNCTION,
|
|
14
17
|
animationDuration: '0s',
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type MarkElementOwnerState } from "./markElementClasses.js";
|
|
3
3
|
export type CircleMarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighlighted'> & Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> & {
|
|
4
|
+
/**
|
|
5
|
+
* If `true`, the marker is hidden.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
hidden?: boolean;
|
|
4
9
|
/**
|
|
5
10
|
* If `true`, animations are skipped.
|
|
6
11
|
* @default false
|