@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,47 @@
|
|
|
1
|
+
// Adapted from D3.js's offsetDiverging function https://github.com/d3/d3-shape/blob/main/src/offset/diverging.js
|
|
2
|
+
// Hidden series (with all zero values) affect the stacking in a different way in our implementation compared to the D3 behavior.
|
|
3
|
+
// The D3 stacking keep those values at the 0 "line", which creates issues when animating between hidden and visible states.
|
|
4
|
+
// In our modification, we stack them on top/below already stacked items according to the sign of their original value.
|
|
5
|
+
// A hidden negative value will be placed below all the already stacked negative values
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Positive values are stacked above zero, while negative values are stacked below zero.
|
|
9
|
+
*
|
|
10
|
+
* @param series A series generated by a stack generator.
|
|
11
|
+
* @param order An array of numeric indexes representing the stack order.
|
|
12
|
+
*/
|
|
13
|
+
export function offsetDiverging(series, order) {
|
|
14
|
+
if (series.length === 0) {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
const seriesCount = series.length;
|
|
18
|
+
const numericOrder = order;
|
|
19
|
+
const pointCount = series[numericOrder[0]].length;
|
|
20
|
+
for (let pointIndex = 0; pointIndex < pointCount; pointIndex += 1) {
|
|
21
|
+
let positiveSum = 0;
|
|
22
|
+
let negativeSum = 0;
|
|
23
|
+
for (let seriesIndex = 0; seriesIndex < seriesCount; seriesIndex += 1) {
|
|
24
|
+
const currentSeries = series[numericOrder[seriesIndex]];
|
|
25
|
+
const dataPoint = currentSeries[pointIndex];
|
|
26
|
+
const difference = dataPoint[1] - dataPoint[0];
|
|
27
|
+
if (difference > 0) {
|
|
28
|
+
dataPoint[0] = positiveSum;
|
|
29
|
+
positiveSum += difference;
|
|
30
|
+
dataPoint[1] = positiveSum;
|
|
31
|
+
} else if (difference < 0) {
|
|
32
|
+
dataPoint[1] = negativeSum;
|
|
33
|
+
negativeSum += difference;
|
|
34
|
+
dataPoint[0] = negativeSum;
|
|
35
|
+
} else if (dataPoint.data[currentSeries.key] > 0) {
|
|
36
|
+
dataPoint[0] = positiveSum;
|
|
37
|
+
dataPoint[1] = positiveSum;
|
|
38
|
+
} else if (dataPoint.data[currentSeries.key] < 0) {
|
|
39
|
+
dataPoint[1] = negativeSum;
|
|
40
|
+
dataPoint[0] = negativeSum;
|
|
41
|
+
} else {
|
|
42
|
+
dataPoint[0] = 0;
|
|
43
|
+
dataPoint[1] = 0;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import type { StackOffsetType, StackOrderType } from "
|
|
3
|
-
import { type SeriesId, type StackableSeriesType } from "
|
|
1
|
+
import { stackOrderNone as d3StackOrderNone, stackOrderReverse as d3StackOrderReverse, stackOrderAppearance as d3OrderAppearance, stackOrderAscending as d3OrderAscending, stackOrderDescending as d3OrderDescending, stackOrderInsideOut as d3OrderInsideOut, stackOffsetExpand as d3StackOffsetExpand, stackOffsetNone as d3StackOffsetNone, stackOffsetSilhouette as d3StackOffsetSilhouette, stackOffsetWiggle as d3StackOffsetWiggle, type Series } from '@mui/x-charts-vendor/d3-shape';
|
|
2
|
+
import type { StackOffsetType, StackOrderType } from "../../models/stacking.js";
|
|
3
|
+
import { type SeriesId, type StackableSeriesType } from "../../models/seriesType/common.js";
|
|
4
4
|
type FormatterParams<T> = {
|
|
5
5
|
series: Record<SeriesId, T>;
|
|
6
6
|
seriesOrder: SeriesId[];
|
|
@@ -18,19 +18,19 @@ export declare const StackOrder: {
|
|
|
18
18
|
/**
|
|
19
19
|
* Series order such that the earliest series (according to the maximum value) is at the bottom.
|
|
20
20
|
* */
|
|
21
|
-
appearance: typeof
|
|
21
|
+
appearance: typeof d3OrderAppearance;
|
|
22
22
|
/**
|
|
23
23
|
* Series order such that the smallest series (according to the sum of values) is at the bottom.
|
|
24
24
|
* */
|
|
25
|
-
ascending: typeof
|
|
25
|
+
ascending: typeof d3OrderAscending;
|
|
26
26
|
/**
|
|
27
27
|
* Series order such that the largest series (according to the sum of values) is at the bottom.
|
|
28
28
|
*/
|
|
29
|
-
descending: typeof
|
|
29
|
+
descending: typeof d3OrderDescending;
|
|
30
30
|
/**
|
|
31
31
|
* Series order such that the earliest series (according to the maximum value) are on the inside and the later series are on the outside. This order is recommended for streamgraphs in conjunction with the wiggle offset. See Stacked Graphs—Geometry & Aesthetics by Byron & Wattenberg for more information.
|
|
32
32
|
*/
|
|
33
|
-
insideOut: typeof
|
|
33
|
+
insideOut: typeof d3OrderInsideOut;
|
|
34
34
|
/**
|
|
35
35
|
* Given series order [0, 1, … n - 1] where n is the number of elements in series. Thus, the stack order is given by the key accessor.
|
|
36
36
|
*/
|
|
@@ -48,7 +48,7 @@ export declare const StackOffset: {
|
|
|
48
48
|
/**
|
|
49
49
|
* Positive values are stacked above zero, negative values are stacked below zero, and zero values are stacked at zero.
|
|
50
50
|
* */
|
|
51
|
-
diverging:
|
|
51
|
+
diverging: (series: Series<any, any>, order: Iterable<number>) => void;
|
|
52
52
|
/**
|
|
53
53
|
* Applies a zero baseline.
|
|
54
54
|
* */
|
|
@@ -1,21 +1,22 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { stackOrderNone as d3StackOrderNone, stackOrderReverse as d3StackOrderReverse, stackOrderAppearance as d3OrderAppearance, stackOrderAscending as d3OrderAscending, stackOrderDescending as d3OrderDescending, stackOrderInsideOut as d3OrderInsideOut, stackOffsetExpand as d3StackOffsetExpand, stackOffsetNone as d3StackOffsetNone, stackOffsetSilhouette as d3StackOffsetSilhouette, stackOffsetWiggle as d3StackOffsetWiggle } from '@mui/x-charts-vendor/d3-shape';
|
|
2
|
+
import { offsetDiverging } from "./offset/index.js";
|
|
2
3
|
export const StackOrder = {
|
|
3
4
|
/**
|
|
4
5
|
* Series order such that the earliest series (according to the maximum value) is at the bottom.
|
|
5
6
|
* */
|
|
6
|
-
appearance:
|
|
7
|
+
appearance: d3OrderAppearance,
|
|
7
8
|
/**
|
|
8
9
|
* Series order such that the smallest series (according to the sum of values) is at the bottom.
|
|
9
10
|
* */
|
|
10
|
-
ascending:
|
|
11
|
+
ascending: d3OrderAscending,
|
|
11
12
|
/**
|
|
12
13
|
* Series order such that the largest series (according to the sum of values) is at the bottom.
|
|
13
14
|
*/
|
|
14
|
-
descending:
|
|
15
|
+
descending: d3OrderDescending,
|
|
15
16
|
/**
|
|
16
17
|
* Series order such that the earliest series (according to the maximum value) are on the inside and the later series are on the outside. This order is recommended for streamgraphs in conjunction with the wiggle offset. See Stacked Graphs—Geometry & Aesthetics by Byron & Wattenberg for more information.
|
|
17
18
|
*/
|
|
18
|
-
insideOut:
|
|
19
|
+
insideOut: d3OrderInsideOut,
|
|
19
20
|
/**
|
|
20
21
|
* Given series order [0, 1, … n - 1] where n is the number of elements in series. Thus, the stack order is given by the key accessor.
|
|
21
22
|
*/
|
|
@@ -33,7 +34,8 @@ export const StackOffset = {
|
|
|
33
34
|
/**
|
|
34
35
|
* Positive values are stacked above zero, negative values are stacked below zero, and zero values are stacked at zero.
|
|
35
36
|
* */
|
|
36
|
-
|
|
37
|
+
// @ts-expect-error, d3 types are wrong, our custom function implements the correct signature
|
|
38
|
+
diverging: offsetDiverging,
|
|
37
39
|
/**
|
|
38
40
|
* Applies a zero baseline.
|
|
39
41
|
* */
|
package/esm/models/axis.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import type { ScaleBand, ScaleLinear, ScaleLogarithmic, ScaleOrdinal, ScalePoint, ScalePower, ScaleSequential, ScaleThreshold, ScaleTime, ScaleSymLog, NumberValue } from '@mui/x-charts-vendor/d3-scale';
|
|
2
2
|
import { type SxProps } from '@mui/system/styleFunctionSx';
|
|
3
|
-
import { type MakeOptional, type MakeRequired } from '@mui/x-internals/types';
|
|
3
|
+
import { type HasProperty, type MakeOptional, type MakeRequired } from '@mui/x-internals/types';
|
|
4
4
|
import type { DefaultizedZoomOptions } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
5
5
|
import { type ChartsAxisClasses } from "../ChartsAxis/axisClasses.js";
|
|
6
6
|
import type { TickParams } from "../hooks/useTicks.js";
|
|
7
7
|
import type { ChartsTextProps } from "../ChartsText/index.js";
|
|
8
8
|
import type { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from "./colorMapping.js";
|
|
9
9
|
import type { OrdinalTimeTicks } from "./timeTicks.js";
|
|
10
|
+
import { type ChartsTypeFeatureFlags } from "./featureFlags.js";
|
|
10
11
|
export type AxisId = string | number;
|
|
11
12
|
export type D3Scale<Domain extends {
|
|
12
13
|
toString(): string;
|
|
@@ -133,7 +134,7 @@ type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends Chart
|
|
|
133
134
|
position?: 'top' | 'bottom' | 'none';
|
|
134
135
|
/**
|
|
135
136
|
* The height of the axis.
|
|
136
|
-
* @default
|
|
137
|
+
* @default 45 if an axis label is provided, 25 otherwise.
|
|
137
138
|
*/
|
|
138
139
|
height?: number;
|
|
139
140
|
} : AxisProps extends ChartsYAxisProps ? {
|
|
@@ -149,7 +150,7 @@ type AxisSideConfig<AxisProps extends ChartsAxisProps> = AxisProps extends Chart
|
|
|
149
150
|
position?: 'left' | 'right' | 'none';
|
|
150
151
|
/**
|
|
151
152
|
* The width of the axis.
|
|
152
|
-
* @default
|
|
153
|
+
* @default 65 if an axis label is provided, 45 otherwise.
|
|
153
154
|
*/
|
|
154
155
|
width?: number;
|
|
155
156
|
} : {
|
|
@@ -521,7 +522,7 @@ export interface ChartsAxisData {
|
|
|
521
522
|
/**
|
|
522
523
|
* The mapping of series ids to their value for this particular axis index.
|
|
523
524
|
*/
|
|
524
|
-
seriesValues: Record<string, number | null | undefined>;
|
|
525
|
+
seriesValues: Record<string, HasProperty<ChartsTypeFeatureFlags, 'seriesValueOverride'> extends true ? ChartsTypeFeatureFlags['seriesValuesOverride'] : number | null | undefined>;
|
|
525
526
|
}
|
|
526
527
|
export type CartesianDirection = 'x' | 'y';
|
|
527
528
|
export type PolarDirection = 'rotation' | 'radius';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export interface ChartsTypeFeatureFlags {}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/esm/models/index.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from "./seriesType/index.js";
|
|
2
2
|
export * from "./stacking.js";
|
|
3
3
|
export * from "./slots/index.js";
|
|
4
|
+
export * from "./featureFlags.js";
|
|
4
5
|
export type { AxisConfig, ChartsYAxisProps, ChartsXAxisProps, ScaleName, ContinuousScaleName, ChartsAxisData, XAxis, YAxis, RadiusAxis, RotationAxis, AxisItemIdentifier, AxisValueFormatterContext } from "./axis.js";
|
|
5
6
|
export type { PropsFromSlot } from '@mui/x-internals/slots';
|
|
6
7
|
export type { Position } from "./position.js";
|
package/esm/models/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { DefaultizedProps } from '@mui/x-internals/types';
|
|
2
|
+
import type { BarSeriesType, DefaultizedBarSeriesType } from "./bar.js";
|
|
2
3
|
import { type CartesianChartSeriesType, type ChartSeriesType, type ChartsSeriesConfig, type StackableChartSeriesType } from "./config.js";
|
|
3
4
|
type AllSeriesType<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['seriesProp'];
|
|
4
5
|
/**
|
|
@@ -19,6 +20,7 @@ type DefaultizedCartesianSeriesType = DefaultizedSeriesType<CartesianChartSeries
|
|
|
19
20
|
type StackableSeriesType = DefaultizedSeriesType<StackableChartSeriesType>;
|
|
20
21
|
export type SeriesItemIdentifier<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
|
|
21
22
|
export type SeriesItemIdentifierWithData<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifierWithData'];
|
|
23
|
+
export type FocusedItemIdentifier<T extends ChartSeriesType = ChartSeriesType> = T extends 'line' ? DefaultizedProps<ChartsSeriesConfig[T]['itemIdentifier'], 'dataIndex'> : ChartsSeriesConfig[T]['itemIdentifier'];
|
|
22
24
|
export { type SeriesId } from "./common.js";
|
|
23
25
|
export * from "./line.js";
|
|
24
26
|
export * from "./bar.js";
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
import type { BarItemIdentifier } from "../models/index.js";
|
|
3
|
+
declare module '@mui/x-charts/BarChart' {
|
|
4
|
+
interface BarPlotProps {
|
|
5
|
+
/**
|
|
6
|
+
* Callback fired when a bar item is clicked.
|
|
7
|
+
* @param {MouseEvent | React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
8
|
+
* It is a native MouseEvent for `svg-batch` renderer and a React MouseEvent for `svg-single` renderer.
|
|
9
|
+
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
10
|
+
*/
|
|
11
|
+
onItemClick?(event: MouseEvent | React.MouseEvent<SVGElement, MouseEvent>, barItemIdentifier: BarItemIdentifier): void;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,15 +1,4 @@
|
|
|
1
|
-
import { type ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
-
import { type SeriesId } from "../models/seriesType/common.js";
|
|
3
|
-
export type FocusedItemData = {
|
|
4
|
-
seriesType: ChartSeriesType;
|
|
5
|
-
seriesId: SeriesId;
|
|
6
|
-
dataIndex: number;
|
|
7
|
-
};
|
|
8
1
|
/**
|
|
9
2
|
* Get the focused item from keyboard navigation.
|
|
10
3
|
*/
|
|
11
|
-
export declare function useFocusedItem():
|
|
12
|
-
seriesType: "line" | "bar" | "scatter" | "pie";
|
|
13
|
-
seriesId: SeriesId;
|
|
14
|
-
dataIndex: number;
|
|
15
|
-
} | null;
|
|
4
|
+
export declare function useFocusedItem(): import("../index.js").FocusedItemIdentifier<keyof import("../internals/index.js").ChartsSeriesConfig> | null;
|
package/hooks/useFocusedItem.js
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.useFocusedItem = useFocusedItem;
|
|
9
|
-
var React = _interopRequireWildcard(require("react"));
|
|
10
8
|
var _useStore = require("../internals/store/useStore");
|
|
11
9
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
12
10
|
/**
|
|
@@ -14,12 +12,5 @@ var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/u
|
|
|
14
12
|
*/
|
|
15
13
|
function useFocusedItem() {
|
|
16
14
|
const store = (0, _useStore.useStore)();
|
|
17
|
-
|
|
18
|
-
const focusedSeriesId = store.use(_useChartKeyboardNavigation.selectorChartsFocusedSeriesId);
|
|
19
|
-
const focusedDataIndex = store.use(_useChartKeyboardNavigation.selectorChartsFocusedDataIndex);
|
|
20
|
-
return React.useMemo(() => focusedSeriesType === undefined || focusedSeriesId === undefined || focusedDataIndex === undefined ? null : {
|
|
21
|
-
seriesType: focusedSeriesType,
|
|
22
|
-
seriesId: focusedSeriesId,
|
|
23
|
-
dataIndex: focusedDataIndex
|
|
24
|
-
}, [focusedSeriesType, focusedSeriesId, focusedDataIndex]);
|
|
15
|
+
return store.use(_useChartKeyboardNavigation.selectorChartsFocusedItem);
|
|
25
16
|
}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
type
|
|
1
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
|
+
import type { FocusedItemIdentifier } from "../models/seriesType/index.js";
|
|
3
|
+
type UseItemFocusedParams = FocusedItemIdentifier<ChartSeriesType>;
|
|
3
4
|
/**
|
|
4
5
|
* A hook to check if an item has the focus.
|
|
5
6
|
*
|
|
6
7
|
* If you need to process multiple points, use the `useIsItemFocusedGetter` hook instead.
|
|
7
8
|
*
|
|
8
|
-
* @param {
|
|
9
|
+
* @param {FocusedItemIdentifier} item is the item to check
|
|
9
10
|
* @returns {boolean} the focus state
|
|
10
11
|
*/
|
|
11
12
|
export declare function useIsItemFocused(item: UseItemFocusedParams): boolean;
|
|
@@ -12,7 +12,7 @@ var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/u
|
|
|
12
12
|
*
|
|
13
13
|
* If you need to process multiple points, use the `useIsItemFocusedGetter` hook instead.
|
|
14
14
|
*
|
|
15
|
-
* @param {
|
|
15
|
+
* @param {FocusedItemIdentifier} item is the item to check
|
|
16
16
|
* @returns {boolean} the focus state
|
|
17
17
|
*/
|
|
18
18
|
function useIsItemFocused(item) {
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FocusedItemIdentifier } from "../models/seriesType/index.js";
|
|
2
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
2
3
|
/**
|
|
3
4
|
* A hook to check focus state of multiple items.
|
|
4
5
|
* If you're interested by a single one, consider using `useIsItemFocused`.
|
|
5
6
|
*
|
|
6
7
|
* @returns {(item: FocusedItemData) => boolean} callback to get the state of the item.
|
|
7
8
|
*/
|
|
8
|
-
export declare function useIsItemFocusedGetter(): (item:
|
|
9
|
+
export declare function useIsItemFocusedGetter(): (item: FocusedItemIdentifier<ChartSeriesType>) => boolean;
|
|
@@ -5,6 +5,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
7
|
exports.useIsItemFocusedGetter = useIsItemFocusedGetter;
|
|
8
|
+
var _fastObjectShallowCompare = require("@mui/x-internals/fastObjectShallowCompare");
|
|
8
9
|
var _useFocusedItem = require("./useFocusedItem");
|
|
9
10
|
/**
|
|
10
11
|
* A hook to check focus state of multiple items.
|
|
@@ -14,5 +15,5 @@ var _useFocusedItem = require("./useFocusedItem");
|
|
|
14
15
|
*/
|
|
15
16
|
function useIsItemFocusedGetter() {
|
|
16
17
|
const focusedItem = (0, _useFocusedItem.useFocusedItem)();
|
|
17
|
-
return item => focusedItem !== null &&
|
|
18
|
+
return item => focusedItem !== null && (0, _fastObjectShallowCompare.fastObjectShallowCompare)(focusedItem, item);
|
|
18
19
|
}
|
package/index.js
CHANGED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Given a map of arrays, appends a value to the array at the given key.
|
|
3
|
+
* If no array exists at that key, one is created and the value appended.
|
|
4
|
+
* @param map Map of arrays
|
|
5
|
+
* @param key Key to append the value at
|
|
6
|
+
* @param value Value to append
|
|
7
|
+
*/
|
|
8
|
+
export declare function appendAtKey<K, V>(map: Map<K, V[]>, key: K, value: V): V[];
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.appendAtKey = appendAtKey;
|
|
7
|
+
/**
|
|
8
|
+
* Given a map of arrays, appends a value to the array at the given key.
|
|
9
|
+
* If no array exists at that key, one is created and the value appended.
|
|
10
|
+
* @param map Map of arrays
|
|
11
|
+
* @param key Key to append the value at
|
|
12
|
+
* @param value Value to append
|
|
13
|
+
*/
|
|
14
|
+
function appendAtKey(map, key, value) {
|
|
15
|
+
let bucket = map.get(key);
|
|
16
|
+
if (!bucket) {
|
|
17
|
+
bucket = [value];
|
|
18
|
+
map.set(key, bucket);
|
|
19
|
+
} else {
|
|
20
|
+
bucket.push(value);
|
|
21
|
+
}
|
|
22
|
+
return bucket;
|
|
23
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { UseChartKeyboardNavigationSignature } from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
2
|
+
import type { ChartState } from "./plugins/models/chart.js";
|
|
3
|
+
import type { ChartSeriesType } from "../models/seriesType/config.js";
|
|
4
|
+
import type { FocusedItemIdentifier, SeriesId, SeriesItemIdentifier } from "../models/seriesType/index.js";
|
|
5
|
+
type ReturnedItem<OutSeriesType extends ChartSeriesType> = {
|
|
6
|
+
type: OutSeriesType;
|
|
7
|
+
seriesId: SeriesId;
|
|
8
|
+
dataIndex: number;
|
|
9
|
+
} | null;
|
|
10
|
+
export declare function createGetNextIndexFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: FocusedItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
|
|
11
|
+
export declare function createGetPreviousIndexFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
|
|
12
|
+
export declare function createGetNextSeriesFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
|
|
13
|
+
export declare function createGetPreviousSeriesFocusedItem<InSeriesType extends Exclude<ChartSeriesType, 'sankey'>, OutSeriesType extends Exclude<ChartSeriesType, 'sankey'> = InSeriesType>(compatibleSeriesTypes: Set<OutSeriesType>): (currentItem: SeriesItemIdentifier<InSeriesType> | null, state: ChartState<[UseChartKeyboardNavigationSignature], []>) => ReturnedItem<OutSeriesType>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.createGetNextIndexFocusedItem = createGetNextIndexFocusedItem;
|
|
7
|
+
exports.createGetNextSeriesFocusedItem = createGetNextSeriesFocusedItem;
|
|
8
|
+
exports.createGetPreviousIndexFocusedItem = createGetPreviousIndexFocusedItem;
|
|
9
|
+
exports.createGetPreviousSeriesFocusedItem = createGetPreviousSeriesFocusedItem;
|
|
10
|
+
var _getPreviousNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries");
|
|
11
|
+
var _getMaxSeriesLength = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength");
|
|
12
|
+
var _useChartSeries = require("./plugins/corePlugins/useChartSeries");
|
|
13
|
+
var _getNextNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries");
|
|
14
|
+
var _seriesHasData = require("./seriesHasData");
|
|
15
|
+
function createGetNextIndexFocusedItem(compatibleSeriesTypes) {
|
|
16
|
+
return function getNextIndexFocusedItem(currentItem, state) {
|
|
17
|
+
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
18
|
+
let seriesId = currentItem?.seriesId;
|
|
19
|
+
let type = currentItem?.type;
|
|
20
|
+
if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId)) {
|
|
21
|
+
const nextSeries = (0, _getNextNonEmptySeries.getNextNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
22
|
+
if (nextSeries === null) {
|
|
23
|
+
return null;
|
|
24
|
+
}
|
|
25
|
+
type = nextSeries.type;
|
|
26
|
+
seriesId = nextSeries.seriesId;
|
|
27
|
+
}
|
|
28
|
+
const maxLength = (0, _getMaxSeriesLength.getMaxSeriesLength)(processedSeries, compatibleSeriesTypes);
|
|
29
|
+
const dataIndex = Math.min(maxLength - 1, currentItem?.dataIndex == null ? 0 : currentItem.dataIndex + 1);
|
|
30
|
+
return {
|
|
31
|
+
type,
|
|
32
|
+
seriesId,
|
|
33
|
+
dataIndex
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
function createGetPreviousIndexFocusedItem(compatibleSeriesTypes) {
|
|
38
|
+
return function getPreviousIndexFocusedItem(currentItem, state) {
|
|
39
|
+
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
40
|
+
let seriesId = currentItem?.seriesId;
|
|
41
|
+
let type = currentItem?.type;
|
|
42
|
+
if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId)) {
|
|
43
|
+
const previousSeries = (0, _getPreviousNonEmptySeries.getPreviousNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
44
|
+
if (previousSeries === null) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
type = previousSeries.type;
|
|
48
|
+
seriesId = previousSeries.seriesId;
|
|
49
|
+
}
|
|
50
|
+
const maxLength = (0, _getMaxSeriesLength.getMaxSeriesLength)(processedSeries, compatibleSeriesTypes);
|
|
51
|
+
const dataIndex = Math.max(0, currentItem?.dataIndex == null ? maxLength - 1 : currentItem.dataIndex - 1);
|
|
52
|
+
return {
|
|
53
|
+
type,
|
|
54
|
+
seriesId,
|
|
55
|
+
dataIndex
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
function createGetNextSeriesFocusedItem(compatibleSeriesTypes) {
|
|
60
|
+
return function getNextSeriesFocusedItem(currentItem, state) {
|
|
61
|
+
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
62
|
+
let seriesId = currentItem?.seriesId;
|
|
63
|
+
let type = currentItem?.type;
|
|
64
|
+
const nextSeries = (0, _getNextNonEmptySeries.getNextNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
65
|
+
if (nextSeries === null) {
|
|
66
|
+
return null; // No series to move the focus to.
|
|
67
|
+
}
|
|
68
|
+
type = nextSeries.type;
|
|
69
|
+
seriesId = nextSeries.seriesId;
|
|
70
|
+
const dataIndex = currentItem?.dataIndex == null ? 0 : currentItem.dataIndex;
|
|
71
|
+
return {
|
|
72
|
+
type,
|
|
73
|
+
seriesId,
|
|
74
|
+
dataIndex
|
|
75
|
+
};
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
function createGetPreviousSeriesFocusedItem(compatibleSeriesTypes) {
|
|
79
|
+
return function getPreviousSeriesFocusedItem(currentItem, state) {
|
|
80
|
+
const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
|
|
81
|
+
let seriesId = currentItem?.seriesId;
|
|
82
|
+
let type = currentItem?.type;
|
|
83
|
+
const previousSeries = (0, _getPreviousNonEmptySeries.getPreviousNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
|
|
84
|
+
if (previousSeries === null) {
|
|
85
|
+
return null; // No series to move the focus to.
|
|
86
|
+
}
|
|
87
|
+
type = previousSeries.type;
|
|
88
|
+
seriesId = previousSeries.seriesId;
|
|
89
|
+
const data = processedSeries[type].series[seriesId].data;
|
|
90
|
+
const dataIndex = currentItem?.dataIndex == null ? data.length - 1 : currentItem.dataIndex;
|
|
91
|
+
return {
|
|
92
|
+
type,
|
|
93
|
+
seriesId,
|
|
94
|
+
dataIndex
|
|
95
|
+
};
|
|
96
|
+
};
|
|
97
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ComputedAxis } from "../models/axis.js";
|
|
1
|
+
import type { ChartsXAxisProps, ChartsYAxisProps, ComputedAxis, ScaleName } from "../models/axis.js";
|
|
3
2
|
import type { ChartSeriesDefaultized } from "../models/seriesType/config.js";
|
|
4
3
|
export declare function getBarDimensions(params: {
|
|
5
4
|
verticalLayout: boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { SeriesId } from "../models/index.js";
|
|
2
|
+
export declare const typeSerializer: (type: string) => string;
|
|
3
|
+
export declare const seriesIdSerializer: (id: SeriesId) => string;
|
|
4
|
+
export declare const dataIndexSerializer: (dataIndex?: number) => string;
|
|
5
|
+
export declare const identifierSerializerSeriesIdDataIndex: (identifier: {
|
|
6
|
+
type: string;
|
|
7
|
+
seriesId: SeriesId;
|
|
8
|
+
dataIndex?: number;
|
|
9
|
+
}) => string;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.typeSerializer = exports.seriesIdSerializer = exports.identifierSerializerSeriesIdDataIndex = exports.dataIndexSerializer = void 0;
|
|
7
|
+
const typeSerializer = type => `Type(${type})`;
|
|
8
|
+
exports.typeSerializer = typeSerializer;
|
|
9
|
+
const seriesIdSerializer = id => `Series(${id})`;
|
|
10
|
+
exports.seriesIdSerializer = seriesIdSerializer;
|
|
11
|
+
const dataIndexSerializer = dataIndex => dataIndex === undefined ? '' : `Index(${dataIndex})`;
|
|
12
|
+
exports.dataIndexSerializer = dataIndexSerializer;
|
|
13
|
+
const identifierSerializerSeriesIdDataIndex = identifier => {
|
|
14
|
+
return `${typeSerializer(identifier.type)}${seriesIdSerializer(identifier.seriesId)}${dataIndexSerializer(identifier.dataIndex)}`;
|
|
15
|
+
};
|
|
16
|
+
exports.identifierSerializerSeriesIdDataIndex = identifierSerializerSeriesIdDataIndex;
|
package/internals/index.d.ts
CHANGED
|
@@ -12,13 +12,14 @@ export { scatterSeriesConfig } from "../ScatterChart/seriesConfig/index.js";
|
|
|
12
12
|
export { useLineChartProps } from "../LineChart/useLineChartProps.js";
|
|
13
13
|
export { useAreaPlotData } from "../LineChart/useAreaPlotData.js";
|
|
14
14
|
export { useLinePlotData } from "../LineChart/useLinePlotData.js";
|
|
15
|
-
export
|
|
15
|
+
export * from "../BarChart/useBarChartProps.js";
|
|
16
16
|
export { useBarPlotData } from "../BarChart/useBarPlotData.js";
|
|
17
17
|
export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
|
|
18
18
|
export * from "../ChartContainer/useChartContainerProps.js";
|
|
19
19
|
export * from "../ChartDataProvider/useChartDataProviderProps.js";
|
|
20
20
|
export * from "./seriesSelectorOfType.js";
|
|
21
21
|
export { useSkipAnimation } from "../hooks/useSkipAnimation.js";
|
|
22
|
+
export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.js";
|
|
22
23
|
export * from "./plugins/corePlugins/useChartId/index.js";
|
|
23
24
|
export * from "./plugins/corePlugins/useChartSeries/index.js";
|
|
24
25
|
export * from "./plugins/corePlugins/useChartDimensions/index.js";
|
|
@@ -29,6 +30,7 @@ export * from "./plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
|
29
30
|
export * from "./plugins/featurePlugins/useChartTooltip/index.js";
|
|
30
31
|
export * from "./plugins/featurePlugins/useChartInteraction/index.js";
|
|
31
32
|
export * from "./plugins/featurePlugins/useChartHighlight/index.js";
|
|
33
|
+
export * from "./plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
32
34
|
export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
33
35
|
export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
34
36
|
export * from "./plugins/featurePlugins/useChartBrush/index.js";
|
|
@@ -47,7 +49,7 @@ export * from "./getLabel.js";
|
|
|
47
49
|
export * from "./getSVGPoint.js";
|
|
48
50
|
export * from "./isDefined.js";
|
|
49
51
|
export * from "./getScale.js";
|
|
50
|
-
export * from "./
|
|
52
|
+
export * from "./stacking/index.js";
|
|
51
53
|
export * from "./getCurve.js";
|
|
52
54
|
export * from "./consumeSlots.js";
|
|
53
55
|
export * from "./consumeThemeProps.js";
|
|
@@ -58,6 +60,7 @@ export * from "./dateHelpers.js";
|
|
|
58
60
|
export * from "./invertScale.js";
|
|
59
61
|
export * from "./scaleGuards.js";
|
|
60
62
|
export * from "./findMinMax.js";
|
|
63
|
+
export { getSeriesColorFn } from "./getSeriesColorFn.js";
|
|
61
64
|
export { checkBarChartScaleErrors } from "../BarChart/checkBarChartScaleErrors.js";
|
|
62
65
|
export { getBandSize } from "./getBandSize.js";
|
|
63
66
|
export { getAxisExtrema } from "./plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js";
|
|
@@ -71,4 +74,5 @@ export * from "./plugins/models/index.js";
|
|
|
71
74
|
export * from "./material/index.js";
|
|
72
75
|
export * from "./createSvgIcon.js";
|
|
73
76
|
export * from "./constants.js";
|
|
74
|
-
export * from "./scales/index.js";
|
|
77
|
+
export * from "./scales/index.js";
|
|
78
|
+
export * from "./identifierSerializer.js";
|