@mui/x-charts 8.17.0 → 8.19.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/BarLabel/BarLabel.d.ts +7 -1
- package/BarChart/BarLabel/BarLabel.js +41 -4
- package/BarChart/BarLabel/BarLabelItem.d.ts +6 -0
- package/BarChart/BarLabel/BarLabelItem.js +4 -2
- package/BarChart/BarLabel/BarLabelPlot.js +2 -3
- package/BarChart/BarPlot.js +5 -0
- package/BarChart/seriesConfig/bar/seriesProcessor.js +15 -9
- package/BarChart/types.d.ts +1 -0
- package/BarChart/useBarPlotData.js +3 -2
- package/CHANGELOG.md +213 -0
- package/ChartsSurface/ChartsSurface.js +5 -2
- package/LineChart/seriesConfig/seriesProcessor.js +15 -10
- package/PieChart/PieArcPlot.js +5 -3
- package/esm/BarChart/BarLabel/BarLabel.d.ts +7 -1
- package/esm/BarChart/BarLabel/BarLabel.js +41 -4
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +6 -0
- package/esm/BarChart/BarLabel/BarLabelItem.js +4 -2
- package/esm/BarChart/BarLabel/BarLabelPlot.js +2 -2
- package/esm/BarChart/BarPlot.js +5 -0
- package/esm/BarChart/seriesConfig/bar/seriesProcessor.js +15 -9
- package/esm/BarChart/types.d.ts +1 -0
- package/esm/BarChart/useBarPlotData.js +3 -2
- package/esm/ChartsSurface/ChartsSurface.js +5 -2
- package/esm/LineChart/seriesConfig/seriesProcessor.js +15 -10
- package/esm/PieChart/PieArcPlot.js +5 -3
- package/esm/hooks/animation/useAnimateBarLabel.d.ts +1 -1
- package/esm/hooks/animation/useAnimateBarLabel.js +61 -12
- package/esm/hooks/useAxis.d.ts +116 -16
- package/esm/hooks/useAxis.js +122 -18
- package/esm/hooks/useBarSeries.js +3 -5
- package/esm/hooks/useLineSeries.js +3 -5
- package/esm/hooks/usePieSeries.js +3 -5
- package/esm/hooks/useRadarSeries.js +3 -5
- package/esm/hooks/useScale.d.ts +25 -6
- package/esm/hooks/useScale.js +29 -8
- package/esm/hooks/useScatterSeries.js +3 -5
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/internals/domUtils.js +30 -14
- package/esm/internals/getScale.d.ts +2 -1
- package/esm/internals/index.d.ts +1 -1
- package/esm/internals/index.js +1 -1
- package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.js +2 -2
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +5 -6
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +2 -2
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +2 -2
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +3 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +4 -4
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +15 -15
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +5 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +11 -11
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +5 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +7 -8
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +11 -12
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +8 -8
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +4 -4
- package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +11 -11
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +6 -6
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +7 -8
- package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.js +2 -2
- package/esm/internals/plugins/utils/selectors.d.ts +1 -14
- package/esm/internals/plugins/utils/selectors.js +1 -5
- package/esm/internals/seriesSelectorOfType.d.ts +20 -0
- package/esm/internals/seriesSelectorOfType.js +38 -0
- package/esm/models/seriesType/bar.d.ts +7 -0
- package/esm/models/seriesType/config.d.ts +2 -2
- package/esm/utils/index.d.ts +4 -0
- package/esm/utils/index.js +5 -0
- package/esm/utils/niceDomain.d.ts +20 -0
- package/esm/utils/niceDomain.js +24 -0
- package/hooks/animation/useAnimateBarLabel.d.ts +1 -1
- package/hooks/animation/useAnimateBarLabel.js +61 -12
- package/hooks/useAxis.d.ts +116 -16
- package/hooks/useAxis.js +122 -18
- package/hooks/useBarSeries.js +3 -6
- package/hooks/useLineSeries.js +3 -6
- package/hooks/usePieSeries.js +3 -6
- package/hooks/useRadarSeries.js +3 -6
- package/hooks/useScale.d.ts +25 -6
- package/hooks/useScale.js +29 -8
- package/hooks/useScatterSeries.js +3 -6
- package/index.d.ts +2 -1
- package/index.js +13 -1
- package/internals/domUtils.js +30 -14
- package/internals/getScale.d.ts +2 -1
- package/internals/index.d.ts +1 -1
- package/internals/index.js +4 -4
- package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.js +2 -2
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +4 -5
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +2 -2
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.js +2 -2
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +3 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.js +4 -4
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +15 -15
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +5 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +11 -11
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +4 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +6 -7
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +2 -2
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +2 -2
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -11
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +8 -8
- package/internals/plugins/featurePlugins/useChartInteraction/useChartTooltip.selectors.js +4 -4
- package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +11 -11
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.js +6 -6
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +6 -7
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.js +2 -2
- package/internals/plugins/utils/selectors.d.ts +1 -14
- package/internals/plugins/utils/selectors.js +1 -8
- package/internals/seriesSelectorOfType.d.ts +20 -0
- package/internals/seriesSelectorOfType.js +46 -0
- package/models/seriesType/bar.d.ts +7 -0
- package/models/seriesType/config.d.ts +2 -2
- package/package.json +5 -5
- package/utils/index.d.ts +4 -0
- package/utils/index.js +16 -0
- package/utils/niceDomain.d.ts +20 -0
- package/utils/niceDomain.js +29 -0
- package/esm/internals/createSeriesSelectorOfType.d.ts +0 -4
- package/esm/internals/createSeriesSelectorOfType.js +0 -45
- package/internals/createSeriesSelectorOfType.d.ts +0 -4
- package/internals/createSeriesSelectorOfType.js +0 -53
package/hooks/useLineSeries.js
CHANGED
|
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useLineSeries = useLineSeries;
|
|
8
8
|
exports.useLineSeriesContext = useLineSeriesContext;
|
|
9
|
-
var
|
|
10
|
-
const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('line');
|
|
11
|
-
const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('line');
|
|
12
|
-
|
|
9
|
+
var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
|
|
13
10
|
/**
|
|
14
11
|
* Get access to the internal state of line series.
|
|
15
12
|
*
|
|
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
|
|
|
33
30
|
*/
|
|
34
31
|
|
|
35
32
|
function useLineSeries(seriesIds) {
|
|
36
|
-
return
|
|
33
|
+
return (0, _seriesSelectorOfType.useSeriesOfType)('line', seriesIds);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
/**
|
|
@@ -45,5 +42,5 @@ function useLineSeries(seriesIds) {
|
|
|
45
42
|
* @returns the line series
|
|
46
43
|
*/
|
|
47
44
|
function useLineSeriesContext() {
|
|
48
|
-
return
|
|
45
|
+
return (0, _seriesSelectorOfType.useAllSeriesOfType)('line');
|
|
49
46
|
}
|
package/hooks/usePieSeries.js
CHANGED
|
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.usePieSeries = usePieSeries;
|
|
8
8
|
exports.usePieSeriesContext = usePieSeriesContext;
|
|
9
|
-
var
|
|
10
|
-
const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('pie');
|
|
11
|
-
const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('pie');
|
|
12
|
-
|
|
9
|
+
var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
|
|
13
10
|
/**
|
|
14
11
|
* Get access to the internal state of pie series.
|
|
15
12
|
*
|
|
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
|
|
|
33
30
|
*/
|
|
34
31
|
|
|
35
32
|
function usePieSeries(seriesIds) {
|
|
36
|
-
return
|
|
33
|
+
return (0, _seriesSelectorOfType.useSeriesOfType)('pie', seriesIds);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
/**
|
|
@@ -44,5 +41,5 @@ function usePieSeries(seriesIds) {
|
|
|
44
41
|
* @returns the pie series
|
|
45
42
|
*/
|
|
46
43
|
function usePieSeriesContext() {
|
|
47
|
-
return
|
|
44
|
+
return (0, _seriesSelectorOfType.useAllSeriesOfType)('pie');
|
|
48
45
|
}
|
package/hooks/useRadarSeries.js
CHANGED
|
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useRadarSeries = useRadarSeries;
|
|
8
8
|
exports.useRadarSeriesContext = useRadarSeriesContext;
|
|
9
|
-
var
|
|
10
|
-
const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('radar');
|
|
11
|
-
const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('radar');
|
|
12
|
-
|
|
9
|
+
var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
|
|
13
10
|
/**
|
|
14
11
|
* Get access to the internal state of radar series.
|
|
15
12
|
*
|
|
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
|
|
|
33
30
|
*/
|
|
34
31
|
|
|
35
32
|
function useRadarSeries(seriesIds) {
|
|
36
|
-
return
|
|
33
|
+
return (0, _seriesSelectorOfType.useSeriesOfType)('radar', seriesIds);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
/**
|
|
@@ -44,5 +41,5 @@ function useRadarSeries(seriesIds) {
|
|
|
44
41
|
* @returns the radar series
|
|
45
42
|
*/
|
|
46
43
|
function useRadarSeriesContext() {
|
|
47
|
-
return
|
|
44
|
+
return (0, _seriesSelectorOfType.useAllSeriesOfType)('radar');
|
|
48
45
|
}
|
package/hooks/useScale.d.ts
CHANGED
|
@@ -13,16 +13,35 @@ export declare function getValueToPositionMapper<Domain extends {
|
|
|
13
13
|
/**
|
|
14
14
|
* Get the X scale.
|
|
15
15
|
*
|
|
16
|
-
* @param
|
|
17
|
-
*
|
|
16
|
+
* @param axisId - The axis identifier. Can be:
|
|
17
|
+
* - A string or number matching the axis ID defined in the chart's `xAxis` prop
|
|
18
|
+
* - Undefined to get the default (first) X axis
|
|
19
|
+
* @returns The X axis scale
|
|
18
20
|
*/
|
|
19
21
|
export declare function useXScale<S extends ScaleName>(axisId?: AxisId): AxisScaleConfig[S]['scale'];
|
|
20
22
|
/**
|
|
21
23
|
* Get the Y scale.
|
|
22
24
|
*
|
|
23
|
-
* @param
|
|
24
|
-
*
|
|
25
|
+
* @param axisId - The axis identifier. Can be:
|
|
26
|
+
* - A string or number matching the axis ID defined in the chart's `yAxis` prop
|
|
27
|
+
* - Undefined to get the default (first) Y axis
|
|
28
|
+
* @returns The Y axis scale
|
|
25
29
|
*/
|
|
26
30
|
export declare function useYScale<S extends ScaleName>(axisId?: AxisId): AxisScaleConfig[S]['scale'];
|
|
27
|
-
|
|
28
|
-
|
|
31
|
+
/**
|
|
32
|
+
* Get the rotation scale.
|
|
33
|
+
*
|
|
34
|
+
* @param axisId - The axis identifier. Can be:
|
|
35
|
+
* - A string or number matching the axis ID defined in the chart's `rotationAxis` prop
|
|
36
|
+
* - Undefined to get the default rotation axis
|
|
37
|
+
* @returns The rotation axis scale, or undefined if not found
|
|
38
|
+
*/
|
|
39
|
+
export declare function useRotationScale<S extends ScaleName>(axisId?: number | string): AxisScaleConfig[S]['scale'] | undefined;
|
|
40
|
+
/**
|
|
41
|
+
* Get the radius scale.
|
|
42
|
+
* @param axisId - The axis identifier. Can be:
|
|
43
|
+
* - A string or number matching the axis ID defined in the chart's `radiusAxis` prop
|
|
44
|
+
* - Undefined to get the default radius axis
|
|
45
|
+
* @returns The radius axis scale, or undefined if not found
|
|
46
|
+
*/
|
|
47
|
+
export declare function useRadiusScale<S extends ScaleName>(axisId?: number | string): AxisScaleConfig[S]['scale'] | undefined;
|
package/hooks/useScale.js
CHANGED
|
@@ -33,8 +33,10 @@ function getValueToPositionMapper(scale) {
|
|
|
33
33
|
/**
|
|
34
34
|
* Get the X scale.
|
|
35
35
|
*
|
|
36
|
-
* @param
|
|
37
|
-
*
|
|
36
|
+
* @param axisId - The axis identifier. Can be:
|
|
37
|
+
* - A string or number matching the axis ID defined in the chart's `xAxis` prop
|
|
38
|
+
* - Undefined to get the default (first) X axis
|
|
39
|
+
* @returns The X axis scale
|
|
38
40
|
*/
|
|
39
41
|
function useXScale(axisId) {
|
|
40
42
|
const axis = (0, _useAxis.useXAxis)(axisId);
|
|
@@ -44,18 +46,37 @@ function useXScale(axisId) {
|
|
|
44
46
|
/**
|
|
45
47
|
* Get the Y scale.
|
|
46
48
|
*
|
|
47
|
-
* @param
|
|
48
|
-
*
|
|
49
|
+
* @param axisId - The axis identifier. Can be:
|
|
50
|
+
* - A string or number matching the axis ID defined in the chart's `yAxis` prop
|
|
51
|
+
* - Undefined to get the default (first) Y axis
|
|
52
|
+
* @returns The Y axis scale
|
|
49
53
|
*/
|
|
50
54
|
function useYScale(axisId) {
|
|
51
55
|
const axis = (0, _useAxis.useYAxis)(axisId);
|
|
52
56
|
return axis.scale;
|
|
53
57
|
}
|
|
54
|
-
|
|
55
|
-
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* Get the rotation scale.
|
|
61
|
+
*
|
|
62
|
+
* @param axisId - The axis identifier. Can be:
|
|
63
|
+
* - A string or number matching the axis ID defined in the chart's `rotationAxis` prop
|
|
64
|
+
* - Undefined to get the default rotation axis
|
|
65
|
+
* @returns The rotation axis scale, or undefined if not found
|
|
66
|
+
*/
|
|
67
|
+
function useRotationScale(axisId) {
|
|
68
|
+
const axis = (0, _useAxis.useRotationAxis)(axisId);
|
|
56
69
|
return axis?.scale;
|
|
57
70
|
}
|
|
58
|
-
|
|
59
|
-
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* Get the radius scale.
|
|
74
|
+
* @param axisId - The axis identifier. Can be:
|
|
75
|
+
* - A string or number matching the axis ID defined in the chart's `radiusAxis` prop
|
|
76
|
+
* - Undefined to get the default radius axis
|
|
77
|
+
* @returns The radius axis scale, or undefined if not found
|
|
78
|
+
*/
|
|
79
|
+
function useRadiusScale(axisId) {
|
|
80
|
+
const axis = (0, _useAxis.useRadiusAxis)(axisId);
|
|
60
81
|
return axis?.scale;
|
|
61
82
|
}
|
|
@@ -6,10 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.useScatterSeries = useScatterSeries;
|
|
8
8
|
exports.useScatterSeriesContext = useScatterSeriesContext;
|
|
9
|
-
var
|
|
10
|
-
const useSelectorSeries = (0, _createSeriesSelectorOfType.createSeriesSelectorsOfType)('scatter');
|
|
11
|
-
const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeriesSelectorOfType)('scatter');
|
|
12
|
-
|
|
9
|
+
var _seriesSelectorOfType = require("../internals/seriesSelectorOfType");
|
|
13
10
|
/**
|
|
14
11
|
* Get access to the internal state of scatter series.
|
|
15
12
|
*
|
|
@@ -33,7 +30,7 @@ const useSelectorSeriesContext = (0, _createSeriesSelectorOfType.createAllSeries
|
|
|
33
30
|
*/
|
|
34
31
|
|
|
35
32
|
function useScatterSeries(seriesIds) {
|
|
36
|
-
return
|
|
33
|
+
return (0, _seriesSelectorOfType.useSeriesOfType)('scatter', seriesIds);
|
|
37
34
|
}
|
|
38
35
|
|
|
39
36
|
/**
|
|
@@ -44,5 +41,5 @@ function useScatterSeries(seriesIds) {
|
|
|
44
41
|
* @returns the scatter series
|
|
45
42
|
*/
|
|
46
43
|
function useScatterSeriesContext() {
|
|
47
|
-
return
|
|
44
|
+
return (0, _seriesSelectorOfType.useAllSeriesOfType)('scatter');
|
|
48
45
|
}
|
package/index.d.ts
CHANGED
|
@@ -29,4 +29,5 @@ export type { ChartContainerProps } from "./ChartContainer/index.js";
|
|
|
29
29
|
export * from "./ChartDataProvider/index.js";
|
|
30
30
|
export * from "./Toolbar/index.js";
|
|
31
31
|
export * from "./ChartsWrapper/index.js";
|
|
32
|
-
export * from "./ChartsBrushOverlay/index.js";
|
|
32
|
+
export * from "./ChartsBrushOverlay/index.js";
|
|
33
|
+
export * from "./utils/index.js";
|
package/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v8.
|
|
2
|
+
* @mui/x-charts v8.19.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -379,4 +379,16 @@ Object.keys(_ChartsBrushOverlay).forEach(function (key) {
|
|
|
379
379
|
return _ChartsBrushOverlay[key];
|
|
380
380
|
}
|
|
381
381
|
});
|
|
382
|
+
});
|
|
383
|
+
var _utils = require("./utils");
|
|
384
|
+
Object.keys(_utils).forEach(function (key) {
|
|
385
|
+
if (key === "default" || key === "__esModule") return;
|
|
386
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
387
|
+
if (key in exports && exports[key] === _utils[key]) return;
|
|
388
|
+
Object.defineProperty(exports, key, {
|
|
389
|
+
enumerable: true,
|
|
390
|
+
get: function () {
|
|
391
|
+
return _utils[key];
|
|
392
|
+
}
|
|
393
|
+
});
|
|
382
394
|
});
|
package/internals/domUtils.js
CHANGED
|
@@ -96,11 +96,7 @@ const getStringSize = (text, style = {}) => {
|
|
|
96
96
|
});
|
|
97
97
|
measurementElem.textContent = str;
|
|
98
98
|
measurementSpanContainer.replaceChildren(measurementElem);
|
|
99
|
-
const
|
|
100
|
-
const result = {
|
|
101
|
-
width: rect.width,
|
|
102
|
-
height: rect.height
|
|
103
|
-
};
|
|
99
|
+
const result = measureSVGTextElement(measurementElem);
|
|
104
100
|
stringCache.set(cacheKey, result);
|
|
105
101
|
if (stringCache.size + 1 > MAX_CACHE_NUM) {
|
|
106
102
|
stringCache.clear();
|
|
@@ -145,21 +141,17 @@ function batchMeasureStrings(texts, style = {}) {
|
|
|
145
141
|
measurementContainer.style[camelCaseToDashCase(styleKey)] = convertPixelValue(styleKey, measurementSpanStyle[styleKey]);
|
|
146
142
|
return styleKey;
|
|
147
143
|
});
|
|
148
|
-
const
|
|
144
|
+
const measurementElements = [];
|
|
149
145
|
for (const string of textToMeasure) {
|
|
150
146
|
const measurementElem = document.createElementNS('http://www.w3.org/2000/svg', 'text');
|
|
151
147
|
measurementElem.textContent = `${string}`;
|
|
152
|
-
|
|
148
|
+
measurementElements.push(measurementElem);
|
|
153
149
|
}
|
|
154
|
-
measurementContainer.replaceChildren(...
|
|
150
|
+
measurementContainer.replaceChildren(...measurementElements);
|
|
155
151
|
for (let i = 0; i < textToMeasure.length; i += 1) {
|
|
156
152
|
const text = textToMeasure[i];
|
|
157
|
-
const
|
|
158
|
-
const
|
|
159
|
-
const result = {
|
|
160
|
-
width: rect.width,
|
|
161
|
-
height: rect.height
|
|
162
|
-
};
|
|
153
|
+
const measurementElem = measurementContainer.children[i];
|
|
154
|
+
const result = measureSVGTextElement(measurementElem);
|
|
163
155
|
const cacheKey = `${text}-${styleString}`;
|
|
164
156
|
stringCache.set(cacheKey, result);
|
|
165
157
|
sizeMap.set(text, result);
|
|
@@ -173,6 +165,30 @@ function batchMeasureStrings(texts, style = {}) {
|
|
|
173
165
|
}
|
|
174
166
|
return sizeMap;
|
|
175
167
|
}
|
|
168
|
+
|
|
169
|
+
/**
|
|
170
|
+
* Measures an SVG text element using getBBox() with fallback to getBoundingClientRect()
|
|
171
|
+
* @param element SVG text element to measure
|
|
172
|
+
* @returns width and height of the text element
|
|
173
|
+
*/
|
|
174
|
+
function measureSVGTextElement(element) {
|
|
175
|
+
// getBBox() is more reliable across browsers for SVG elements
|
|
176
|
+
try {
|
|
177
|
+
const result = element.getBBox();
|
|
178
|
+
return {
|
|
179
|
+
width: result.width,
|
|
180
|
+
height: result.height
|
|
181
|
+
};
|
|
182
|
+
} catch {
|
|
183
|
+
// Fallback to getBoundingClientRect if getBBox fails
|
|
184
|
+
// This can happen in tests
|
|
185
|
+
const result = element.getBoundingClientRect();
|
|
186
|
+
return {
|
|
187
|
+
width: result.width,
|
|
188
|
+
height: result.height
|
|
189
|
+
};
|
|
190
|
+
}
|
|
191
|
+
}
|
|
176
192
|
let measurementContainer = null;
|
|
177
193
|
|
|
178
194
|
/**
|
package/internals/getScale.d.ts
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
+
import { NumberValue } from '@mui/x-charts-vendor/d3-scale';
|
|
1
2
|
import { ContinuousScaleName, D3ContinuousScale } from "../models/axis.js";
|
|
2
|
-
export declare function getScale(scaleType: ContinuousScaleName, domain:
|
|
3
|
+
export declare function getScale<Domain extends NumberValue = any, Range = any>(scaleType: ContinuousScaleName, domain: Iterable<Domain>, range: readonly Range[]): D3ContinuousScale<Range, Range>;
|
package/internals/index.d.ts
CHANGED
|
@@ -15,7 +15,7 @@ export { useBarPlotData } from "../BarChart/useBarPlotData.js";
|
|
|
15
15
|
export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
|
|
16
16
|
export * from "../ChartContainer/useChartContainerProps.js";
|
|
17
17
|
export * from "../ChartDataProvider/useChartDataProviderProps.js";
|
|
18
|
-
export * from "./
|
|
18
|
+
export * from "./seriesSelectorOfType.js";
|
|
19
19
|
export * from "./plugins/corePlugins/useChartId/index.js";
|
|
20
20
|
export * from "./plugins/corePlugins/useChartSeries/index.js";
|
|
21
21
|
export * from "./plugins/corePlugins/useChartDimensions/index.js";
|
package/internals/index.js
CHANGED
|
@@ -182,15 +182,15 @@ Object.keys(_useChartDataProviderProps).forEach(function (key) {
|
|
|
182
182
|
}
|
|
183
183
|
});
|
|
184
184
|
});
|
|
185
|
-
var
|
|
186
|
-
Object.keys(
|
|
185
|
+
var _seriesSelectorOfType = require("./seriesSelectorOfType");
|
|
186
|
+
Object.keys(_seriesSelectorOfType).forEach(function (key) {
|
|
187
187
|
if (key === "default" || key === "__esModule") return;
|
|
188
188
|
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
|
189
|
-
if (key in exports && exports[key] ===
|
|
189
|
+
if (key in exports && exports[key] === _seriesSelectorOfType[key]) return;
|
|
190
190
|
Object.defineProperty(exports, key, {
|
|
191
191
|
enumerable: true,
|
|
192
192
|
get: function () {
|
|
193
|
-
return
|
|
193
|
+
return _seriesSelectorOfType[key];
|
|
194
194
|
}
|
|
195
195
|
});
|
|
196
196
|
});
|
|
@@ -4,6 +4,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectorChartSkipAnimation = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _store = require("@mui/x-internals/store");
|
|
8
8
|
const selectorChartAnimationState = state => state.animation;
|
|
9
|
-
const selectorChartSkipAnimation = exports.selectorChartSkipAnimation = (0,
|
|
9
|
+
const selectorChartSkipAnimation = exports.selectorChartSkipAnimation = (0, _store.createSelector)(selectorChartAnimationState, state => state.skip || state.skipAnimationRequests > 0);
|
|
@@ -5,7 +5,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.selectorChartSvgWidth = exports.selectorChartSvgHeight = exports.selectorChartPropsWidth = exports.selectorChartPropsHeight = exports.selectorChartMargin = exports.selectorChartDrawingArea = exports.selectorChartDimensionsState = void 0;
|
|
7
7
|
var _store = require("@mui/x-internals/store");
|
|
8
|
-
var _selectors = require("../../utils/selectors");
|
|
9
8
|
var _useChartAxisSize = require("../../featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors");
|
|
10
9
|
const selectorChartDimensionsState = state => state.dimensions;
|
|
11
10
|
exports.selectorChartDimensionsState = selectorChartDimensionsState;
|
|
@@ -34,7 +33,7 @@ const selectorChartDrawingArea = exports.selectorChartDrawingArea = (0, _store.c
|
|
|
34
33
|
bottom: marginBottom + axisSizeBottom
|
|
35
34
|
};
|
|
36
35
|
});
|
|
37
|
-
const selectorChartSvgWidth = exports.selectorChartSvgWidth = (0,
|
|
38
|
-
const selectorChartSvgHeight = exports.selectorChartSvgHeight = (0,
|
|
39
|
-
const selectorChartPropsWidth = exports.selectorChartPropsWidth = (0,
|
|
40
|
-
const selectorChartPropsHeight = exports.selectorChartPropsHeight = (0,
|
|
36
|
+
const selectorChartSvgWidth = exports.selectorChartSvgWidth = (0, _store.createSelector)(selectorChartDimensionsState, dimensionsState => dimensionsState.width);
|
|
37
|
+
const selectorChartSvgHeight = exports.selectorChartSvgHeight = (0, _store.createSelector)(selectorChartDimensionsState, dimensionsState => dimensionsState.height);
|
|
38
|
+
const selectorChartPropsWidth = exports.selectorChartPropsWidth = (0, _store.createSelector)(selectorChartDimensionsState, dimensionsState => dimensionsState.propsWidth);
|
|
39
|
+
const selectorChartPropsHeight = exports.selectorChartPropsHeight = (0, _store.createSelector)(selectorChartDimensionsState, dimensionsState => dimensionsState.propsHeight);
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectorPreferStrictDomainInLineCharts = exports.selectorChartExperimentalFeaturesState = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _store = require("@mui/x-internals/store");
|
|
8
8
|
const selectorChartExperimentalFeaturesState = state => state.experimentalFeatures;
|
|
9
9
|
exports.selectorChartExperimentalFeaturesState = selectorChartExperimentalFeaturesState;
|
|
10
|
-
const selectorPreferStrictDomainInLineCharts = exports.selectorPreferStrictDomainInLineCharts = (0,
|
|
10
|
+
const selectorPreferStrictDomainInLineCharts = exports.selectorPreferStrictDomainInLineCharts = (0, _store.createSelector)(selectorChartExperimentalFeaturesState, features => Boolean(features?.preferStrictDomainInLineCharts));
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectorChartId = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _store = require("@mui/x-internals/store");
|
|
8
8
|
const selectorChartIdState = state => state.id;
|
|
9
9
|
|
|
10
10
|
/**
|
|
@@ -12,4 +12,4 @@ const selectorChartIdState = state => state.id;
|
|
|
12
12
|
* @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
|
|
13
13
|
* @returns {string} The id attribute of the chart.
|
|
14
14
|
*/
|
|
15
|
-
const selectorChartId = exports.selectorChartId = (0,
|
|
15
|
+
const selectorChartId = exports.selectorChartId = (0, _store.createSelector)(selectorChartIdState, idState => idState.chartId);
|
package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js
CHANGED
|
@@ -50,6 +50,9 @@ const useChartInteractionListener = ({
|
|
|
50
50
|
name: 'zoomTurnWheel',
|
|
51
51
|
sensitivity: 0.01,
|
|
52
52
|
initialDelta: 1
|
|
53
|
+
}), new _core.TurnWheelGesture({
|
|
54
|
+
name: 'panTurnWheel',
|
|
55
|
+
sensitivity: 0.5
|
|
53
56
|
}), new _core.TapAndDragGesture({
|
|
54
57
|
name: 'zoomTapAndDrag',
|
|
55
58
|
dragThreshold: 10
|
|
@@ -69,7 +72,7 @@ const useChartInteractionListener = ({
|
|
|
69
72
|
if (!svg || !gestureManager) {
|
|
70
73
|
return undefined;
|
|
71
74
|
}
|
|
72
|
-
gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag', 'zoomPressAndDrag', 'zoomDoubleTapReset', 'brush'], svg);
|
|
75
|
+
gestureManager.registerElement(['pan', 'move', 'zoomPinch', 'zoomPan', 'zoomTurnWheel', 'panTurnWheel', 'tap', 'quickPress', 'zoomTapAndDrag', 'zoomPressAndDrag', 'zoomDoubleTapReset', 'brush'], svg);
|
|
73
76
|
return () => {
|
|
74
77
|
// Cleanup gesture manager
|
|
75
78
|
gestureManager.unregisterAllGestures(svg);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { MoveEvent, PanEvent, PanGestureOptions, PinchEvent, PinchGestureOptions, PressEvent, TapEvent, TurnWheelEvent, type PressAndDragEvent, type PressAndDragGestureOptions, type TapAndDragEvent, type TapAndDragGestureOptions, type TapGestureOptions, type TurnWheelGestureOptions } from '@mui/x-internal-gestures/core';
|
|
2
2
|
import { ChartPluginSignature } from "../../models/index.js";
|
|
3
|
-
export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'zoomTurnWheel' | 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd' | 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd' | 'move' | 'moveStart' | 'moveEnd' | 'tap' | 'quickPress' | 'quickPressEnd' | 'zoomDoubleTapReset' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd';
|
|
3
|
+
export type ChartInteraction = 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd' | 'zoomTurnWheel' | 'panTurnWheel' | 'zoomTapAndDrag' | 'zoomTapAndDragStart' | 'zoomTapAndDragEnd' | 'zoomPressAndDrag' | 'zoomPressAndDragStart' | 'zoomPressAndDragEnd' | 'move' | 'moveStart' | 'moveEnd' | 'tap' | 'quickPress' | 'quickPressEnd' | 'zoomDoubleTapReset' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd';
|
|
4
4
|
export type InteractionListenerResult = {
|
|
5
5
|
cleanup: () => void;
|
|
6
6
|
};
|
|
@@ -8,6 +8,7 @@ export type AddInteractionListener = {
|
|
|
8
8
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'pan' | 'panStart' | 'panEnd' | 'zoomPan' | 'zoomPanStart' | 'zoomPanEnd' | 'brush' | 'brushStart' | 'brushCancel' | 'brushEnd', callback: (event: PanEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
9
9
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomPinch' | 'zoomPinchStart' | 'zoomPinchEnd', callback: (event: PinchEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
10
10
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'zoomTurnWheel', callback: (event: TurnWheelEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
11
|
+
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'panTurnWheel', callback: (event: TurnWheelEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
11
12
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'move' | 'moveStart' | 'moveEnd', callback: (event: MoveEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
12
13
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'tap' | 'zoomDoubleTapReset', callback: (event: TapEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
13
14
|
<CustomData extends Record<string, unknown> = Record<string, unknown>>(interaction: 'quickPress' | 'quickPressEnd', callback: (event: PressEvent<CustomData>) => void, options?: boolean | AddEventListenerOptions): InteractionListenerResult;
|
|
@@ -18,6 +19,7 @@ export type UpdateZoomInteractionListeners = {
|
|
|
18
19
|
(interaction: 'zoomPan', options?: Omit<PanGestureOptions<'zoomPan'>, 'name'>): void;
|
|
19
20
|
(interaction: 'zoomPinch', options?: Omit<PinchGestureOptions<'zoomPinch'>, 'name'>): void;
|
|
20
21
|
(interaction: 'zoomTurnWheel', options?: Omit<TurnWheelGestureOptions<'zoomTurnWheel'>, 'name'>): void;
|
|
22
|
+
(interaction: 'panTurnWheel', options?: Omit<TurnWheelGestureOptions<'panTurnWheel'>, 'name'>): void;
|
|
21
23
|
(interaction: 'zoomTapAndDrag', options?: Omit<TapAndDragGestureOptions<'zoomTapAndDrag'>, 'name'>): void;
|
|
22
24
|
(interaction: 'zoomPressAndDrag', options?: Omit<PressAndDragGestureOptions<'zoomPressAndDrag'>, 'name'>): void;
|
|
23
25
|
(interaction: 'zoomDoubleTapReset', options?: Omit<TapGestureOptions<'zoomDoubleTapReset'>, 'name'>): void;
|
|
@@ -14,4 +14,4 @@ export declare const selectorChartSeriesConfig: (args_0: import("../useChartId/u
|
|
|
14
14
|
*/
|
|
15
15
|
export declare const selectorChartDataset: (args_0: import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
|
|
16
16
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
17
|
-
}) => readonly import("../../../index.js").DatasetElementType<
|
|
17
|
+
}) => readonly import("../../../index.js").DatasetElementType<unknown>[] | undefined;
|
|
@@ -4,15 +4,15 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectorChartSeriesState = exports.selectorChartSeriesProcessed = exports.selectorChartSeriesConfig = exports.selectorChartDataset = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _store = require("@mui/x-internals/store");
|
|
8
8
|
const selectorChartSeriesState = state => state.series;
|
|
9
9
|
exports.selectorChartSeriesState = selectorChartSeriesState;
|
|
10
|
-
const selectorChartSeriesProcessed = exports.selectorChartSeriesProcessed = (0,
|
|
11
|
-
const selectorChartSeriesConfig = exports.selectorChartSeriesConfig = (0,
|
|
10
|
+
const selectorChartSeriesProcessed = exports.selectorChartSeriesProcessed = (0, _store.createSelector)(selectorChartSeriesState, seriesState => seriesState.processedSeries);
|
|
11
|
+
const selectorChartSeriesConfig = exports.selectorChartSeriesConfig = (0, _store.createSelector)(selectorChartSeriesState, seriesState => seriesState.seriesConfig);
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Get the dataset from the series state.
|
|
15
15
|
* @param {ChartState<[UseChartSeriesSignature]>} state The state of the chart.
|
|
16
16
|
* @returns {DatasetType | undefined} The dataset.
|
|
17
17
|
*/
|
|
18
|
-
const selectorChartDataset = exports.selectorChartDataset = (0,
|
|
18
|
+
const selectorChartDataset = exports.selectorChartDataset = (0, _store.createSelector)(selectorChartSeriesState, seriesState => seriesState.dataset);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { ChartOptionalRootSelector } from "../../utils/selectors.js";
|
|
2
2
|
import type { UseChartBrushSignature } from "./useChartBrush.types.js";
|
|
3
3
|
export declare const selectorBrush: ChartOptionalRootSelector<UseChartBrushSignature>;
|
|
4
4
|
export declare const selectorBrushStart: (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("./useChartBrush.types.js").UseChartBrushState> & {
|
|
@@ -4,18 +4,18 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectorIsBrushSelectionActive = exports.selectorIsBrushEnabled = exports.selectorBrushState = exports.selectorBrushStartY = exports.selectorBrushStartX = exports.selectorBrushStart = exports.selectorBrushShouldPreventTooltip = exports.selectorBrushShouldPreventAxisHighlight = exports.selectorBrushCurrentY = exports.selectorBrushCurrentX = exports.selectorBrushCurrent = exports.selectorBrushConfigZoom = exports.selectorBrushConfigNoZoom = exports.selectorBrushConfig = exports.selectorBrush = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _store = require("@mui/x-internals/store");
|
|
8
8
|
var _useChartCartesianAxisRendering = require("../useChartCartesianAxis/useChartCartesianAxisRendering.selectors");
|
|
9
9
|
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
10
10
|
const selectorBrush = state => state.brush;
|
|
11
11
|
exports.selectorBrush = selectorBrush;
|
|
12
|
-
const selectorBrushStart = exports.selectorBrushStart = (0,
|
|
13
|
-
const selectorBrushCurrent = exports.selectorBrushCurrent = (0,
|
|
14
|
-
const selectorBrushStartX = exports.selectorBrushStartX = (0,
|
|
15
|
-
const selectorBrushStartY = exports.selectorBrushStartY = (0,
|
|
16
|
-
const selectorBrushCurrentX = exports.selectorBrushCurrentX = (0,
|
|
17
|
-
const selectorBrushCurrentY = exports.selectorBrushCurrentY = (0,
|
|
18
|
-
const selectorBrushState = exports.selectorBrushState = (0,
|
|
12
|
+
const selectorBrushStart = exports.selectorBrushStart = (0, _store.createSelector)(selectorBrush, brush => brush?.start);
|
|
13
|
+
const selectorBrushCurrent = exports.selectorBrushCurrent = (0, _store.createSelector)(selectorBrush, brush => brush?.current);
|
|
14
|
+
const selectorBrushStartX = exports.selectorBrushStartX = (0, _store.createSelector)(selectorBrush, brush => brush?.start?.x ?? null);
|
|
15
|
+
const selectorBrushStartY = exports.selectorBrushStartY = (0, _store.createSelector)(selectorBrush, brush => brush?.start?.y ?? null);
|
|
16
|
+
const selectorBrushCurrentX = exports.selectorBrushCurrentX = (0, _store.createSelector)(selectorBrush, brush => brush?.current?.x ?? null);
|
|
17
|
+
const selectorBrushCurrentY = exports.selectorBrushCurrentY = (0, _store.createSelector)(selectorBrush, brush => brush?.current?.y ?? null);
|
|
18
|
+
const selectorBrushState = exports.selectorBrushState = (0, _store.createSelector)(selectorBrushStartX, selectorBrushStartY, selectorBrushCurrentX, selectorBrushCurrentY, (startX, startY, currentX, currentY) => {
|
|
19
19
|
if (startX === null || startY === null || currentX === null || currentY === null) {
|
|
20
20
|
return null;
|
|
21
21
|
}
|
|
@@ -30,7 +30,7 @@ const selectorBrushState = exports.selectorBrushState = (0, _selectors.createSel
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
});
|
|
33
|
-
const selectorBrushConfigNoZoom = exports.selectorBrushConfigNoZoom = (0,
|
|
33
|
+
const selectorBrushConfigNoZoom = exports.selectorBrushConfigNoZoom = (0, _store.createSelector)(_useChartSeries.selectorChartSeriesProcessed, series => {
|
|
34
34
|
let hasHorizontal = false;
|
|
35
35
|
let isBothDirections = false;
|
|
36
36
|
if (series) {
|
|
@@ -51,7 +51,7 @@ const selectorBrushConfigNoZoom = exports.selectorBrushConfigNoZoom = (0, _selec
|
|
|
51
51
|
}
|
|
52
52
|
return 'x';
|
|
53
53
|
});
|
|
54
|
-
const selectorBrushConfigZoom = exports.selectorBrushConfigZoom = (0,
|
|
54
|
+
const selectorBrushConfigZoom = exports.selectorBrushConfigZoom = (0, _store.createSelector)(_useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, function selectorBrushConfigZoom(optionsLookup) {
|
|
55
55
|
let hasX = false;
|
|
56
56
|
let hasY = false;
|
|
57
57
|
Object.values(optionsLookup).forEach(options => {
|
|
@@ -73,10 +73,10 @@ const selectorBrushConfigZoom = exports.selectorBrushConfigZoom = (0, _selectors
|
|
|
73
73
|
}
|
|
74
74
|
return null;
|
|
75
75
|
});
|
|
76
|
-
const selectorBrushConfig = exports.selectorBrushConfig = (0,
|
|
77
|
-
const selectorIsBrushEnabled = exports.selectorIsBrushEnabled = (0,
|
|
78
|
-
const selectorIsBrushSelectionActive = exports.selectorIsBrushSelectionActive = (0,
|
|
76
|
+
const selectorBrushConfig = exports.selectorBrushConfig = (0, _store.createSelector)(selectorBrushConfigNoZoom, selectorBrushConfigZoom, (configNoZoom, configZoom) => configZoom ?? configNoZoom);
|
|
77
|
+
const selectorIsBrushEnabled = exports.selectorIsBrushEnabled = (0, _store.createSelector)(selectorBrush, brush => brush?.enabled || brush?.isZoomBrushEnabled);
|
|
78
|
+
const selectorIsBrushSelectionActive = exports.selectorIsBrushSelectionActive = (0, _store.createSelector)(selectorIsBrushEnabled, selectorBrush, (isBrushEnabled, brush) => {
|
|
79
79
|
return isBrushEnabled && brush?.start !== null && brush?.current !== null;
|
|
80
80
|
});
|
|
81
|
-
const selectorBrushShouldPreventAxisHighlight = exports.selectorBrushShouldPreventAxisHighlight = (0,
|
|
82
|
-
const selectorBrushShouldPreventTooltip = exports.selectorBrushShouldPreventTooltip = (0,
|
|
81
|
+
const selectorBrushShouldPreventAxisHighlight = exports.selectorBrushShouldPreventAxisHighlight = (0, _store.createSelector)(selectorBrush, selectorIsBrushSelectionActive, (brush, isBrushSelectionActive) => isBrushSelectionActive && brush?.preventHighlight);
|
|
82
|
+
const selectorBrushShouldPreventTooltip = exports.selectorBrushShouldPreventTooltip = (0, _store.createSelector)(selectorBrush, selectorIsBrushSelectionActive, (brush, isBrushSelectionActive) => isBrushSelectionActive && brush?.preventTooltip);
|
package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts
CHANGED
|
@@ -72,7 +72,7 @@ export interface DefaultizedZoomOptions extends Required<Omit<ZoomOptions, 'slid
|
|
|
72
72
|
}
|
|
73
73
|
export interface UseChartCartesianAxisState {
|
|
74
74
|
/**
|
|
75
|
-
* @ignore - state populated by the
|
|
75
|
+
* @ignore - state populated by the useChartProZoom plugin
|
|
76
76
|
*/
|
|
77
77
|
zoom?: {
|
|
78
78
|
isInteracting: boolean;
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.selectorChartPreviewYScales = exports.selectorChartPreviewXScales = exports.selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedXAxis = void 0;
|
|
7
|
-
var
|
|
7
|
+
var _store = require("@mui/x-internals/store");
|
|
8
8
|
var _useChartCartesianAxisLayout = require("./useChartCartesianAxisLayout.selectors");
|
|
9
9
|
var _useChartSeries = require("../../corePlugins/useChartSeries");
|
|
10
10
|
var _computeAxisValue = require("./computeAxisValue");
|
|
@@ -31,7 +31,7 @@ function createPreviewDrawingArea(axisDirection, mainChartDrawingArea) {
|
|
|
31
31
|
bottom: mainChartDrawingArea.height
|
|
32
32
|
};
|
|
33
33
|
}
|
|
34
|
-
const selectorChartPreviewXScales = exports.selectorChartPreviewXScales = (0,
|
|
34
|
+
const selectorChartPreviewXScales = exports.selectorChartPreviewXScales = (0, _store.createSelector)(_useChartCartesianAxisLayout.selectorChartRawXAxis, _useChartDimensions.selectorChartDrawingArea, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartCartesianAxisRendering.selectorChartNormalizedXScales, function selectorChartPreviewXScales(xAxes, chartDrawingArea, zoomOptions, normalizedXScales, axisId) {
|
|
35
35
|
const hasAxis = xAxes?.some(axis => axis.id === axisId);
|
|
36
36
|
const drawingArea = createPreviewDrawingArea(hasAxis ? 'x' : 'y', chartDrawingArea);
|
|
37
37
|
const options = zoomOptions[axisId];
|
|
@@ -46,7 +46,7 @@ const selectorChartPreviewXScales = exports.selectorChartPreviewXScales = (0, _s
|
|
|
46
46
|
});
|
|
47
47
|
return scales;
|
|
48
48
|
});
|
|
49
|
-
const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXAxis = (0,
|
|
49
|
+
const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXAxis = (0, _store.createSelector)(_useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartDimensions.selectorChartDrawingArea, selectorChartPreviewXScales, _useChartCartesianAxisRendering.selectorChartXAxisWithDomains, (formattedSeries, seriesConfig, zoomOptions, chartDrawingArea, scales, {
|
|
50
50
|
axes,
|
|
51
51
|
domains
|
|
52
52
|
}, axisId) => {
|
|
@@ -75,7 +75,7 @@ const selectorChartPreviewComputedXAxis = exports.selectorChartPreviewComputedXA
|
|
|
75
75
|
}
|
|
76
76
|
return computedAxes.axis;
|
|
77
77
|
});
|
|
78
|
-
const selectorChartPreviewYScales = exports.selectorChartPreviewYScales = (0,
|
|
78
|
+
const selectorChartPreviewYScales = exports.selectorChartPreviewYScales = (0, _store.createSelector)(_useChartCartesianAxisLayout.selectorChartRawYAxis, _useChartDimensions.selectorChartDrawingArea, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartCartesianAxisRendering.selectorChartNormalizedYScales, function selectorChartPreviewYScales(yAxes, chartDrawingArea, zoomOptions, normalizedYScales, axisId) {
|
|
79
79
|
const hasAxis = yAxes?.some(axis => axis.id === axisId);
|
|
80
80
|
const drawingArea = createPreviewDrawingArea(hasAxis ? 'y' : 'x', chartDrawingArea);
|
|
81
81
|
const options = zoomOptions[axisId];
|
|
@@ -93,7 +93,7 @@ const selectorChartPreviewYScales = exports.selectorChartPreviewYScales = (0, _s
|
|
|
93
93
|
});
|
|
94
94
|
return scales;
|
|
95
95
|
});
|
|
96
|
-
const selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedYAxis = (0,
|
|
96
|
+
const selectorChartPreviewComputedYAxis = exports.selectorChartPreviewComputedYAxis = (0, _store.createSelector)(_useChartSeries.selectorChartSeriesProcessed, _useChartSeries.selectorChartSeriesConfig, _useChartCartesianAxisRendering.selectorChartZoomOptionsLookup, _useChartDimensions.selectorChartDrawingArea, selectorChartPreviewYScales, _useChartCartesianAxisRendering.selectorChartYAxisWithDomains, (formattedSeries, seriesConfig, zoomOptions, chartDrawingArea, scales, {
|
|
97
97
|
axes,
|
|
98
98
|
domains
|
|
99
99
|
}, axisId) => {
|