@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/internals/index.js
CHANGED
|
@@ -13,12 +13,13 @@ var _exportNames = {
|
|
|
13
13
|
useLineChartProps: true,
|
|
14
14
|
useAreaPlotData: true,
|
|
15
15
|
useLinePlotData: true,
|
|
16
|
-
useBarChartProps: true,
|
|
17
16
|
useBarPlotData: true,
|
|
18
17
|
useRadarChartProps: true,
|
|
19
18
|
useSkipAnimation: true,
|
|
19
|
+
useRegisterPointerInteractions: true,
|
|
20
20
|
getCartesianAxisTriggerTooltip: true,
|
|
21
21
|
getCartesianAxisIndex: true,
|
|
22
|
+
getSeriesColorFn: true,
|
|
22
23
|
checkBarChartScaleErrors: true,
|
|
23
24
|
getBandSize: true,
|
|
24
25
|
getAxisExtrema: true
|
|
@@ -53,22 +54,22 @@ Object.defineProperty(exports, "getCartesianAxisTriggerTooltip", {
|
|
|
53
54
|
return _getAxisTriggerTooltip.getAxisTriggerTooltip;
|
|
54
55
|
}
|
|
55
56
|
});
|
|
56
|
-
Object.defineProperty(exports, "
|
|
57
|
+
Object.defineProperty(exports, "getSeriesColorFn", {
|
|
57
58
|
enumerable: true,
|
|
58
59
|
get: function () {
|
|
59
|
-
return
|
|
60
|
+
return _getSeriesColorFn.getSeriesColorFn;
|
|
60
61
|
}
|
|
61
62
|
});
|
|
62
|
-
Object.defineProperty(exports, "
|
|
63
|
+
Object.defineProperty(exports, "scatterSeriesConfig", {
|
|
63
64
|
enumerable: true,
|
|
64
65
|
get: function () {
|
|
65
|
-
return
|
|
66
|
+
return _seriesConfig.scatterSeriesConfig;
|
|
66
67
|
}
|
|
67
68
|
});
|
|
68
|
-
Object.defineProperty(exports, "
|
|
69
|
+
Object.defineProperty(exports, "useAreaPlotData", {
|
|
69
70
|
enumerable: true,
|
|
70
71
|
get: function () {
|
|
71
|
-
return
|
|
72
|
+
return _useAreaPlotData.useAreaPlotData;
|
|
72
73
|
}
|
|
73
74
|
});
|
|
74
75
|
Object.defineProperty(exports, "useBarPlotData", {
|
|
@@ -107,6 +108,12 @@ Object.defineProperty(exports, "useRadarChartProps", {
|
|
|
107
108
|
return _useRadarChartProps.useRadarChartProps;
|
|
108
109
|
}
|
|
109
110
|
});
|
|
111
|
+
Object.defineProperty(exports, "useRegisterPointerInteractions", {
|
|
112
|
+
enumerable: true,
|
|
113
|
+
get: function () {
|
|
114
|
+
return _useRegisterPointerInteractions.useRegisterPointerInteractions;
|
|
115
|
+
}
|
|
116
|
+
});
|
|
110
117
|
Object.defineProperty(exports, "useScatterChartProps", {
|
|
111
118
|
enumerable: true,
|
|
112
119
|
get: function () {
|
|
@@ -201,6 +208,17 @@ var _useLineChartProps = require("../LineChart/useLineChartProps");
|
|
|
201
208
|
var _useAreaPlotData = require("../LineChart/useAreaPlotData");
|
|
202
209
|
var _useLinePlotData = require("../LineChart/useLinePlotData");
|
|
203
210
|
var _useBarChartProps = require("../BarChart/useBarChartProps");
|
|
211
|
+
Object.keys(_useBarChartProps).forEach(function (key) {
|
|
212
|
+
if (key === "default" || key === "__esModule") return;
|
|
213
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
214
|
+
if (key in exports && exports[key] === _useBarChartProps[key]) return;
|
|
215
|
+
Object.defineProperty(exports, key, {
|
|
216
|
+
enumerable: true,
|
|
217
|
+
get: function () {
|
|
218
|
+
return _useBarChartProps[key];
|
|
219
|
+
}
|
|
220
|
+
});
|
|
221
|
+
});
|
|
204
222
|
var _useBarPlotData = require("../BarChart/useBarPlotData");
|
|
205
223
|
var _useRadarChartProps = require("../RadarChart/useRadarChartProps");
|
|
206
224
|
var _useChartContainerProps = require("../ChartContainer/useChartContainerProps");
|
|
@@ -240,6 +258,7 @@ Object.keys(_seriesSelectorOfType).forEach(function (key) {
|
|
|
240
258
|
});
|
|
241
259
|
});
|
|
242
260
|
var _useSkipAnimation = require("../hooks/useSkipAnimation");
|
|
261
|
+
var _useRegisterPointerInteractions = require("./plugins/featurePlugins/shared/useRegisterPointerInteractions");
|
|
243
262
|
var _useChartId = require("./plugins/corePlugins/useChartId");
|
|
244
263
|
Object.keys(_useChartId).forEach(function (key) {
|
|
245
264
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -360,6 +379,18 @@ Object.keys(_useChartHighlight).forEach(function (key) {
|
|
|
360
379
|
}
|
|
361
380
|
});
|
|
362
381
|
});
|
|
382
|
+
var _useChartVisibilityManager = require("./plugins/featurePlugins/useChartVisibilityManager");
|
|
383
|
+
Object.keys(_useChartVisibilityManager).forEach(function (key) {
|
|
384
|
+
if (key === "default" || key === "__esModule") return;
|
|
385
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
386
|
+
if (key in exports && exports[key] === _useChartVisibilityManager[key]) return;
|
|
387
|
+
Object.defineProperty(exports, key, {
|
|
388
|
+
enumerable: true,
|
|
389
|
+
get: function () {
|
|
390
|
+
return _useChartVisibilityManager[key];
|
|
391
|
+
}
|
|
392
|
+
});
|
|
393
|
+
});
|
|
363
394
|
var _useChartKeyboardNavigation = require("./plugins/featurePlugins/useChartKeyboardNavigation");
|
|
364
395
|
Object.keys(_useChartKeyboardNavigation).forEach(function (key) {
|
|
365
396
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -554,15 +585,15 @@ Object.keys(_getScale).forEach(function (key) {
|
|
|
554
585
|
}
|
|
555
586
|
});
|
|
556
587
|
});
|
|
557
|
-
var
|
|
558
|
-
Object.keys(
|
|
588
|
+
var _stacking = require("./stacking");
|
|
589
|
+
Object.keys(_stacking).forEach(function (key) {
|
|
559
590
|
if (key === "default" || key === "__esModule") return;
|
|
560
591
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
561
|
-
if (key in exports && exports[key] ===
|
|
592
|
+
if (key in exports && exports[key] === _stacking[key]) return;
|
|
562
593
|
Object.defineProperty(exports, key, {
|
|
563
594
|
enumerable: true,
|
|
564
595
|
get: function () {
|
|
565
|
-
return
|
|
596
|
+
return _stacking[key];
|
|
566
597
|
}
|
|
567
598
|
});
|
|
568
599
|
});
|
|
@@ -686,6 +717,7 @@ Object.keys(_findMinMax).forEach(function (key) {
|
|
|
686
717
|
}
|
|
687
718
|
});
|
|
688
719
|
});
|
|
720
|
+
var _getSeriesColorFn = require("./getSeriesColorFn");
|
|
689
721
|
var _checkBarChartScaleErrors = require("../BarChart/checkBarChartScaleErrors");
|
|
690
722
|
var _getBandSize = require("./getBandSize");
|
|
691
723
|
var _getAxisExtrema = require("./plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema");
|
|
@@ -820,4 +852,16 @@ Object.keys(_scales).forEach(function (key) {
|
|
|
820
852
|
return _scales[key];
|
|
821
853
|
}
|
|
822
854
|
});
|
|
855
|
+
});
|
|
856
|
+
var _identifierSerializer = require("./identifierSerializer");
|
|
857
|
+
Object.keys(_identifierSerializer).forEach(function (key) {
|
|
858
|
+
if (key === "default" || key === "__esModule") return;
|
|
859
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
860
|
+
if (key in exports && exports[key] === _identifierSerializer[key]) return;
|
|
861
|
+
Object.defineProperty(exports, key, {
|
|
862
|
+
enumerable: true,
|
|
863
|
+
get: function () {
|
|
864
|
+
return _identifierSerializer[key];
|
|
865
|
+
}
|
|
866
|
+
});
|
|
823
867
|
});
|
|
@@ -1,2 +1,6 @@
|
|
|
1
|
-
import { type D3Scale } from "../models/axis.js";
|
|
2
|
-
export declare function invertScale<T>(scale: D3Scale, data: readonly T[], value: number): number | Date | T;
|
|
1
|
+
import { type D3OrdinalScale, type D3Scale } from "../models/axis.js";
|
|
2
|
+
export declare function invertScale<T>(scale: D3Scale, data: readonly T[], value: number): number | Date | T;
|
|
3
|
+
/**
|
|
4
|
+
* Get the data index for a given value on an ordinal scale.
|
|
5
|
+
*/
|
|
6
|
+
export declare function getDataIndexForOrdinalScaleValue(scale: D3OrdinalScale, value: number): number;
|
package/internals/invertScale.js
CHANGED
|
@@ -3,12 +3,21 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getDataIndexForOrdinalScaleValue = getDataIndexForOrdinalScaleValue;
|
|
6
7
|
exports.invertScale = invertScale;
|
|
7
8
|
var _scaleGuards = require("./scaleGuards");
|
|
8
9
|
function invertScale(scale, data, value) {
|
|
9
10
|
if ((0, _scaleGuards.isOrdinalScale)(scale)) {
|
|
10
|
-
const dataIndex =
|
|
11
|
+
const dataIndex = getDataIndexForOrdinalScaleValue(scale, value);
|
|
11
12
|
return data[dataIndex];
|
|
12
13
|
}
|
|
13
14
|
return scale.invert(value);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Get the data index for a given value on an ordinal scale.
|
|
19
|
+
*/
|
|
20
|
+
function getDataIndexForOrdinalScaleValue(scale, value) {
|
|
21
|
+
const dataIndex = scale.bandwidth() === 0 ? Math.floor((value - Math.min(...scale.range()) + scale.step() / 2) / scale.step()) : Math.floor((value - Math.min(...scale.range())) / scale.step());
|
|
22
|
+
return dataIndex;
|
|
14
23
|
}
|
|
@@ -7,7 +7,8 @@ import { type UseChartPolarAxisSignature } from "./featurePlugins/useChartPolarA
|
|
|
7
7
|
import { type UseChartClosestPointSignature } from "./featurePlugins/useChartClosestPoint/index.js";
|
|
8
8
|
import { type UseChartZAxisSignature } from "./featurePlugins/useChartZAxis/index.js";
|
|
9
9
|
import { type UseChartBrushSignature } from "./featurePlugins/useChartBrush/index.js";
|
|
10
|
+
import { type UseChartVisibilityManagerSignature } from "./featurePlugins/useChartVisibilityManager/index.js";
|
|
10
11
|
import { type UseChartTooltipSignature } from "./featurePlugins/useChartTooltip/index.js";
|
|
11
|
-
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
12
|
-
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<TSeries>, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
13
|
-
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartBrushSignature>, import("./models/index.js").ChartPlugin<UseChartTooltipSignature>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>];
|
|
12
|
+
export type AllPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<TSeries>, UseChartPolarAxisSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartVisibilityManagerSignature<TSeries>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
13
|
+
export type DefaultPluginSignatures<TSeries extends ChartSeriesType = ChartSeriesType> = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<TSeries>, UseChartHighlightSignature, UseChartVisibilityManagerSignature<TSeries>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
14
|
+
export declare const DEFAULT_PLUGINS: readonly [import("./models/index.js").ChartPlugin<UseChartZAxisSignature>, import("./models/index.js").ChartPlugin<UseChartBrushSignature>, import("./models/index.js").ChartPlugin<UseChartTooltipSignature>, import("./models/index.js").ChartPlugin<UseChartInteractionSignature>, import("./models/index.js").ChartPlugin<UseChartCartesianAxisSignature<any>>, import("./models/index.js").ChartPlugin<UseChartHighlightSignature>, import("./models/index.js").ChartPlugin<UseChartVisibilityManagerSignature<any>>, import("./models/index.js").ChartPlugin<UseChartClosestPointSignature>, import("./models/index.js").ChartPlugin<UseChartKeyboardNavigationSignature>];
|
|
@@ -11,7 +11,8 @@ var _useChartKeyboardNavigation = require("./featurePlugins/useChartKeyboardNavi
|
|
|
11
11
|
var _useChartClosestPoint = require("./featurePlugins/useChartClosestPoint");
|
|
12
12
|
var _useChartZAxis = require("./featurePlugins/useChartZAxis");
|
|
13
13
|
var _useChartBrush = require("./featurePlugins/useChartBrush");
|
|
14
|
+
var _useChartVisibilityManager = require("./featurePlugins/useChartVisibilityManager");
|
|
14
15
|
var _useChartTooltip = require("./featurePlugins/useChartTooltip");
|
|
15
16
|
// This file should be removed after creating all plugins in favor of a file per chart type.
|
|
16
17
|
|
|
17
|
-
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
|
18
|
+
const DEFAULT_PLUGINS = exports.DEFAULT_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartTooltip.useChartTooltip, _useChartInteraction.useChartInteraction, _useChartCartesianAxis.useChartCartesianAxis, _useChartHighlight.useChartHighlight, _useChartVisibilityManager.useChartVisibilityManager, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
2
|
+
import type { ChartSeriesConfig } from "../../models/index.js";
|
|
3
|
+
/**
|
|
4
|
+
* Serializes a series item identifier into a unique string using the appropriate serializer
|
|
5
|
+
* from the provided series configuration.
|
|
6
|
+
*
|
|
7
|
+
* @param {ChartSeriesConfig<ChartSeriesType>} seriesConfig - The configuration object for chart series.
|
|
8
|
+
* @param {SeriesItemIdentifier<ChartSeriesType>} identifier - The series item identifier to serialize.
|
|
9
|
+
* @returns {string} A unique string representation of the identifier.
|
|
10
|
+
* @throws Will throw an error if no serializer is found for the given series type.
|
|
11
|
+
*/
|
|
12
|
+
export declare const serializeIdentifier: <T extends ChartSeriesType, U extends {
|
|
13
|
+
type: T;
|
|
14
|
+
}>(seriesConfig: ChartSeriesConfig<T>, identifier: U) => string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.serializeIdentifier = void 0;
|
|
7
|
+
/**
|
|
8
|
+
* Serializes a series item identifier into a unique string using the appropriate serializer
|
|
9
|
+
* from the provided series configuration.
|
|
10
|
+
*
|
|
11
|
+
* @param {ChartSeriesConfig<ChartSeriesType>} seriesConfig - The configuration object for chart series.
|
|
12
|
+
* @param {SeriesItemIdentifier<ChartSeriesType>} identifier - The series item identifier to serialize.
|
|
13
|
+
* @returns {string} A unique string representation of the identifier.
|
|
14
|
+
* @throws Will throw an error if no serializer is found for the given series type.
|
|
15
|
+
*/
|
|
16
|
+
const serializeIdentifier = (seriesConfig, identifier) => {
|
|
17
|
+
const serializer = seriesConfig[identifier.type]?.identifierSerializer;
|
|
18
|
+
if (!serializer) {
|
|
19
|
+
throw new Error(`MUI X Charts: No identifier serializer found for series type "${identifier.type}".`);
|
|
20
|
+
}
|
|
21
|
+
// @ts-expect-error identifierSerializer expects the full object,
|
|
22
|
+
// but this function accepts a partial one in order be able to serialize all identifiers.
|
|
23
|
+
return serializer(identifier);
|
|
24
|
+
};
|
|
25
|
+
exports.serializeIdentifier = serializeIdentifier;
|
|
@@ -8,8 +8,10 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
8
8
|
exports.useChartSeries = void 0;
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var _useEffectAfterFirstRender = require("@mui/x-internals/useEffectAfterFirstRender");
|
|
11
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
11
12
|
var _colorPalettes = require("../../../../colorPalettes");
|
|
12
13
|
var _processSeries = require("./processSeries");
|
|
14
|
+
var _serializeIdentifier = require("./serializeIdentifier");
|
|
13
15
|
const useChartSeries = ({
|
|
14
16
|
params,
|
|
15
17
|
store,
|
|
@@ -34,7 +36,12 @@ const useChartSeries = ({
|
|
|
34
36
|
dataset
|
|
35
37
|
}));
|
|
36
38
|
}, [colors, dataset, series, theme, seriesConfig, store]);
|
|
37
|
-
|
|
39
|
+
const serializeIdentifier = (0, _useEventCallback.default)(identifier => (0, _serializeIdentifier.serializeIdentifier)(seriesConfig, identifier));
|
|
40
|
+
return {
|
|
41
|
+
instance: {
|
|
42
|
+
serializeIdentifier
|
|
43
|
+
}
|
|
44
|
+
};
|
|
38
45
|
};
|
|
39
46
|
exports.useChartSeries = useChartSeries;
|
|
40
47
|
useChartSeries.params = {
|
|
@@ -45,7 +45,18 @@ export interface UseChartSeriesState<T extends ChartSeriesType = ChartSeriesType
|
|
|
45
45
|
dataset?: Readonly<DatasetType>;
|
|
46
46
|
};
|
|
47
47
|
}
|
|
48
|
-
export
|
|
48
|
+
export type SerializeIdentifierFunction = <T extends {
|
|
49
|
+
type: ChartSeriesType;
|
|
50
|
+
}>(identifier: T) => string;
|
|
51
|
+
export interface UseChartSeriesInstance {
|
|
52
|
+
/**
|
|
53
|
+
* Function to serialize a series item identifier into a unique string.
|
|
54
|
+
*
|
|
55
|
+
* @param identifier The identifier to serialize.
|
|
56
|
+
* @returns A unique string representing the identifier.
|
|
57
|
+
*/
|
|
58
|
+
serializeIdentifier: SerializeIdentifierFunction;
|
|
59
|
+
}
|
|
49
60
|
export type UseChartSeriesSignature<SeriesType extends ChartSeriesType = ChartSeriesType> = ChartPluginSignature<{
|
|
50
61
|
params: UseChartSeriesParameters;
|
|
51
62
|
defaultizedParams: UseChartSeriesDefaultizedParameters<SeriesType>;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SeriesItemIdentifier } from "../../../../models/seriesType/index.js";
|
|
2
|
+
import { type UseChartHighlightSignature } from "../useChartHighlight/index.js";
|
|
3
|
+
import { type UseChartCartesianAxisSignature } from "../useChartCartesianAxis/index.js";
|
|
4
|
+
import { type ChartState } from "../../models/index.js";
|
|
5
|
+
/**
|
|
6
|
+
* Hook to get pointer interaction props for chart items.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useRegisterPointerInteractions(getItemAtPosition: (state: ChartState<[UseChartCartesianAxisSignature, UseChartHighlightSignature]>, point: {
|
|
9
|
+
x: number;
|
|
10
|
+
y: number;
|
|
11
|
+
}) => SeriesItemIdentifier | undefined, onItemEnter?: () => void, onItemLeave?: () => void): void;
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
'use client';
|
|
3
|
+
|
|
4
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
|
+
Object.defineProperty(exports, "__esModule", {
|
|
7
|
+
value: true
|
|
8
|
+
});
|
|
9
|
+
exports.useRegisterPointerInteractions = useRegisterPointerInteractions;
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _useEventCallback = _interopRequireDefault(require("@mui/utils/useEventCallback"));
|
|
12
|
+
var _hooks = require("../../../../hooks");
|
|
13
|
+
var _useStore = require("../../../store/useStore");
|
|
14
|
+
var _ChartProvider = require("../../../../context/ChartProvider");
|
|
15
|
+
var _getSVGPoint = require("../../../getSVGPoint");
|
|
16
|
+
/**
|
|
17
|
+
* Hook to get pointer interaction props for chart items.
|
|
18
|
+
*/
|
|
19
|
+
function useRegisterPointerInteractions(getItemAtPosition, onItemEnter, onItemLeave) {
|
|
20
|
+
const {
|
|
21
|
+
instance
|
|
22
|
+
} = (0, _ChartProvider.useChartContext)();
|
|
23
|
+
const svgRef = (0, _hooks.useSvgRef)();
|
|
24
|
+
const store = (0, _useStore.useStore)();
|
|
25
|
+
const interactionActive = React.useRef(false);
|
|
26
|
+
const lastItemRef = React.useRef(undefined);
|
|
27
|
+
const onItemEnterRef = (0, _useEventCallback.default)(() => onItemEnter?.());
|
|
28
|
+
const onItemLeaveRef = (0, _useEventCallback.default)(() => onItemLeave?.());
|
|
29
|
+
React.useEffect(() => {
|
|
30
|
+
const svg = svgRef.current;
|
|
31
|
+
if (!svg) {
|
|
32
|
+
return undefined;
|
|
33
|
+
}
|
|
34
|
+
function onPointerEnter() {
|
|
35
|
+
interactionActive.current = true;
|
|
36
|
+
}
|
|
37
|
+
function reset() {
|
|
38
|
+
const lastItem = lastItemRef.current;
|
|
39
|
+
if (lastItem) {
|
|
40
|
+
lastItemRef.current = undefined;
|
|
41
|
+
instance.removeTooltipItem(lastItem);
|
|
42
|
+
instance.clearHighlight();
|
|
43
|
+
onItemLeaveRef();
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
function onPointerLeave() {
|
|
47
|
+
interactionActive.current = false;
|
|
48
|
+
reset();
|
|
49
|
+
}
|
|
50
|
+
const onPointerMove = function onPointerMove(event) {
|
|
51
|
+
const svgPoint = (0, _getSVGPoint.getSVGPoint)(svg, event);
|
|
52
|
+
if (!instance.isPointInside(svgPoint.x, svgPoint.y)) {
|
|
53
|
+
reset();
|
|
54
|
+
return;
|
|
55
|
+
}
|
|
56
|
+
const item = getItemAtPosition(store.state, svgPoint);
|
|
57
|
+
if (item) {
|
|
58
|
+
instance.setLastUpdateSource('pointer');
|
|
59
|
+
instance.setTooltipItem(item);
|
|
60
|
+
instance.setHighlight(item);
|
|
61
|
+
onItemEnterRef();
|
|
62
|
+
lastItemRef.current = item;
|
|
63
|
+
} else {
|
|
64
|
+
reset();
|
|
65
|
+
}
|
|
66
|
+
};
|
|
67
|
+
svg.addEventListener('pointerleave', onPointerLeave);
|
|
68
|
+
svg.addEventListener('pointermove', onPointerMove);
|
|
69
|
+
svg.addEventListener('pointerenter', onPointerEnter);
|
|
70
|
+
return () => {
|
|
71
|
+
svg.removeEventListener('pointerenter', onPointerEnter);
|
|
72
|
+
svg.removeEventListener('pointermove', onPointerMove);
|
|
73
|
+
svg.removeEventListener('pointerleave', onPointerLeave);
|
|
74
|
+
|
|
75
|
+
/* Clean up state if this item is unmounted while active. */
|
|
76
|
+
if (interactionActive.current) {
|
|
77
|
+
onPointerLeave();
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
}, [getItemAtPosition, instance, onItemEnterRef, onItemLeaveRef, store, svgRef]);
|
|
81
|
+
}
|
|
@@ -20,6 +20,16 @@ reverse) {
|
|
|
20
20
|
const range = axisDirection === 'x' ? [drawingArea.left, drawingArea.left + drawingArea.width] : [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
21
21
|
return reverse ? [range[1], range[0]] : range;
|
|
22
22
|
}
|
|
23
|
+
function shouldIgnoreGapRatios(scale, categoryGapRatio) {
|
|
24
|
+
const step = scale.step();
|
|
25
|
+
const paddingPx = step * categoryGapRatio;
|
|
26
|
+
|
|
27
|
+
/* If the padding is less than 0.1px, we consider it negligible and ignore it.
|
|
28
|
+
* This prevents issues where very small gaps cause rendering artifacts or unexpected layouts.
|
|
29
|
+
* A threshold of 0.1px is chosen as it's generally below the perceptible limit for most displays.
|
|
30
|
+
*/
|
|
31
|
+
return paddingPx < 0.1;
|
|
32
|
+
}
|
|
23
33
|
const DEFAULT_CATEGORY_GAP_RATIO = 0.2;
|
|
24
34
|
const DEFAULT_BAR_GAP_RATIO = 0.1;
|
|
25
35
|
function computeAxisValue({
|
|
@@ -54,8 +64,10 @@ function computeAxisValue({
|
|
|
54
64
|
// Reverse range because ordinal scales are presented from top to bottom on y-axis
|
|
55
65
|
const scaleRange = axisDirection === 'y' ? [range[1], range[0]] : range;
|
|
56
66
|
if ((0, _scaleGuards.isBandScale)(scale) && (0, _axis.isBandScaleConfig)(axis)) {
|
|
57
|
-
const
|
|
58
|
-
const
|
|
67
|
+
const desiredCategoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
68
|
+
const ignoreGapRatios = shouldIgnoreGapRatios(scale, desiredCategoryGapRatio);
|
|
69
|
+
const categoryGapRatio = ignoreGapRatios ? 0 : desiredCategoryGapRatio;
|
|
70
|
+
const barGapRatio = ignoreGapRatios ? 0 : axis.barGapRatio ?? DEFAULT_BAR_GAP_RATIO;
|
|
59
71
|
completeAxis[axis.id] = (0, _extends2.default)({
|
|
60
72
|
offset: 0,
|
|
61
73
|
height: 0,
|
|
@@ -64,7 +76,12 @@ function computeAxisValue({
|
|
|
64
76
|
triggerTooltip
|
|
65
77
|
}, axis, {
|
|
66
78
|
data,
|
|
67
|
-
|
|
79
|
+
/* Doing this here is technically wrong, but acceptable in practice.
|
|
80
|
+
* In theory, this should be done in the normalized scale selector, but then we'd need that selector to depend
|
|
81
|
+
* on the zoom range, which would void its goal (which is to be independent of zoom).
|
|
82
|
+
* Since we only ignore gap ratios when they're practically invisible, the small errors caused by this
|
|
83
|
+
* discrepancy will hopefully not be noticeable. */
|
|
84
|
+
scale: ignoreGapRatios ? scale.copy().padding(0) : scale,
|
|
68
85
|
tickNumber,
|
|
69
86
|
colorScale: axis.colorMap && (axis.colorMap.type === 'ordinal' ? (0, _colorScale.getOrdinalColorScale)((0, _extends2.default)({
|
|
70
87
|
values: axis.data
|
|
@@ -23,6 +23,7 @@ var _getSVGPoint = require("../../../getSVGPoint");
|
|
|
23
23
|
var _useChartInteraction = require("../useChartInteraction");
|
|
24
24
|
var _useChartCartesianInteraction = require("./useChartCartesianInteraction.selectors");
|
|
25
25
|
var _checkHasInteractionPlugin = require("../useChartInteraction/checkHasInteractionPlugin");
|
|
26
|
+
const AXIS_CLICK_SERIES_TYPES = new Set(['bar', 'rangeBar', 'line']);
|
|
26
27
|
const useChartCartesianAxis = ({
|
|
27
28
|
params,
|
|
28
29
|
store,
|
|
@@ -172,13 +173,19 @@ const useChartCartesianAxis = ({
|
|
|
172
173
|
// The .data exist because otherwise the dataIndex would be null or -1.
|
|
173
174
|
const axisValue = (isXAxis ? xAxisWithScale : yAxisWithScale)[USED_AXIS_ID].data[dataIndex];
|
|
174
175
|
const seriesValues = {};
|
|
175
|
-
Object.keys(processedSeries).filter(seriesType =>
|
|
176
|
-
|
|
177
|
-
|
|
176
|
+
Object.keys(processedSeries).filter(seriesType => AXIS_CLICK_SERIES_TYPES.has(seriesType)).forEach(seriesType => {
|
|
177
|
+
// @ts-ignore
|
|
178
|
+
const seriesTypeConfig = processedSeries[seriesType];
|
|
179
|
+
seriesTypeConfig?.seriesOrder.forEach(seriesId => {
|
|
180
|
+
const seriesItem = seriesTypeConfig.series[seriesId];
|
|
178
181
|
const providedXAxisId = seriesItem.xAxisId;
|
|
179
182
|
const providedYAxisId = seriesItem.yAxisId;
|
|
180
183
|
const axisKey = isXAxis ? providedXAxisId : providedYAxisId;
|
|
181
184
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
185
|
+
// @ts-ignore This is safe because users need to opt in to use range bar series.
|
|
186
|
+
// In that case, they should import the module augmentation from `x-charts-pro/moduleAugmentation/rangeBarOnClick`
|
|
187
|
+
// Which adds the proper type to the series data.
|
|
188
|
+
// TODO(v9): Remove this ts-ignore when we can make the breaking change to ChartsAxisData.
|
|
182
189
|
seriesValues[seriesId] = seriesItem.data[dataIndex];
|
|
183
190
|
}
|
|
184
191
|
});
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type BarItemIdentifier } from "../../../../models/index.js";
|
|
2
|
+
export declare const selectorBarItemAtPosition: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
3
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
4
|
+
}, svgPoint: Pick<DOMPoint, "x" | "y">) => BarItemIdentifier | undefined;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.selectorBarItemAtPosition = void 0;
|
|
7
|
+
var _store = require("@mui/x-internals/store");
|
|
8
|
+
var _useChartCartesianAxisRendering = require("./useChartCartesianAxisRendering.selectors");
|
|
9
|
+
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
10
|
+
var _getBandSize = require("../../../../internals/getBandSize");
|
|
11
|
+
var _scaleGuards = require("../../../../internals/scaleGuards");
|
|
12
|
+
var _invertScale = require("../../../../internals/invertScale");
|
|
13
|
+
const selectorBarItemAtPosition = exports.selectorBarItemAtPosition = (0, _store.createSelector)(_useChartCartesianAxisRendering.selectorChartXAxis, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartSeries.selectorChartSeriesProcessed, function selectorBarItemAtPosition({
|
|
14
|
+
axis: xAxes,
|
|
15
|
+
axisIds: xAxisIds
|
|
16
|
+
}, {
|
|
17
|
+
axis: yAxes,
|
|
18
|
+
axisIds: yAxisIds
|
|
19
|
+
}, processedSeries, svgPoint) {
|
|
20
|
+
const {
|
|
21
|
+
series,
|
|
22
|
+
stackingGroups = []
|
|
23
|
+
} = processedSeries?.bar ?? {};
|
|
24
|
+
const defaultXAxisId = xAxisIds[0];
|
|
25
|
+
const defaultYAxisId = yAxisIds[0];
|
|
26
|
+
let item = undefined;
|
|
27
|
+
for (let stackIndex = 0; stackIndex < stackingGroups.length; stackIndex += 1) {
|
|
28
|
+
const group = stackingGroups[stackIndex];
|
|
29
|
+
const seriesIds = group.ids;
|
|
30
|
+
for (const seriesId of seriesIds) {
|
|
31
|
+
const aSeries = (series ?? {})[seriesId];
|
|
32
|
+
const xAxisId = aSeries.xAxisId ?? defaultXAxisId;
|
|
33
|
+
const yAxisId = aSeries.yAxisId ?? defaultYAxisId;
|
|
34
|
+
const xAxis = xAxes[xAxisId];
|
|
35
|
+
const yAxis = yAxes[yAxisId];
|
|
36
|
+
const bandAxis = aSeries.layout === 'horizontal' ? yAxis : xAxis;
|
|
37
|
+
const continuousAxis = aSeries.layout === 'horizontal' ? xAxis : yAxis;
|
|
38
|
+
const bandScale = bandAxis.scale;
|
|
39
|
+
const svgPointBandCoordinate = aSeries.layout === 'horizontal' ? svgPoint.y : svgPoint.x;
|
|
40
|
+
if (!(0, _scaleGuards.isBandScale)(bandScale)) {
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
const dataIndex = (0, _invertScale.getDataIndexForOrdinalScaleValue)(bandScale, svgPointBandCoordinate);
|
|
44
|
+
const {
|
|
45
|
+
barWidth,
|
|
46
|
+
offset
|
|
47
|
+
} = (0, _getBandSize.getBandSize)(bandScale.bandwidth(), stackingGroups.length, bandAxis.barGapRatio);
|
|
48
|
+
const barOffset = stackIndex * (barWidth + offset);
|
|
49
|
+
const bandValue = bandAxis.data?.[dataIndex];
|
|
50
|
+
if (bandValue == null) {
|
|
51
|
+
continue;
|
|
52
|
+
}
|
|
53
|
+
const bandStart = bandScale(bandValue);
|
|
54
|
+
if (bandStart == null) {
|
|
55
|
+
continue;
|
|
56
|
+
}
|
|
57
|
+
const bandBarStart = bandStart + barOffset;
|
|
58
|
+
const bandBarEnd = bandBarStart + barWidth;
|
|
59
|
+
const bandBarMin = Math.min(bandBarStart, bandBarEnd);
|
|
60
|
+
const bandBarMax = Math.max(bandBarStart, bandBarEnd);
|
|
61
|
+
if (svgPointBandCoordinate >= bandBarMin && svgPointBandCoordinate <= bandBarMax) {
|
|
62
|
+
// The point is inside the band for this series
|
|
63
|
+
const svgPointContinuousCoordinate = aSeries.layout === 'horizontal' ? svgPoint.x : svgPoint.y;
|
|
64
|
+
const bar = aSeries.stackedData[dataIndex];
|
|
65
|
+
const start = continuousAxis.scale(bar[0]);
|
|
66
|
+
const end = continuousAxis.scale(bar[1]);
|
|
67
|
+
if (start == null || end == null) {
|
|
68
|
+
continue;
|
|
69
|
+
}
|
|
70
|
+
const continuousMin = Math.min(start, end);
|
|
71
|
+
const continuousMax = Math.max(start, end);
|
|
72
|
+
if (svgPointContinuousCoordinate >= continuousMin && svgPointContinuousCoordinate <= continuousMax) {
|
|
73
|
+
item = {
|
|
74
|
+
seriesId,
|
|
75
|
+
dataIndex
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
if (item) {
|
|
82
|
+
return {
|
|
83
|
+
type: 'bar',
|
|
84
|
+
seriesId: item.seriesId,
|
|
85
|
+
dataIndex: item.dataIndex
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
return undefined;
|
|
89
|
+
});
|
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/keyboardFocusHandler.types.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
2
|
+
import type { FocusedItemIdentifier } from "../../../../models/seriesType/index.js";
|
|
3
|
+
import type { UseChartKeyboardNavigationSignature } from "./useChartKeyboardNavigation.types.js";
|
|
4
|
+
import type { ChartState } from "../../models/chart.js";
|
|
5
|
+
export type FocusedItemUpdater<TSeriesType extends ChartSeriesType, OutputSeriesType extends ChartSeriesType = ChartSeriesType> = (currentItem: (TSeriesType extends any ? FocusedItemIdentifier<TSeriesType> : never) | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => FocusedItemIdentifier<OutputSeriesType> | null;
|
|
6
|
+
/**
|
|
7
|
+
* Get the next focusable item in the chart.
|
|
8
|
+
* @param {SeriesItemIdentifier<TSeriesType> | null} currentItem The current focused item.
|
|
9
|
+
* @param {KeyboardEvent} event The keyboard event that triggered the navigation.
|
|
10
|
+
* @param {ChartState<[UseChartKeyboardNavigationSignature], []>} state The current chart state.
|
|
11
|
+
* @returns {SeriesItemIdentifier<ChartSeriesType> | null} The next focusable item or null if none found.
|
|
12
|
+
*/
|
|
13
|
+
export type KeyboardFocusHandler<TSeriesType extends ChartSeriesType, OutputSeriesType extends ChartSeriesType = ChartSeriesType> = (event: KeyboardEvent) => FocusedItemUpdater<TSeriesType, OutputSeriesType> | null;
|
package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { ChartPlugin } from "../../models/index.js";
|
|
2
|
+
import type { UseChartKeyboardNavigationSignature } from "./useChartKeyboardNavigation.types.js";
|
|
3
3
|
export declare const useChartKeyboardNavigation: ChartPlugin<UseChartKeyboardNavigationSignature>;
|