@mui/x-charts 8.20.0 → 8.21.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.d.ts +1 -1
- package/BarChart/BarChart.js +18 -0
- package/BarChart/BarLabel/BarLabel.types.d.ts +4 -3
- package/BarChart/BarLabel/BarLabelItem.d.ts +5 -4
- package/BarChart/BarLabel/BarLabelPlot.d.ts +25 -6
- package/BarChart/BarLabel/BarLabelPlot.js +10 -9
- package/BarChart/BarLabel/getBarLabel.d.ts +5 -4
- package/BarChart/BarLabel/getBarLabel.js +3 -4
- package/BarChart/BarPlot.js +4 -3
- package/BarChart/checkBarChartScaleErrors.d.ts +7 -0
- package/BarChart/{checkScaleErrors.js → checkBarChartScaleErrors.js} +6 -7
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +5 -3
- package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.js +3 -4
- package/BarChart/seriesConfig/index.js +2 -2
- package/BarChart/types.d.ts +6 -3
- package/BarChart/useBarPlotData.js +17 -45
- package/CHANGELOG.md +112 -0
- package/ChartContainer/ChartContainer.js +28 -0
- package/ChartsGrid/ChartsHorizontalGrid.js +3 -1
- package/ChartsGrid/ChartsVerticalGrid.js +3 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +2 -1
- package/ChartsXAxis/ChartsSingleXAxisTicks.js +2 -0
- package/ChartsXAxis/ChartsXAxisImpl.js +2 -0
- package/ChartsXAxis/useAxisTicksProps.d.ts +198 -117
- package/ChartsXAxis/useAxisTicksProps.js +2 -0
- package/ChartsYAxis/ChartsSingleYAxisTicks.js +2 -0
- package/ChartsYAxis/ChartsYAxisImpl.js +2 -0
- package/ChartsYAxis/useAxisTicksProps.d.ts +198 -117
- package/ChartsYAxis/useAxisTicksProps.js +2 -0
- package/LineChart/LineChart.js +18 -0
- package/RadarChart/seriesConfig/index.js +2 -0
- package/RadarChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/RadarChart/seriesConfig/tooltipPosition.js +80 -0
- package/ScatterChart/ScatterChart.js +18 -0
- package/SparkLineChart/SparkLineChart.js +18 -0
- package/esm/BarChart/BarChart.d.ts +1 -1
- package/esm/BarChart/BarChart.js +18 -0
- package/esm/BarChart/BarLabel/BarLabel.types.d.ts +4 -3
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +5 -4
- package/esm/BarChart/BarLabel/BarLabelPlot.d.ts +25 -6
- package/esm/BarChart/BarLabel/BarLabelPlot.js +9 -9
- package/esm/BarChart/BarLabel/getBarLabel.d.ts +5 -4
- package/esm/BarChart/BarLabel/getBarLabel.js +2 -2
- package/esm/BarChart/BarPlot.js +4 -3
- package/esm/BarChart/checkBarChartScaleErrors.d.ts +7 -0
- package/esm/BarChart/{checkScaleErrors.js → checkBarChartScaleErrors.js} +5 -6
- package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +5 -3
- package/esm/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.js +2 -3
- package/esm/BarChart/seriesConfig/index.js +1 -1
- package/esm/BarChart/types.d.ts +6 -3
- package/esm/BarChart/useBarPlotData.js +17 -45
- package/esm/ChartContainer/ChartContainer.js +28 -0
- package/esm/ChartsGrid/ChartsHorizontalGrid.js +3 -1
- package/esm/ChartsGrid/ChartsVerticalGrid.js +3 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +2 -1
- package/esm/ChartsXAxis/ChartsSingleXAxisTicks.js +2 -0
- package/esm/ChartsXAxis/ChartsXAxisImpl.js +2 -0
- package/esm/ChartsXAxis/useAxisTicksProps.d.ts +198 -117
- package/esm/ChartsXAxis/useAxisTicksProps.js +2 -0
- package/esm/ChartsYAxis/ChartsSingleYAxisTicks.js +2 -0
- package/esm/ChartsYAxis/ChartsYAxisImpl.js +2 -0
- package/esm/ChartsYAxis/useAxisTicksProps.d.ts +198 -117
- package/esm/ChartsYAxis/useAxisTicksProps.js +2 -0
- package/esm/LineChart/LineChart.js +18 -0
- package/esm/RadarChart/seriesConfig/index.js +2 -0
- package/esm/RadarChart/seriesConfig/tooltipPosition.d.ts +3 -0
- package/esm/RadarChart/seriesConfig/tooltipPosition.js +74 -0
- package/esm/ScatterChart/ScatterChart.js +18 -0
- package/esm/SparkLineChart/SparkLineChart.js +18 -0
- package/esm/hooks/useIsHydrated.js +1 -1
- package/esm/hooks/useTicks.d.ts +15 -2
- package/esm/hooks/useTicks.js +32 -3
- package/esm/index.js +1 -1
- package/esm/internals/domUtils.d.ts +6 -3
- package/esm/internals/getBandSize.d.ts +13 -0
- package/esm/internals/getBandSize.js +23 -0
- package/esm/internals/getWordsByLines.d.ts +2 -1
- package/esm/internals/index.d.ts +5 -0
- package/esm/internals/index.js +5 -0
- package/esm/internals/plugins/corePlugins/useChartSeries/index.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +11 -2
- package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.js +29 -0
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +9 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +11 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +2 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +5 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -2
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +1 -1
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -4
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +37 -22
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +10 -7
- package/esm/internals/plugins/models/seriesConfig/index.d.ts +1 -0
- package/esm/internals/plugins/models/seriesConfig/index.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +5 -0
- package/esm/internals/plugins/models/seriesConfig/seriesLayout.types.d.ts +6 -0
- package/esm/internals/plugins/models/seriesConfig/seriesLayout.types.js +1 -0
- package/esm/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +6 -4
- package/esm/internals/seriesSelectorOfType.d.ts +2 -2
- package/esm/internals/seriesSelectorOfType.js +1 -1
- package/esm/models/axis.d.ts +5 -0
- package/esm/models/seriesType/bar.d.ts +3 -2
- package/esm/models/seriesType/config.d.ts +10 -0
- package/esm/models/seriesType/index.d.ts +1 -0
- package/hooks/useIsHydrated.js +1 -1
- package/hooks/useTicks.d.ts +15 -2
- package/hooks/useTicks.js +33 -3
- package/index.js +1 -1
- package/internals/domUtils.d.ts +6 -3
- package/internals/getBandSize.d.ts +13 -0
- package/internals/getBandSize.js +29 -0
- package/internals/getWordsByLines.d.ts +2 -1
- package/internals/index.d.ts +5 -0
- package/internals/index.js +48 -0
- package/internals/plugins/corePlugins/useChartSeries/index.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +11 -2
- package/internals/plugins/corePlugins/useChartSeries/processSeries.js +32 -2
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +9 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +11 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +2 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +1 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +1 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +2 -4
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +2 -2
- package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +35 -20
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +10 -6
- package/internals/plugins/models/seriesConfig/index.d.ts +1 -0
- package/internals/plugins/models/seriesConfig/index.js +11 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +5 -0
- package/internals/plugins/models/seriesConfig/seriesLayout.types.d.ts +6 -0
- package/internals/plugins/models/seriesConfig/seriesLayout.types.js +5 -0
- package/internals/plugins/models/seriesConfig/tooltipItemPositionGetter.types.d.ts +6 -4
- package/internals/seriesSelectorOfType.d.ts +2 -2
- package/internals/seriesSelectorOfType.js +1 -1
- package/models/axis.d.ts +5 -0
- package/models/seriesType/bar.d.ts +3 -2
- package/models/seriesType/config.d.ts +10 -0
- package/models/seriesType/index.d.ts +1 -0
- package/package.json +4 -4
- package/BarChart/checkScaleErrors.d.ts +0 -10
- package/esm/BarChart/checkScaleErrors.d.ts +0 -10
|
@@ -15,7 +15,6 @@ var _getSVGPoint = require("../../../getSVGPoint");
|
|
|
15
15
|
var _useSelector = require("../../../store/useSelector");
|
|
16
16
|
var _useChartCartesianAxis = require("../useChartCartesianAxis");
|
|
17
17
|
var _useChartSeries = require("../../corePlugins/useChartSeries/useChartSeries.selectors");
|
|
18
|
-
var _useChartDimensions = require("../../corePlugins/useChartDimensions");
|
|
19
18
|
var _findClosestPoints = require("./findClosestPoints");
|
|
20
19
|
const useChartClosestPoint = ({
|
|
21
20
|
svgRef,
|
|
@@ -28,7 +27,6 @@ const useChartClosestPoint = ({
|
|
|
28
27
|
voronoiMaxRadius,
|
|
29
28
|
onItemClick
|
|
30
29
|
} = params;
|
|
31
|
-
const drawingArea = (0, _useSelector.useSelector)(store, _useChartDimensions.selectorChartDrawingArea);
|
|
32
30
|
const {
|
|
33
31
|
axis: xAxis,
|
|
34
32
|
axisIds: xAxisIds
|
|
@@ -79,7 +77,7 @@ const useChartClosestPoint = ({
|
|
|
79
77
|
const yZoomEnd = (yAxisZoom?.end ?? 100) / 100;
|
|
80
78
|
const xScale = xAxis[xAxisId].scale;
|
|
81
79
|
const yScale = yAxis[yAxisId].scale;
|
|
82
|
-
const closestPointIndex = (0, _findClosestPoints.findClosestPoints)(flatbush,
|
|
80
|
+
const closestPointIndex = (0, _findClosestPoints.findClosestPoints)(flatbush, aSeries.data, xScale, yScale, xZoomStart, xZoomEnd, yZoomStart, yZoomEnd, svgPoint.x, svgPoint.y, maxRadius)[0];
|
|
83
81
|
if (closestPointIndex === undefined) {
|
|
84
82
|
continue;
|
|
85
83
|
}
|
|
@@ -177,7 +175,7 @@ const useChartClosestPoint = ({
|
|
|
177
175
|
pressHandler.cleanup();
|
|
178
176
|
pressEndHandler.cleanup();
|
|
179
177
|
};
|
|
180
|
-
}, [svgRef, yAxis, xAxis, voronoiMaxRadius, onItemClick, disableVoronoi,
|
|
178
|
+
}, [svgRef, yAxis, xAxis, voronoiMaxRadius, onItemClick, disableVoronoi, instance, seriesOrder, series, flatbushMap, defaultXAxisId, defaultYAxisId, store]);
|
|
181
179
|
|
|
182
180
|
// Instance implementation
|
|
183
181
|
const enableVoronoiCallback = (0, _useEventCallback.default)(() => {
|
|
@@ -35,8 +35,8 @@ const selectorChartsHighlightScope = exports.selectorChartsHighlightScope = (0,
|
|
|
35
35
|
}
|
|
36
36
|
return highlightScope;
|
|
37
37
|
});
|
|
38
|
-
const selectorChartsIsHighlightedCallback = exports.selectorChartsIsHighlightedCallback = (0, _store.
|
|
39
|
-
const selectorChartsIsFadedCallback = exports.selectorChartsIsFadedCallback = (0, _store.
|
|
38
|
+
const selectorChartsIsHighlightedCallback = exports.selectorChartsIsHighlightedCallback = (0, _store.createSelectorMemoized)(selectorChartsHighlightScope, selectorChartsHighlightedItem, _createIsHighlighted.createIsHighlighted);
|
|
39
|
+
const selectorChartsIsFadedCallback = exports.selectorChartsIsFadedCallback = (0, _store.createSelectorMemoized)(selectorChartsHighlightScope, selectorChartsHighlightedItem, _createIsFaded.createIsFaded);
|
|
40
40
|
const selectorChartsIsHighlighted = exports.selectorChartsIsHighlighted = (0, _store.createSelector)(selectorChartsHighlightScope, selectorChartsHighlightedItem, function selectorChartsIsHighlighted(highlightScope, highlightedItem, item) {
|
|
41
41
|
return (0, _createIsHighlighted.createIsHighlighted)(highlightScope, highlightedItem)(item);
|
|
42
42
|
});
|
|
@@ -11,36 +11,51 @@ var _useChartKeyboardNavigation = require("../useChartKeyboardNavigation");
|
|
|
11
11
|
var _useChartInteraction = require("./useChartInteraction.selectors");
|
|
12
12
|
var _useChartDimensions = require("../../corePlugins/useChartDimensions/useChartDimensions.selectors");
|
|
13
13
|
var _isCartesian = require("../../../isCartesian");
|
|
14
|
+
var _useChartPolarAxis = require("../useChartPolarAxis/useChartPolarAxis.selectors");
|
|
14
15
|
const selectorChartsTooltipItem = exports.selectorChartsTooltipItem = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, _useChartInteraction.selectorChartsInteractionItem, _useChartKeyboardNavigation.selectorChartsKeyboardItem, (lastInteraction, interactionItem, keyboardItem) => lastInteraction === 'keyboard' ? keyboardItem : interactionItem ?? null);
|
|
15
16
|
const selectorChartsTooltipItemIsDefined = exports.selectorChartsTooltipItemIsDefined = (0, _store.createSelector)(_useChartInteraction.selectorChartsLastInteraction, _useChartInteraction.selectorChartsInteractionItemIsDefined, _useChartKeyboardNavigation.selectorChartsKeyboardItemIsDefined, (lastInteraction, interactionItemIsDefined, keyboardItemIsDefined) => lastInteraction === 'keyboard' ? keyboardItemIsDefined : interactionItemIsDefined);
|
|
16
|
-
const
|
|
17
|
+
const selectorChartsTooltipAxisConfig = (0, _store.createSelectorMemoized)(selectorChartsTooltipItem, _useChartCartesianAxisRendering.selectorChartXAxis, _useChartCartesianAxisRendering.selectorChartYAxis, _useChartPolarAxis.selectorChartRotationAxis, _useChartPolarAxis.selectorChartRadiusAxis, _useChartSeries.selectorChartSeriesProcessed, function selectorChartsTooltipAxisConfig(identifier, {
|
|
17
18
|
axis: xAxis,
|
|
18
19
|
axisIds: xAxisIds
|
|
19
20
|
}, {
|
|
20
21
|
axis: yAxis,
|
|
21
22
|
axisIds: yAxisIds
|
|
22
|
-
},
|
|
23
|
+
}, rotationAxes, radiusAxes, series) {
|
|
24
|
+
if (!identifier) {
|
|
25
|
+
return {};
|
|
26
|
+
}
|
|
27
|
+
const itemSeries = series[identifier.type]?.series[identifier.seriesId];
|
|
28
|
+
if (!itemSeries) {
|
|
29
|
+
return {};
|
|
30
|
+
}
|
|
31
|
+
const axesConfig = {
|
|
32
|
+
rotationAxes,
|
|
33
|
+
radiusAxes
|
|
34
|
+
};
|
|
35
|
+
const xAxisId = (0, _isCartesian.isCartesianSeries)(itemSeries) ? itemSeries.xAxisId ?? xAxisIds[0] : undefined;
|
|
36
|
+
const yAxisId = (0, _isCartesian.isCartesianSeries)(itemSeries) ? itemSeries.yAxisId ?? yAxisIds[0] : undefined;
|
|
37
|
+
if (xAxisId !== undefined) {
|
|
38
|
+
axesConfig.x = xAxis[xAxisId];
|
|
39
|
+
}
|
|
40
|
+
if (yAxisId !== undefined) {
|
|
41
|
+
axesConfig.y = yAxis[yAxisId];
|
|
42
|
+
}
|
|
43
|
+
return axesConfig;
|
|
44
|
+
});
|
|
45
|
+
const selectorChartsTooltipItemPosition = exports.selectorChartsTooltipItemPosition = (0, _store.createSelectorMemoized)(selectorChartsTooltipItem, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesConfig, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesLayout, selectorChartsTooltipAxisConfig, function selectorChartsTooltipItemPosition(identifier, drawingArea, seriesConfig, series, seriesLayout, axesConfig, placement = 'top') {
|
|
23
46
|
if (!identifier) {
|
|
24
47
|
return null;
|
|
25
48
|
}
|
|
26
49
|
const itemSeries = series[identifier.type]?.series[identifier.seriesId];
|
|
27
|
-
if (itemSeries) {
|
|
28
|
-
|
|
29
|
-
const xAxisId = (0, _isCartesian.isCartesianSeries)(itemSeries) ? itemSeries.xAxisId ?? xAxisIds[0] : undefined;
|
|
30
|
-
const yAxisId = (0, _isCartesian.isCartesianSeries)(itemSeries) ? itemSeries.yAxisId ?? yAxisIds[0] : undefined;
|
|
31
|
-
if (xAxisId !== undefined) {
|
|
32
|
-
axesConfig.x = xAxis[xAxisId];
|
|
33
|
-
}
|
|
34
|
-
if (yAxisId !== undefined) {
|
|
35
|
-
axesConfig.y = yAxis[yAxisId];
|
|
36
|
-
}
|
|
37
|
-
return seriesConfig[itemSeries.type].tooltipItemPositionGetter?.({
|
|
38
|
-
series,
|
|
39
|
-
drawingArea,
|
|
40
|
-
axesConfig,
|
|
41
|
-
identifier,
|
|
42
|
-
placement
|
|
43
|
-
}) ?? null;
|
|
50
|
+
if (!itemSeries) {
|
|
51
|
+
return null;
|
|
44
52
|
}
|
|
45
|
-
return
|
|
53
|
+
return seriesConfig[itemSeries.type].tooltipItemPositionGetter?.({
|
|
54
|
+
series,
|
|
55
|
+
seriesLayout,
|
|
56
|
+
drawingArea,
|
|
57
|
+
axesConfig,
|
|
58
|
+
identifier,
|
|
59
|
+
placement
|
|
60
|
+
}) ?? null;
|
|
46
61
|
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { UseChartPolarAxisSignature } from "./useChartPolarAxis.types.js";
|
|
2
2
|
import { ChartState } from "../../models/chart.js";
|
|
3
|
+
import type { ChartDrawingArea } from "../../../../hooks/useDrawingArea.js";
|
|
3
4
|
export declare const selectorChartPolarAxisState: (state: ChartState<[], [UseChartPolarAxisSignature]>) => {
|
|
4
5
|
rotation: import("../../../index.js").AxisConfig<import("../../../index.js").ScaleName, any, import("../../../index.js").ChartsRotationAxisProps>[];
|
|
5
6
|
radius: import("../../../index.js").AxisConfig<"linear", any, import("../../../index.js").ChartsRadiusAxisProps>[];
|
|
@@ -19,6 +20,10 @@ export declare const selectorChartRotationAxis: (args_0: import("../../corePlugi
|
|
|
19
20
|
export declare const selectorChartRadiusAxis: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartPolarAxis.types.js").UseChartPolarAxisState> & {
|
|
20
21
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
21
22
|
}) => import("./computeAxisValue.js").ComputeResult<import("../../../index.js").ChartsRadiusAxisProps>;
|
|
23
|
+
export declare function getDrawingAreaCenter(drawingArea: ChartDrawingArea): {
|
|
24
|
+
cx: number;
|
|
25
|
+
cy: number;
|
|
26
|
+
};
|
|
22
27
|
export declare const selectorChartPolarCenter: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
23
28
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
24
29
|
}) => {
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getDrawingAreaCenter = getDrawingAreaCenter;
|
|
6
7
|
exports.selectorChartRotationAxis = exports.selectorChartRawRotationAxis = exports.selectorChartRawRadiusAxis = exports.selectorChartRadiusAxis = exports.selectorChartPolarCenter = exports.selectorChartPolarAxisState = void 0;
|
|
7
8
|
var _store = require("@mui/x-internals/store");
|
|
8
9
|
var _useChartDimensions = require("../../corePlugins/useChartDimensions");
|
|
@@ -17,21 +18,24 @@ const selectorChartRawRadiusAxis = exports.selectorChartRawRadiusAxis = (0, _sto
|
|
|
17
18
|
* The only interesting selectors that merge axis data and zoom if provided.
|
|
18
19
|
*/
|
|
19
20
|
|
|
20
|
-
const selectorChartRotationAxis = exports.selectorChartRotationAxis = (0, _store.
|
|
21
|
+
const selectorChartRotationAxis = exports.selectorChartRotationAxis = (0, _store.createSelectorMemoized)(selectorChartRawRotationAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, (axis, drawingArea, formattedSeries, seriesConfig) => (0, _computeAxisValue.computeAxisValue)({
|
|
21
22
|
drawingArea,
|
|
22
23
|
formattedSeries,
|
|
23
24
|
axis,
|
|
24
25
|
seriesConfig,
|
|
25
26
|
axisDirection: 'rotation'
|
|
26
27
|
}));
|
|
27
|
-
const selectorChartRadiusAxis = exports.selectorChartRadiusAxis = (0, _store.
|
|
28
|
+
const selectorChartRadiusAxis = exports.selectorChartRadiusAxis = (0, _store.createSelectorMemoized)(selectorChartRawRadiusAxis, _useChartDimensions.selectorChartDrawingArea, _useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, (axis, drawingArea, formattedSeries, seriesConfig) => (0, _computeAxisValue.computeAxisValue)({
|
|
28
29
|
drawingArea,
|
|
29
30
|
formattedSeries,
|
|
30
31
|
axis,
|
|
31
32
|
seriesConfig,
|
|
32
33
|
axisDirection: 'radius'
|
|
33
34
|
}));
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
35
|
+
function getDrawingAreaCenter(drawingArea) {
|
|
36
|
+
return {
|
|
37
|
+
cx: drawingArea.left + drawingArea.width / 2,
|
|
38
|
+
cy: drawingArea.top + drawingArea.height / 2
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
const selectorChartPolarCenter = exports.selectorChartPolarCenter = (0, _store.createSelectorMemoized)(_useChartDimensions.selectorChartDrawingArea, getDrawingAreaCenter);
|
|
@@ -3,6 +3,7 @@ export * from "./cartesianExtremumGetter.types.js";
|
|
|
3
3
|
export * from "./polarExtremumGetter.types.js";
|
|
4
4
|
export * from "./seriesConfig.types.js";
|
|
5
5
|
export * from "./seriesProcessor.types.js";
|
|
6
|
+
export * from "./seriesLayout.types.js";
|
|
6
7
|
export * from "./tooltipGetter.types.js";
|
|
7
8
|
export * from "./tooltipItemPositionGetter.types.js";
|
|
8
9
|
export * from "./legendGetter.types.js";
|
|
@@ -58,6 +58,17 @@ Object.keys(_seriesProcessor).forEach(function (key) {
|
|
|
58
58
|
}
|
|
59
59
|
});
|
|
60
60
|
});
|
|
61
|
+
var _seriesLayout = require("./seriesLayout.types");
|
|
62
|
+
Object.keys(_seriesLayout).forEach(function (key) {
|
|
63
|
+
if (key === "default" || key === "__esModule") return;
|
|
64
|
+
if (key in exports && exports[key] === _seriesLayout[key]) return;
|
|
65
|
+
Object.defineProperty(exports, key, {
|
|
66
|
+
enumerable: true,
|
|
67
|
+
get: function () {
|
|
68
|
+
return _seriesLayout[key];
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
61
72
|
var _tooltipGetter = require("./tooltipGetter.types");
|
|
62
73
|
Object.keys(_tooltipGetter).forEach(function (key) {
|
|
63
74
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -7,8 +7,13 @@ import type { AxisTooltipGetter, TooltipGetter } from "./tooltipGetter.types.js"
|
|
|
7
7
|
import { PolarExtremumGetter } from "./polarExtremumGetter.types.js";
|
|
8
8
|
import { GetSeriesWithDefaultValues } from "./getSeriesWithDefaultValues.types.js";
|
|
9
9
|
import { TooltipItemPositionGetter } from "./tooltipItemPositionGetter.types.js";
|
|
10
|
+
import { SeriesLayoutGetter } from "./seriesLayout.types.js";
|
|
10
11
|
export type ChartSeriesTypeConfig<TSeriesType extends ChartSeriesType> = {
|
|
11
12
|
seriesProcessor: SeriesProcessor<TSeriesType>;
|
|
13
|
+
/**
|
|
14
|
+
* A processor to add series layout when the layout does not depend from other series.
|
|
15
|
+
*/
|
|
16
|
+
seriesLayout?: SeriesLayoutGetter<TSeriesType>;
|
|
12
17
|
colorProcessor: ColorProcessor<TSeriesType>;
|
|
13
18
|
legendGetter: LegendGetter<TSeriesType>;
|
|
14
19
|
tooltipGetter: TooltipGetter<TSeriesType>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { ChartSeriesType, ChartSeriesLayout } from "../../../../models/seriesType/config.js";
|
|
2
|
+
import { ChartDrawingArea } from "../../../../hooks/useDrawingArea.js";
|
|
3
|
+
import type { SeriesId } from "../../../../models/seriesType/common.js";
|
|
4
|
+
import { SeriesProcessorResult } from "./seriesProcessor.types.js";
|
|
5
|
+
export type SeriesLayoutGetterResult<TSeriesType extends ChartSeriesType> = Record<SeriesId, ChartSeriesLayout<TSeriesType>>;
|
|
6
|
+
export type SeriesLayoutGetter<TSeriesType extends ChartSeriesType> = (params: SeriesProcessorResult<TSeriesType>, drawingArea: Readonly<ChartDrawingArea>) => SeriesLayoutGetterResult<TSeriesType>;
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
import type { ChartItemIdentifierWithData, ChartSeriesType } from "../../../../models/seriesType/config.js";
|
|
2
|
-
import { ChartsRotationAxisProps, ChartsRadiusAxisProps,
|
|
2
|
+
import { ChartsRotationAxisProps, ChartsRadiusAxisProps, ComputedXAxis, ComputedYAxis } from "../../../../models/axis.js";
|
|
3
3
|
import { ChartDrawingArea } from "../../../../hooks/useDrawingArea.js";
|
|
4
|
-
import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
|
|
4
|
+
import { ProcessedSeries, SeriesLayout } from "../../corePlugins/useChartSeries/index.js";
|
|
5
|
+
import { ComputeResult } from "../../featurePlugins/useChartPolarAxis/computeAxisValue.js";
|
|
5
6
|
export interface TooltipPositionGetterAxesConfig {
|
|
6
7
|
x?: ComputedXAxis;
|
|
7
8
|
y?: ComputedYAxis;
|
|
8
|
-
|
|
9
|
-
|
|
9
|
+
rotationAxes?: ComputeResult<ChartsRotationAxisProps>;
|
|
10
|
+
radiusAxes?: ComputeResult<ChartsRadiusAxisProps>;
|
|
10
11
|
}
|
|
11
12
|
export type TooltipItemPositionGetter<TSeriesType extends ChartSeriesType> = (params: {
|
|
12
13
|
series: ProcessedSeries<TSeriesType>;
|
|
13
14
|
axesConfig: TooltipPositionGetterAxesConfig;
|
|
14
15
|
drawingArea: ChartDrawingArea;
|
|
15
16
|
identifier: ChartItemIdentifierWithData<TSeriesType> | null;
|
|
17
|
+
seriesLayout: SeriesLayout<TSeriesType>;
|
|
16
18
|
/**
|
|
17
19
|
* The preferred placement of the tooltip related to the element.
|
|
18
20
|
* @default 'top'
|
|
@@ -3,10 +3,10 @@ import { SeriesId } from "../models/seriesType/common.js";
|
|
|
3
3
|
import type { ProcessedSeries } from "./plugins/corePlugins/useChartSeries/index.js";
|
|
4
4
|
export declare const selectorAllSeriesOfType: (args_0: import("./plugins/corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("./plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./plugins/corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./plugins/corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof ChartsSeriesConfig> & import("./plugins/corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("./index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
5
5
|
cacheKey: import("./index.js").ChartStateCacheKey;
|
|
6
|
-
}, seriesType: keyof ChartsSeriesConfig) => import("./index.js").SeriesProcessorResult<"line"> |
|
|
6
|
+
}, seriesType: keyof ChartsSeriesConfig) => import("./index.js").SeriesProcessorResult<"line"> | {
|
|
7
7
|
series: Record<SeriesId, import("../index.js").DefaultizedScatterSeriesType>;
|
|
8
8
|
seriesOrder: SeriesId[];
|
|
9
|
-
} | {
|
|
9
|
+
} | import("./index.js").SeriesProcessorResult<"bar"> | {
|
|
10
10
|
series: Record<SeriesId, import("../index.js").DefaultizedPieSeriesType>;
|
|
11
11
|
seriesOrder: SeriesId[];
|
|
12
12
|
} | {
|
|
@@ -11,7 +11,7 @@ var _useStore = require("./store/useStore");
|
|
|
11
11
|
var _useSelector = require("./store/useSelector");
|
|
12
12
|
const selectorAllSeriesOfType = exports.selectorAllSeriesOfType = (0, _store.createSelector)(_useChartSeries.selectorChartSeriesProcessed, (processedSeries, seriesType) => processedSeries[seriesType]);
|
|
13
13
|
const selectorSeriesOfType = exports.selectorSeriesOfType = (0, _store.createSelectorMemoized)(_useChartSeries.selectorChartSeriesProcessed, (processedSeries, seriesType, ids) => {
|
|
14
|
-
if (
|
|
14
|
+
if (ids === undefined || Array.isArray(ids) && ids.length === 0) {
|
|
15
15
|
return processedSeries[seriesType]?.seriesOrder?.map(seriesId => processedSeries[seriesType]?.series[seriesId]) ?? [];
|
|
16
16
|
}
|
|
17
17
|
if (!Array.isArray(ids)) {
|
package/models/axis.d.ts
CHANGED
|
@@ -77,6 +77,11 @@ export interface ChartsAxisProps extends TickParams {
|
|
|
77
77
|
* @default 'auto'
|
|
78
78
|
*/
|
|
79
79
|
tickLabelInterval?: 'auto' | ((value: any, index: number) => boolean);
|
|
80
|
+
/**
|
|
81
|
+
* The minimum space between ticks when using an ordinal scale. It defines the minimum distance in pixels between two ticks.
|
|
82
|
+
* @default 0
|
|
83
|
+
*/
|
|
84
|
+
tickSpacing?: number;
|
|
80
85
|
/**
|
|
81
86
|
* The label of the axis.
|
|
82
87
|
*/
|
|
@@ -2,12 +2,13 @@ import { DefaultizedProps } from '@mui/x-internals/types';
|
|
|
2
2
|
import type { StackOffsetType } from "../stacking.js";
|
|
3
3
|
import { CartesianSeriesType, CommonSeriesType, CommonDefaultizedProps, StackableSeriesType, SeriesId } from "./common.js";
|
|
4
4
|
import { BarItem, BarLabelContext } from "../../BarChart/index.js";
|
|
5
|
-
export
|
|
5
|
+
export type BarValueType = number;
|
|
6
|
+
export interface BarSeriesType extends CommonSeriesType<BarValueType | null>, CartesianSeriesType, StackableSeriesType {
|
|
6
7
|
type: 'bar';
|
|
7
8
|
/**
|
|
8
9
|
* Data associated to each bar.
|
|
9
10
|
*/
|
|
10
|
-
data?:
|
|
11
|
+
data?: ReadonlyArray<BarValueType | null>;
|
|
11
12
|
/**
|
|
12
13
|
* The key used to retrieve data from the dataset.
|
|
13
14
|
*/
|
|
@@ -15,6 +15,11 @@ export interface ChartsSeriesConfig {
|
|
|
15
15
|
* Series type when stored in the context (with all the preprocessing added))
|
|
16
16
|
*/
|
|
17
17
|
series: DefaultizedBarSeriesType;
|
|
18
|
+
/**
|
|
19
|
+
* Additional data computed from the series plus drawing area.
|
|
20
|
+
* Useful for special charts like sankey where the series data is not sufficient to draw the series.
|
|
21
|
+
* */
|
|
22
|
+
seriesLayout: {};
|
|
18
23
|
/**
|
|
19
24
|
* Series typing such that the one user need to provide
|
|
20
25
|
*/
|
|
@@ -28,6 +33,7 @@ export interface ChartsSeriesConfig {
|
|
|
28
33
|
line: {
|
|
29
34
|
seriesInput: DefaultizedProps<LineSeriesType, 'id'> & MakeRequired<SeriesColor<number | null>, 'color'>;
|
|
30
35
|
series: DefaultizedLineSeriesType;
|
|
36
|
+
seriesLayout: {};
|
|
31
37
|
seriesProp: LineSeriesType;
|
|
32
38
|
itemIdentifier: LineItemIdentifier;
|
|
33
39
|
itemIdentifierWithData: LineItemIdentifier;
|
|
@@ -38,6 +44,7 @@ export interface ChartsSeriesConfig {
|
|
|
38
44
|
scatter: {
|
|
39
45
|
seriesInput: DefaultizedProps<ScatterSeriesType, 'id'> & MakeRequired<SeriesColor<ScatterValueType | null>, 'color'>;
|
|
40
46
|
series: DefaultizedScatterSeriesType;
|
|
47
|
+
seriesLayout: {};
|
|
41
48
|
seriesProp: ScatterSeriesType;
|
|
42
49
|
valueType: ScatterValueType;
|
|
43
50
|
itemIdentifier: ScatterItemIdentifier;
|
|
@@ -49,6 +56,7 @@ export interface ChartsSeriesConfig {
|
|
|
49
56
|
data: Array<MakeOptional<PieValueType, 'id'> & MakeRequired<SeriesColor<PieValueType | null>, 'color'>>;
|
|
50
57
|
};
|
|
51
58
|
series: DefaultizedPieSeriesType;
|
|
59
|
+
seriesLayout: {};
|
|
52
60
|
seriesProp: PieSeriesType<MakeOptional<PieValueType, 'id'>>;
|
|
53
61
|
itemIdentifier: PieItemIdentifier;
|
|
54
62
|
itemIdentifierWithData: PieItemIdentifier;
|
|
@@ -57,6 +65,7 @@ export interface ChartsSeriesConfig {
|
|
|
57
65
|
radar: {
|
|
58
66
|
seriesInput: DefaultizedProps<RadarSeriesType, 'id'> & MakeRequired<SeriesColor<number>, 'color'>;
|
|
59
67
|
series: DefaultizedRadarSeriesType;
|
|
68
|
+
seriesLayout: {};
|
|
60
69
|
seriesProp: RadarSeriesType;
|
|
61
70
|
itemIdentifier: RadarItemIdentifier;
|
|
62
71
|
itemIdentifierWithData: RadarItemIdentifier;
|
|
@@ -80,6 +89,7 @@ export type ChartSeriesDefaultized<T extends ChartSeriesType> = ChartsSeriesConf
|
|
|
80
89
|
} ? ChartsSeriesConfig[T]['series'] & {
|
|
81
90
|
stackedData: [number, number][];
|
|
82
91
|
} : ChartsSeriesConfig[T]['series'];
|
|
92
|
+
export type ChartSeriesLayout<T extends ChartSeriesType> = ChartsSeriesConfig[T] extends any ? ChartsSeriesConfig[T]['seriesLayout'] : never;
|
|
83
93
|
export type ChartItemIdentifier<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
|
|
84
94
|
export type ChartItemIdentifierWithData<T extends ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifierWithData'];
|
|
85
95
|
export type DatasetElementType<T> = {
|
|
@@ -19,6 +19,7 @@ type DefaultizedCartesianSeriesType = DefaultizedSeriesType<CartesianChartSeries
|
|
|
19
19
|
type StackableSeriesType = DefaultizedSeriesType<StackableChartSeriesType>;
|
|
20
20
|
export type SeriesItemIdentifier<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifier'];
|
|
21
21
|
export type SeriesItemIdentifierWithData<T extends ChartSeriesType = ChartSeriesType> = ChartsSeriesConfig[T]['itemIdentifierWithData'];
|
|
22
|
+
export { type SeriesId } from "./common.js";
|
|
22
23
|
export * from "./line.js";
|
|
23
24
|
export * from "./bar.js";
|
|
24
25
|
export * from "./scatter.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.21.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The community edition of MUI X Charts components.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -35,9 +35,9 @@
|
|
|
35
35
|
"prop-types": "^15.8.1",
|
|
36
36
|
"reselect": "^5.1.1",
|
|
37
37
|
"use-sync-external-store": "^1.6.0",
|
|
38
|
-
"@mui/x-
|
|
39
|
-
"@mui/x-
|
|
40
|
-
"@mui/x-
|
|
38
|
+
"@mui/x-charts-vendor": "8.21.0",
|
|
39
|
+
"@mui/x-internals": "8.21.0",
|
|
40
|
+
"@mui/x-internal-gestures": "0.3.6"
|
|
41
41
|
},
|
|
42
42
|
"peerDependencies": {
|
|
43
43
|
"@emotion/react": "^11.9.0",
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AxisId, ComputedXAxis, ComputedYAxis } from "../models/axis.js";
|
|
2
|
-
import { DefaultizedBarSeriesType } from "../models/seriesType/bar.js";
|
|
3
|
-
import { SeriesId } from "../models/seriesType/common.js";
|
|
4
|
-
export declare function checkScaleErrors(verticalLayout: boolean, seriesId: SeriesId, series: DefaultizedBarSeriesType & {
|
|
5
|
-
stackedData: [number, number][];
|
|
6
|
-
}, xAxisId: AxisId, xAxis: {
|
|
7
|
-
[axisId: AxisId]: ComputedXAxis;
|
|
8
|
-
}, yAxisId: AxisId, yAxis: {
|
|
9
|
-
[axisId: AxisId]: ComputedYAxis;
|
|
10
|
-
}): void;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { AxisId, ComputedXAxis, ComputedYAxis } from "../models/axis.js";
|
|
2
|
-
import { DefaultizedBarSeriesType } from "../models/seriesType/bar.js";
|
|
3
|
-
import { SeriesId } from "../models/seriesType/common.js";
|
|
4
|
-
export declare function checkScaleErrors(verticalLayout: boolean, seriesId: SeriesId, series: DefaultizedBarSeriesType & {
|
|
5
|
-
stackedData: [number, number][];
|
|
6
|
-
}, xAxisId: AxisId, xAxis: {
|
|
7
|
-
[axisId: AxisId]: ComputedXAxis;
|
|
8
|
-
}, yAxisId: AxisId, yAxis: {
|
|
9
|
-
[axisId: AxisId]: ComputedYAxis;
|
|
10
|
-
}): void;
|