@mui/x-charts 8.23.0 → 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/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 +5 -1
- 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/legend.js +1 -0
- package/BarChart/seriesConfig/index.js +3 -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 +111 -1
- 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 +5 -1
- 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 +3 -1
- package/LineChart/seriesConfig/legend.js +1 -0
- package/PieChart/FocusedPieArc.js +5 -2
- 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/seriesConfig/index.js +3 -1
- 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/ScatterChart.js +30 -0
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/seriesConfig/index.js +3 -1
- 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/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 +5 -1
- 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/legend.js +1 -0
- package/esm/BarChart/seriesConfig/index.js +3 -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 +5 -1
- 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 +3 -1
- package/esm/LineChart/seriesConfig/legend.js +1 -0
- package/esm/PieChart/FocusedPieArc.js +4 -1
- 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/seriesConfig/index.js +3 -1
- 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/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 +3 -1
- package/esm/ScatterChart/seriesConfig/legend.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +46 -0
- 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.js +12 -8
- 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 +6 -2
- package/esm/internals/index.js +6 -2
- 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/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.js +7 -34
- 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.js +10 -32
- package/esm/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +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 +7 -0
- 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/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
- package/esm/moduleAugmentation/barChartBatchRendererOnItemClick.js +1 -0
- package/index.js +1 -1
- package/internals/appendAtKey.d.ts +8 -0
- package/internals/appendAtKey.js +23 -0
- package/internals/commonNextFocusItem.js +12 -8
- 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 +6 -2
- package/internals/index.js +51 -7
- 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/utils/getMaxSeriesLength.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +12 -0
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js +6 -34
- 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.js +9 -32
- package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -2
- 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 +7 -0
- 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/moduleAugmentation/barChartBatchRendererOnItemClick.d.ts +13 -0
- package/moduleAugmentation/barChartBatchRendererOnItemClick.js +5 -0
- package/package.json +13 -3
|
@@ -10,13 +10,16 @@ const legendGetter = params => {
|
|
|
10
10
|
if (formattedLabel === undefined) {
|
|
11
11
|
return;
|
|
12
12
|
}
|
|
13
|
+
const id = item.id ?? dataIndex;
|
|
13
14
|
acc.push({
|
|
15
|
+
type: 'pie',
|
|
14
16
|
markType: item.labelMarkType ?? series[seriesId].labelMarkType,
|
|
15
|
-
id: item.id ?? dataIndex,
|
|
16
17
|
seriesId,
|
|
18
|
+
id,
|
|
19
|
+
itemId: id,
|
|
20
|
+
dataIndex,
|
|
17
21
|
color: item.color,
|
|
18
|
-
label: formattedLabel
|
|
19
|
-
itemId: item.id ?? dataIndex
|
|
22
|
+
label: formattedLabel
|
|
20
23
|
});
|
|
21
24
|
});
|
|
22
25
|
return acc;
|
|
@@ -84,6 +84,31 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
84
84
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
85
85
|
*/
|
|
86
86
|
height: PropTypes.number,
|
|
87
|
+
/**
|
|
88
|
+
* List of hidden series and/or items.
|
|
89
|
+
*
|
|
90
|
+
* Different chart types use different keys.
|
|
91
|
+
*
|
|
92
|
+
* @example
|
|
93
|
+
* ```ts
|
|
94
|
+
* [
|
|
95
|
+
* {
|
|
96
|
+
* type: 'pie',
|
|
97
|
+
* seriesId: 'series-1',
|
|
98
|
+
* dataIndex: 3,
|
|
99
|
+
* },
|
|
100
|
+
* {
|
|
101
|
+
* type: 'line',
|
|
102
|
+
* seriesId: 'series-2',
|
|
103
|
+
* }
|
|
104
|
+
* ]
|
|
105
|
+
* ```
|
|
106
|
+
*/
|
|
107
|
+
hiddenItems: PropTypes.arrayOf(PropTypes.shape({
|
|
108
|
+
dataIndex: PropTypes.number,
|
|
109
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
110
|
+
type: PropTypes.oneOf(['radar']).isRequired
|
|
111
|
+
})),
|
|
87
112
|
/**
|
|
88
113
|
* If `true`, the legend is not rendered.
|
|
89
114
|
*/
|
|
@@ -140,6 +165,11 @@ process.env.NODE_ENV !== "production" ? RadarChart.propTypes = {
|
|
|
140
165
|
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
141
166
|
*/
|
|
142
167
|
onAxisClick: PropTypes.func,
|
|
168
|
+
/**
|
|
169
|
+
* Callback fired when any hidden identifiers change.
|
|
170
|
+
* @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
|
|
171
|
+
*/
|
|
172
|
+
onHiddenItemsChange: PropTypes.func,
|
|
143
173
|
/**
|
|
144
174
|
* The callback fired when the highlighted item changes.
|
|
145
175
|
*
|
|
@@ -2,5 +2,6 @@ import { type UseChartPolarAxisSignature } from "../internals/plugins/featurePlu
|
|
|
2
2
|
import { type UseChartTooltipSignature } from "../internals/plugins/featurePlugins/useChartTooltip/index.js";
|
|
3
3
|
import { type UseChartInteractionSignature } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { type UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
|
-
|
|
6
|
-
export
|
|
5
|
+
import { type UseChartVisibilityManagerSignature } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
6
|
+
export declare const RADAR_PLUGINS: readonly [import("../internals/index.js").ChartPlugin<UseChartTooltipSignature>, import("../internals/index.js").ChartPlugin<UseChartInteractionSignature>, import("../internals/index.js").ChartPlugin<UseChartPolarAxisSignature<any>>, import("../internals/index.js").ChartPlugin<UseChartHighlightSignature>, import("../internals/index.js").ChartPlugin<UseChartVisibilityManagerSignature<any>>];
|
|
7
|
+
export type RadarChartPluginSignatures = [UseChartTooltipSignature, UseChartInteractionSignature, UseChartPolarAxisSignature, UseChartHighlightSignature, UseChartVisibilityManagerSignature<'radar'>];
|
|
@@ -2,4 +2,5 @@ import { useChartPolarAxis } from "../internals/plugins/featurePlugins/useChartP
|
|
|
2
2
|
import { useChartTooltip } from "../internals/plugins/featurePlugins/useChartTooltip/index.js";
|
|
3
3
|
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
|
-
|
|
5
|
+
import { useChartVisibilityManager } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
6
|
+
export const RADAR_PLUGINS = [useChartTooltip, useChartInteraction, useChartPolarAxis, useChartHighlight, useChartVisibilityManager];
|
|
@@ -5,6 +5,7 @@ import legendGetter from "./legend.js";
|
|
|
5
5
|
import tooltipGetter, { axisTooltipGetter } from "./tooltip.js";
|
|
6
6
|
import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
|
|
7
7
|
import tooltipItemPositionGetter from "./tooltipPosition.js";
|
|
8
|
+
import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
|
|
8
9
|
export const radarSeriesConfig = {
|
|
9
10
|
colorProcessor: getColor,
|
|
10
11
|
seriesProcessor,
|
|
@@ -14,5 +15,6 @@ export const radarSeriesConfig = {
|
|
|
14
15
|
axisTooltipGetter,
|
|
15
16
|
getSeriesWithDefaultValues,
|
|
16
17
|
radiusExtremumGetter,
|
|
17
|
-
rotationExtremumGetter
|
|
18
|
+
rotationExtremumGetter,
|
|
19
|
+
identifierSerializer: identifierSerializerSeriesIdDataIndex
|
|
18
20
|
};
|
|
@@ -6,21 +6,12 @@ import { useUtilityClasses } from "./scatterClasses.js";
|
|
|
6
6
|
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
7
7
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
8
8
|
import { selectorChartIsSeriesFaded, selectorChartIsSeriesHighlighted, selectorChartSeriesUnfadedItem, selectorChartSeriesHighlightedItem } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
9
|
+
import { appendAtKey } from "../internals/appendAtKey.js";
|
|
9
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
11
|
const MAX_POINTS_PER_PATH = 1000;
|
|
11
12
|
/* In an SVG arc, if the arc starts and ends at the same point, it is not rendered, so we add a tiny
|
|
12
13
|
* value to one of the coordinates to ensure that the arc is rendered. */
|
|
13
14
|
const ALMOST_ZERO = 0.01;
|
|
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
|
-
}
|
|
24
15
|
function createPath(x, y, markerSize) {
|
|
25
16
|
return `M${x - markerSize} ${y} a${markerSize} ${markerSize} 0 1 1 0 ${ALMOST_ZERO}`;
|
|
26
17
|
}
|
|
@@ -81,7 +72,10 @@ function BatchScatterPaths(props) {
|
|
|
81
72
|
}
|
|
82
73
|
const MemoBatchScatterPaths = /*#__PURE__*/React.memo(BatchScatterPaths);
|
|
83
74
|
if (process.env.NODE_ENV !== "production") MemoBatchScatterPaths.displayName = "MemoBatchScatterPaths";
|
|
84
|
-
const Group = styled('g'
|
|
75
|
+
const Group = styled('g', {
|
|
76
|
+
slot: 'internal',
|
|
77
|
+
shouldForwardProp: undefined
|
|
78
|
+
})({
|
|
85
79
|
'&[data-faded="true"]': {
|
|
86
80
|
opacity: 0.3
|
|
87
81
|
},
|
|
@@ -124,6 +124,31 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
124
124
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
125
125
|
*/
|
|
126
126
|
height: PropTypes.number,
|
|
127
|
+
/**
|
|
128
|
+
* List of hidden series and/or items.
|
|
129
|
+
*
|
|
130
|
+
* Different chart types use different keys.
|
|
131
|
+
*
|
|
132
|
+
* @example
|
|
133
|
+
* ```ts
|
|
134
|
+
* [
|
|
135
|
+
* {
|
|
136
|
+
* type: 'pie',
|
|
137
|
+
* seriesId: 'series-1',
|
|
138
|
+
* dataIndex: 3,
|
|
139
|
+
* },
|
|
140
|
+
* {
|
|
141
|
+
* type: 'line',
|
|
142
|
+
* seriesId: 'series-2',
|
|
143
|
+
* }
|
|
144
|
+
* ]
|
|
145
|
+
* ```
|
|
146
|
+
*/
|
|
147
|
+
hiddenItems: PropTypes.arrayOf(PropTypes.shape({
|
|
148
|
+
dataIndex: PropTypes.number,
|
|
149
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
150
|
+
type: PropTypes.oneOf(['scatter']).isRequired
|
|
151
|
+
})),
|
|
127
152
|
/**
|
|
128
153
|
* If `true`, the legend is not rendered.
|
|
129
154
|
*/
|
|
@@ -169,6 +194,11 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
169
194
|
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
170
195
|
*/
|
|
171
196
|
onAxisClick: PropTypes.func,
|
|
197
|
+
/**
|
|
198
|
+
* Callback fired when any hidden identifiers change.
|
|
199
|
+
* @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
|
|
200
|
+
*/
|
|
201
|
+
onHiddenItemsChange: PropTypes.func,
|
|
172
202
|
/**
|
|
173
203
|
* The callback fired when the highlighted item changes.
|
|
174
204
|
*
|
|
@@ -7,5 +7,6 @@ import { type ConvertSignaturesIntoPlugins } from "../internals/plugins/models/h
|
|
|
7
7
|
import { type UseChartClosestPointSignature } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
8
8
|
import { type UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
9
9
|
import { type UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
10
|
-
|
|
10
|
+
import { type UseChartVisibilityManagerSignature } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
11
|
+
export type ScatterChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartTooltipSignature, UseChartInteractionSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartHighlightSignature, UseChartVisibilityManagerSignature<'scatter'>, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
11
12
|
export declare const SCATTER_CHART_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartPluginSignatures>;
|
|
@@ -6,4 +6,5 @@ import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartH
|
|
|
6
6
|
import { useChartClosestPoint } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
7
7
|
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
8
8
|
import { useChartBrush } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
9
|
-
|
|
9
|
+
import { useChartVisibilityManager } from "../internals/plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
10
|
+
export const SCATTER_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartClosestPoint, useChartKeyboardNavigation];
|
|
@@ -6,6 +6,7 @@ import tooltipGetter from "./tooltip.js";
|
|
|
6
6
|
import getSeriesWithDefaultValues from "./getSeriesWithDefaultValues.js";
|
|
7
7
|
import tooltipItemPositionGetter from "./tooltipPosition.js";
|
|
8
8
|
import keyboardFocusHandler from "./keyboardFocusHandler.js";
|
|
9
|
+
import { identifierSerializerSeriesIdDataIndex } from "../../internals/identifierSerializer.js";
|
|
9
10
|
export const scatterSeriesConfig = {
|
|
10
11
|
seriesProcessor,
|
|
11
12
|
colorProcessor: getColor,
|
|
@@ -15,5 +16,6 @@ export const scatterSeriesConfig = {
|
|
|
15
16
|
xExtremumGetter: getExtremumX,
|
|
16
17
|
yExtremumGetter: getExtremumY,
|
|
17
18
|
getSeriesWithDefaultValues,
|
|
18
|
-
keyboardFocusHandler
|
|
19
|
+
keyboardFocusHandler,
|
|
20
|
+
identifierSerializer: identifierSerializerSeriesIdDataIndex
|
|
19
21
|
};
|
|
@@ -241,6 +241,47 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
241
241
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
242
242
|
*/
|
|
243
243
|
height: PropTypes.number,
|
|
244
|
+
/**
|
|
245
|
+
* List of hidden series and/or items.
|
|
246
|
+
*
|
|
247
|
+
* Different chart types use different keys.
|
|
248
|
+
*
|
|
249
|
+
* @example
|
|
250
|
+
* ```ts
|
|
251
|
+
* [
|
|
252
|
+
* {
|
|
253
|
+
* type: 'pie',
|
|
254
|
+
* seriesId: 'series-1',
|
|
255
|
+
* dataIndex: 3,
|
|
256
|
+
* },
|
|
257
|
+
* {
|
|
258
|
+
* type: 'line',
|
|
259
|
+
* seriesId: 'series-2',
|
|
260
|
+
* }
|
|
261
|
+
* ]
|
|
262
|
+
* ```
|
|
263
|
+
*/
|
|
264
|
+
hiddenItems: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.shape({
|
|
265
|
+
dataIndex: PropTypes.number,
|
|
266
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
267
|
+
type: PropTypes.oneOf(['bar']).isRequired
|
|
268
|
+
}), PropTypes.shape({
|
|
269
|
+
dataIndex: PropTypes.number,
|
|
270
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
271
|
+
type: PropTypes.oneOf(['line']).isRequired
|
|
272
|
+
}), PropTypes.shape({
|
|
273
|
+
dataIndex: PropTypes.number,
|
|
274
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
275
|
+
type: PropTypes.oneOf(['scatter']).isRequired
|
|
276
|
+
}), PropTypes.shape({
|
|
277
|
+
dataIndex: PropTypes.number,
|
|
278
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
279
|
+
type: PropTypes.oneOf(['pie']).isRequired
|
|
280
|
+
}), PropTypes.shape({
|
|
281
|
+
dataIndex: PropTypes.number,
|
|
282
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
283
|
+
type: PropTypes.oneOf(['radar']).isRequired
|
|
284
|
+
})]).isRequired),
|
|
244
285
|
/**
|
|
245
286
|
* The controlled axis highlight.
|
|
246
287
|
* Identified by the axis id, and data index.
|
|
@@ -286,6 +327,11 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
286
327
|
* @param {null | ChartsAxisData} data The data about the clicked axis and items associated with it.
|
|
287
328
|
*/
|
|
288
329
|
onAxisClick: PropTypes.func,
|
|
330
|
+
/**
|
|
331
|
+
* Callback fired when any hidden identifiers change.
|
|
332
|
+
* @param {VisibilityIdentifier[]} hiddenItems The new list of hidden identifiers.
|
|
333
|
+
*/
|
|
334
|
+
onHiddenItemsChange: PropTypes.func,
|
|
289
335
|
/**
|
|
290
336
|
* The callback fired when the highlighted item changes.
|
|
291
337
|
*
|
package/esm/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,17 @@
|
|
|
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 function appendAtKey(map, key, value) {
|
|
9
|
+
let bucket = map.get(key);
|
|
10
|
+
if (!bucket) {
|
|
11
|
+
bucket = [value];
|
|
12
|
+
map.set(key, bucket);
|
|
13
|
+
} else {
|
|
14
|
+
bucket.push(value);
|
|
15
|
+
}
|
|
16
|
+
return bucket;
|
|
17
|
+
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { getPreviousNonEmptySeries } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.js";
|
|
2
|
+
import { getMaxSeriesLength } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js";
|
|
2
3
|
import { selectorChartSeriesProcessed } from "./plugins/corePlugins/useChartSeries/index.js";
|
|
3
4
|
import { getNextNonEmptySeries } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.js";
|
|
4
5
|
import { seriesHasData } from "./seriesHasData.js";
|
|
@@ -15,11 +16,12 @@ export function createGetNextIndexFocusedItem(compatibleSeriesTypes) {
|
|
|
15
16
|
type = nextSeries.type;
|
|
16
17
|
seriesId = nextSeries.seriesId;
|
|
17
18
|
}
|
|
18
|
-
const
|
|
19
|
+
const maxLength = getMaxSeriesLength(processedSeries, compatibleSeriesTypes);
|
|
20
|
+
const dataIndex = Math.min(maxLength - 1, currentItem?.dataIndex == null ? 0 : currentItem.dataIndex + 1);
|
|
19
21
|
return {
|
|
20
22
|
type,
|
|
21
23
|
seriesId,
|
|
22
|
-
dataIndex
|
|
24
|
+
dataIndex
|
|
23
25
|
};
|
|
24
26
|
};
|
|
25
27
|
}
|
|
@@ -36,11 +38,12 @@ export function createGetPreviousIndexFocusedItem(compatibleSeriesTypes) {
|
|
|
36
38
|
type = previousSeries.type;
|
|
37
39
|
seriesId = previousSeries.seriesId;
|
|
38
40
|
}
|
|
39
|
-
const
|
|
41
|
+
const maxLength = getMaxSeriesLength(processedSeries, compatibleSeriesTypes);
|
|
42
|
+
const dataIndex = Math.max(0, currentItem?.dataIndex == null ? maxLength - 1 : currentItem.dataIndex - 1);
|
|
40
43
|
return {
|
|
41
44
|
type,
|
|
42
45
|
seriesId,
|
|
43
|
-
dataIndex
|
|
46
|
+
dataIndex
|
|
44
47
|
};
|
|
45
48
|
};
|
|
46
49
|
}
|
|
@@ -55,11 +58,11 @@ export function createGetNextSeriesFocusedItem(compatibleSeriesTypes) {
|
|
|
55
58
|
}
|
|
56
59
|
type = nextSeries.type;
|
|
57
60
|
seriesId = nextSeries.seriesId;
|
|
58
|
-
const
|
|
61
|
+
const dataIndex = currentItem?.dataIndex == null ? 0 : currentItem.dataIndex;
|
|
59
62
|
return {
|
|
60
63
|
type,
|
|
61
64
|
seriesId,
|
|
62
|
-
dataIndex
|
|
65
|
+
dataIndex
|
|
63
66
|
};
|
|
64
67
|
};
|
|
65
68
|
}
|
|
@@ -74,11 +77,12 @@ export function createGetPreviousSeriesFocusedItem(compatibleSeriesTypes) {
|
|
|
74
77
|
}
|
|
75
78
|
type = previousSeries.type;
|
|
76
79
|
seriesId = previousSeries.seriesId;
|
|
77
|
-
const
|
|
80
|
+
const data = processedSeries[type].series[seriesId].data;
|
|
81
|
+
const dataIndex = currentItem?.dataIndex == null ? data.length - 1 : currentItem.dataIndex;
|
|
78
82
|
return {
|
|
79
83
|
type,
|
|
80
84
|
seriesId,
|
|
81
|
-
dataIndex
|
|
85
|
+
dataIndex
|
|
82
86
|
};
|
|
83
87
|
};
|
|
84
88
|
}
|
|
@@ -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,6 @@
|
|
|
1
|
+
export const typeSerializer = type => `Type(${type})`;
|
|
2
|
+
export const seriesIdSerializer = id => `Series(${id})`;
|
|
3
|
+
export const dataIndexSerializer = dataIndex => dataIndex === undefined ? '' : `Index(${dataIndex})`;
|
|
4
|
+
export const identifierSerializerSeriesIdDataIndex = identifier => {
|
|
5
|
+
return `${typeSerializer(identifier.type)}${seriesIdSerializer(identifier.seriesId)}${dataIndexSerializer(identifier.dataIndex)}`;
|
|
6
|
+
};
|
package/esm/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";
|
|
@@ -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";
|
package/esm/internals/index.js
CHANGED
|
@@ -15,13 +15,14 @@ export { scatterSeriesConfig } from "../ScatterChart/seriesConfig/index.js";
|
|
|
15
15
|
export { useLineChartProps } from "../LineChart/useLineChartProps.js";
|
|
16
16
|
export { useAreaPlotData } from "../LineChart/useAreaPlotData.js";
|
|
17
17
|
export { useLinePlotData } from "../LineChart/useLinePlotData.js";
|
|
18
|
-
export
|
|
18
|
+
export * from "../BarChart/useBarChartProps.js";
|
|
19
19
|
export { useBarPlotData } from "../BarChart/useBarPlotData.js";
|
|
20
20
|
export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
|
|
21
21
|
export * from "../ChartContainer/useChartContainerProps.js";
|
|
22
22
|
export * from "../ChartDataProvider/useChartDataProviderProps.js";
|
|
23
23
|
export * from "./seriesSelectorOfType.js";
|
|
24
24
|
export { useSkipAnimation } from "../hooks/useSkipAnimation.js";
|
|
25
|
+
export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.js";
|
|
25
26
|
|
|
26
27
|
// plugins
|
|
27
28
|
export * from "./plugins/corePlugins/useChartId/index.js";
|
|
@@ -34,6 +35,7 @@ export * from "./plugins/featurePlugins/useChartPolarAxis/index.js";
|
|
|
34
35
|
export * from "./plugins/featurePlugins/useChartTooltip/index.js";
|
|
35
36
|
export * from "./plugins/featurePlugins/useChartInteraction/index.js";
|
|
36
37
|
export * from "./plugins/featurePlugins/useChartHighlight/index.js";
|
|
38
|
+
export * from "./plugins/featurePlugins/useChartVisibilityManager/index.js";
|
|
37
39
|
export * from "./plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
38
40
|
export * from "./plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
39
41
|
export * from "./plugins/featurePlugins/useChartBrush/index.js";
|
|
@@ -68,6 +70,7 @@ export * from "./dateHelpers.js";
|
|
|
68
70
|
export * from "./invertScale.js";
|
|
69
71
|
export * from "./scaleGuards.js";
|
|
70
72
|
export * from "./findMinMax.js";
|
|
73
|
+
export { getSeriesColorFn } from "./getSeriesColorFn.js";
|
|
71
74
|
export { checkBarChartScaleErrors } from "../BarChart/checkBarChartScaleErrors.js";
|
|
72
75
|
export { getBandSize } from "./getBandSize.js";
|
|
73
76
|
|
|
@@ -85,4 +88,5 @@ export * from "./plugins/models/index.js";
|
|
|
85
88
|
export * from "./material/index.js";
|
|
86
89
|
export * from "./createSvgIcon.js";
|
|
87
90
|
export * from "./constants.js";
|
|
88
|
-
export * from "./scales/index.js";
|
|
91
|
+
export * from "./scales/index.js";
|
|
92
|
+
export * from "./identifierSerializer.js";
|
|
@@ -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;
|
|
@@ -1,8 +1,16 @@
|
|
|
1
1
|
import { isOrdinalScale } from "./scaleGuards.js";
|
|
2
2
|
export function invertScale(scale, data, value) {
|
|
3
3
|
if (isOrdinalScale(scale)) {
|
|
4
|
-
const dataIndex =
|
|
4
|
+
const dataIndex = getDataIndexForOrdinalScaleValue(scale, value);
|
|
5
5
|
return data[dataIndex];
|
|
6
6
|
}
|
|
7
7
|
return scale.invert(value);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Get the data index for a given value on an ordinal scale.
|
|
12
|
+
*/
|
|
13
|
+
export function getDataIndexForOrdinalScaleValue(scale, value) {
|
|
14
|
+
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());
|
|
15
|
+
return dataIndex;
|
|
8
16
|
}
|
|
@@ -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>];
|
|
@@ -7,5 +7,6 @@ import { useChartKeyboardNavigation } from "./featurePlugins/useChartKeyboardNav
|
|
|
7
7
|
import { useChartClosestPoint } from "./featurePlugins/useChartClosestPoint/index.js";
|
|
8
8
|
import { useChartZAxis } from "./featurePlugins/useChartZAxis/index.js";
|
|
9
9
|
import { useChartBrush } from "./featurePlugins/useChartBrush/index.js";
|
|
10
|
+
import { useChartVisibilityManager } from "./featurePlugins/useChartVisibilityManager/index.js";
|
|
10
11
|
import { useChartTooltip } from "./featurePlugins/useChartTooltip/index.js";
|
|
11
|
-
export const DEFAULT_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation];
|
|
12
|
+
export const DEFAULT_PLUGINS = [useChartZAxis, useChartBrush, useChartTooltip, useChartInteraction, useChartCartesianAxis, useChartHighlight, useChartVisibilityManager, useChartClosestPoint, 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,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Serializes a series item identifier into a unique string using the appropriate serializer
|
|
3
|
+
* from the provided series configuration.
|
|
4
|
+
*
|
|
5
|
+
* @param {ChartSeriesConfig<ChartSeriesType>} seriesConfig - The configuration object for chart series.
|
|
6
|
+
* @param {SeriesItemIdentifier<ChartSeriesType>} identifier - The series item identifier to serialize.
|
|
7
|
+
* @returns {string} A unique string representation of the identifier.
|
|
8
|
+
* @throws Will throw an error if no serializer is found for the given series type.
|
|
9
|
+
*/
|
|
10
|
+
export const serializeIdentifier = (seriesConfig, identifier) => {
|
|
11
|
+
const serializer = seriesConfig[identifier.type]?.identifierSerializer;
|
|
12
|
+
if (!serializer) {
|
|
13
|
+
throw new Error(`MUI X Charts: No identifier serializer found for series type "${identifier.type}".`);
|
|
14
|
+
}
|
|
15
|
+
// @ts-expect-error identifierSerializer expects the full object,
|
|
16
|
+
// but this function accepts a partial one in order be able to serialize all identifiers.
|
|
17
|
+
return serializer(identifier);
|
|
18
|
+
};
|
|
@@ -2,8 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import { useEffectAfterFirstRender } from '@mui/x-internals/useEffectAfterFirstRender';
|
|
5
|
+
import useEventCallback from '@mui/utils/useEventCallback';
|
|
5
6
|
import { rainbowSurgePalette } from "../../../../colorPalettes/index.js";
|
|
6
7
|
import { defaultizeSeries } from "./processSeries.js";
|
|
8
|
+
import { serializeIdentifier as serializeIdentifierFn } from "./serializeIdentifier.js";
|
|
7
9
|
export const useChartSeries = ({
|
|
8
10
|
params,
|
|
9
11
|
store,
|
|
@@ -28,7 +30,12 @@ export const useChartSeries = ({
|
|
|
28
30
|
dataset
|
|
29
31
|
}));
|
|
30
32
|
}, [colors, dataset, series, theme, seriesConfig, store]);
|
|
31
|
-
|
|
33
|
+
const serializeIdentifier = useEventCallback(identifier => serializeIdentifierFn(seriesConfig, identifier));
|
|
34
|
+
return {
|
|
35
|
+
instance: {
|
|
36
|
+
serializeIdentifier
|
|
37
|
+
}
|
|
38
|
+
};
|
|
32
39
|
};
|
|
33
40
|
useChartSeries.params = {
|
|
34
41
|
dataset: true,
|