@mui/x-charts 9.1.0 → 9.2.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/CHANGELOG.md +103 -0
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.mts +1 -1
- package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.ts +1 -1
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.js +31 -14
- package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.mjs +32 -15
- package/ChartsRadiusAxis/ChartsRadiusAxis.d.mts +1 -47
- package/ChartsRadiusAxis/ChartsRadiusAxis.d.ts +1 -47
- package/ChartsRadiusAxis/ChartsRadiusAxis.js +20 -16
- package/ChartsRadiusAxis/ChartsRadiusAxis.mjs +21 -15
- package/ChartsRotationAxis/ChartsRotationAxis.d.mts +1 -47
- package/ChartsRotationAxis/ChartsRotationAxis.d.ts +1 -47
- package/ChartsRotationAxis/ChartsRotationAxis.js +16 -19
- package/ChartsRotationAxis/ChartsRotationAxis.mjs +17 -18
- package/ChartsTooltip/useAxesTooltip.d.mts +1 -1
- package/ChartsTooltip/useAxesTooltip.d.ts +1 -1
- package/ChartsTooltip/useAxesTooltip.js +11 -2
- package/ChartsTooltip/useAxesTooltip.mjs +12 -3
- package/RadarChart/RadarGrid/CircularRadarStripes.js +2 -3
- package/RadarChart/RadarGrid/CircularRadarStripes.mjs +2 -3
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +1 -1
- package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.mjs +2 -2
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/getRingPath.d.mts +16 -0
- package/internals/getRingPath.d.ts +16 -0
- package/internals/getRingPath.js +39 -0
- package/internals/getRingPath.mjs +33 -0
- package/internals/index.d.mts +4 -2
- package/internals/index.d.ts +4 -2
- package/internals/index.js +22 -3
- package/internals/index.mjs +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.d.mts +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.d.ts +3 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.mts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +8 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.mjs +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.mts +6 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.d.ts +6 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.js +48 -36
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPosition.selectors.mjs +47 -36
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +74 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +74 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.mts +152 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +152 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.mts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.mts +6 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.ts +6 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +36 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.mjs +34 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +1 -1
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.mjs +2 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.mts +22 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +22 -2
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +73 -12
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.mjs +74 -12
- package/models/axis.d.mts +55 -7
- package/models/axis.d.ts +55 -7
- package/package.json +4 -4
package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts
CHANGED
|
@@ -18,9 +18,29 @@ export declare const selectorChartsInteractionTooltipRotationAxes: (args_0: impo
|
|
|
18
18
|
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
19
19
|
}) => AxisItemIdentifier[];
|
|
20
20
|
/**
|
|
21
|
-
*
|
|
21
|
+
* Helper to get the radius associated to the interaction coordinate.
|
|
22
22
|
*/
|
|
23
|
-
export declare const
|
|
23
|
+
export declare const selectorChartsInteractionRadius: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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("../useChartInteraction/useChartInteraction.types.js").UseChartInteractionState> & {
|
|
24
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
25
|
+
}) => number | null;
|
|
26
|
+
export declare const selectorChartsInteractionRadiusAxisIndex: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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("../useChartInteraction/useChartInteraction.types.js").UseChartInteractionState> & {
|
|
27
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
28
|
+
}) => number | null;
|
|
29
|
+
export declare const selectorChartsInteractionRadiusAxisIndexes: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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("../useChartInteraction/useChartInteraction.types.js").UseChartInteractionState> & {
|
|
30
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
31
|
+
}) => number[] | null;
|
|
32
|
+
export declare const selectorChartsInteractionRadiusAxisValue: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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> & {
|
|
33
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
34
|
+
}) => any;
|
|
35
|
+
export declare const selectorChartsInteractionRadiusAxisValues: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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> & {
|
|
36
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
37
|
+
}) => any[] | null;
|
|
38
|
+
/**
|
|
39
|
+
* Get radius-axis ids and corresponding data index that should be display in the tooltip.
|
|
40
|
+
*/
|
|
41
|
+
export declare const selectorChartsInteractionTooltipRadiusAxes: (args_0: import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartSeriesConfig/useChartSeriesConfig.types.js").UseChartSeriesConfigState<keyof import("../../../index.js").ChartsSeriesConfig> & 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("../useChartInteraction/useChartInteraction.types.js").UseChartInteractionState> & {
|
|
42
|
+
cacheKey: import("../../models/index.js").ChartStateCacheKey;
|
|
43
|
+
}) => AxisItemIdentifier[];
|
|
24
44
|
/**
|
|
25
45
|
* Return `true` if the axis tooltip has something to display.
|
|
26
46
|
*/
|
package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.selectorChartsInteractionTooltipRotationAxes = exports.selectorChartsInteractionTooltipRadiusAxes = exports.selectorChartsInteractionRotationAxisValues = exports.selectorChartsInteractionRotationAxisValue = exports.selectorChartsInteractionRotationAxisIndexes = exports.selectorChartsInteractionRotationAxisIndex = exports.selectorChartsInteractionPolarAxisTooltip = void 0;
|
|
6
|
+
exports.selectorChartsInteractionTooltipRotationAxes = exports.selectorChartsInteractionTooltipRadiusAxes = exports.selectorChartsInteractionRotationAxisValues = exports.selectorChartsInteractionRotationAxisValue = exports.selectorChartsInteractionRotationAxisIndexes = exports.selectorChartsInteractionRotationAxisIndex = exports.selectorChartsInteractionRadiusAxisValues = exports.selectorChartsInteractionRadiusAxisValue = exports.selectorChartsInteractionRadiusAxisIndexes = exports.selectorChartsInteractionRadiusAxisIndex = exports.selectorChartsInteractionRadius = exports.selectorChartsInteractionPolarAxisTooltip = void 0;
|
|
7
7
|
var _isDeepEqual = require("@mui/x-internals/isDeepEqual");
|
|
8
8
|
var _store = require("@mui/x-internals/store");
|
|
9
9
|
var _useChartInteraction = require("../useChartInteraction/useChartInteraction.selectors");
|
|
@@ -17,10 +17,17 @@ const optionalGetAxisIds = (_, ids) => ids;
|
|
|
17
17
|
* Get interaction indexes
|
|
18
18
|
*/
|
|
19
19
|
|
|
20
|
-
function indexGetter(value, axes, ids) {
|
|
21
|
-
|
|
20
|
+
function indexGetter(value, axes, ids, type) {
|
|
21
|
+
if (type === 'rotation') {
|
|
22
|
+
const rotationAxes = axes;
|
|
23
|
+
return Array.isArray(ids) ? ids.map(id => (0, _getAxisIndex.getRotationAxisIndex)(rotationAxes.axis[id], value)) : (0, _getAxisIndex.getRotationAxisIndex)(rotationAxes.axis[ids], value);
|
|
24
|
+
}
|
|
25
|
+
const radiusAxes = axes;
|
|
26
|
+
return Array.isArray(ids) ? ids.map(id => (0, _getAxisIndex.getRadiusAxisIndex)(radiusAxes.axis[id], value)) : (0, _getAxisIndex.getRadiusAxisIndex)(radiusAxes.axis[ids], value);
|
|
22
27
|
}
|
|
23
28
|
|
|
29
|
+
// ============================= Rotation axis =============================
|
|
30
|
+
|
|
24
31
|
/**
|
|
25
32
|
* Helper to get the rotation associated to the interaction coordinate.
|
|
26
33
|
*/
|
|
@@ -30,8 +37,8 @@ const selectorChartsInteractionRotationAngle = (0, _store.createSelector)(_useCh
|
|
|
30
37
|
}
|
|
31
38
|
return (0, _coordinateTransformation.generateSvg2rotation)(center)(x, y);
|
|
32
39
|
});
|
|
33
|
-
const selectorChartsInteractionRotationAxisIndex = exports.selectorChartsInteractionRotationAxisIndex = (0, _store.createSelector)(selectorChartsInteractionRotationAngle, _useChartPolarAxis.selectorChartRotationAxis, optionalGetAxisId, (rotation, rotationAxis, id) => rotation === null ? null : indexGetter(rotation, rotationAxis, id ?? rotationAxis.axisIds[0]));
|
|
34
|
-
const selectorChartsInteractionRotationAxisIndexes = exports.selectorChartsInteractionRotationAxisIndexes = (0, _store.createSelector)(selectorChartsInteractionRotationAngle, _useChartPolarAxis.selectorChartRotationAxis, optionalGetAxisIds, (rotation, rotationAxis, ids) => rotation === null ? null : indexGetter(rotation, rotationAxis, ids ?? rotationAxis.axisIds));
|
|
40
|
+
const selectorChartsInteractionRotationAxisIndex = exports.selectorChartsInteractionRotationAxisIndex = (0, _store.createSelector)(selectorChartsInteractionRotationAngle, _useChartPolarAxis.selectorChartRotationAxis, optionalGetAxisId, (rotation, rotationAxis, id) => rotation === null ? null : indexGetter(rotation, rotationAxis, id ?? rotationAxis.axisIds[0], 'rotation'));
|
|
41
|
+
const selectorChartsInteractionRotationAxisIndexes = exports.selectorChartsInteractionRotationAxisIndexes = (0, _store.createSelector)(selectorChartsInteractionRotationAngle, _useChartPolarAxis.selectorChartRotationAxis, optionalGetAxisIds, (rotation, rotationAxis, ids) => rotation === null ? null : indexGetter(rotation, rotationAxis, ids ?? rotationAxis.axisIds, 'rotation'));
|
|
35
42
|
const selectorChartsInteractionRotationAxisValue = exports.selectorChartsInteractionRotationAxisValue = (0, _store.createSelector)(_useChartPolarAxis.selectorChartRotationAxis, selectorChartsInteractionRotationAxisIndex, optionalGetAxisId, (rotationAxis, rotationIndex, id) => {
|
|
36
43
|
id = id ?? rotationAxis.axisIds[0];
|
|
37
44
|
if (rotationIndex === null || rotationIndex === -1 || rotationAxis.axisIds.length === 0) {
|
|
@@ -80,16 +87,70 @@ const selectorChartsInteractionTooltipRotationAxes = exports.selectorChartsInter
|
|
|
80
87
|
}) => axes.axis[axisId].triggerTooltip && dataIndex >= 0);
|
|
81
88
|
});
|
|
82
89
|
|
|
90
|
+
// ============================= Radius axis =============================
|
|
91
|
+
|
|
83
92
|
/**
|
|
84
|
-
*
|
|
93
|
+
* Helper to get the radius associated to the interaction coordinate.
|
|
85
94
|
*/
|
|
86
|
-
const
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
}
|
|
95
|
+
const selectorChartsInteractionRadius = exports.selectorChartsInteractionRadius = (0, _store.createSelector)(_useChartInteraction.selectorChartsInteractionPointerX, _useChartInteraction.selectorChartsInteractionPointerY, _useChartPolarAxis.selectorChartPolarCenter, (x, y, center) => {
|
|
96
|
+
if (x === null || y === null) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
return Math.sqrt((x - center.cx) ** 2 + (y - center.cy) ** 2);
|
|
100
|
+
});
|
|
101
|
+
const selectorChartsInteractionRadiusAxisIndex = exports.selectorChartsInteractionRadiusAxisIndex = (0, _store.createSelector)(selectorChartsInteractionRadius, _useChartPolarAxis.selectorChartRadiusAxis, optionalGetAxisId, (radius, radiusAxis, id) => radius === null ? null : indexGetter(radius, radiusAxis, id ?? radiusAxis.axisIds[0], 'radius'));
|
|
102
|
+
const selectorChartsInteractionRadiusAxisIndexes = exports.selectorChartsInteractionRadiusAxisIndexes = (0, _store.createSelector)(selectorChartsInteractionRadius, _useChartPolarAxis.selectorChartRadiusAxis, optionalGetAxisIds, (radius, radiusAxis, ids) => radius === null ? null : indexGetter(radius, radiusAxis, ids ?? radiusAxis.axisIds, 'radius'));
|
|
103
|
+
const selectorChartsInteractionRadiusAxisValue = exports.selectorChartsInteractionRadiusAxisValue = (0, _store.createSelector)(_useChartPolarAxis.selectorChartRadiusAxis, selectorChartsInteractionRadiusAxisIndex, optionalGetAxisId, (radiusAxis, radiusIndex, id) => {
|
|
104
|
+
id = id ?? radiusAxis.axisIds[0];
|
|
105
|
+
if (radiusIndex === null || radiusIndex === -1 || radiusAxis.axisIds.length === 0) {
|
|
106
|
+
return null;
|
|
107
|
+
}
|
|
108
|
+
const data = radiusAxis.axis[id]?.data;
|
|
109
|
+
if (!data) {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
return data[radiusIndex];
|
|
113
|
+
});
|
|
114
|
+
const selectorChartsInteractionRadiusAxisValues = exports.selectorChartsInteractionRadiusAxisValues = (0, _store.createSelector)(_useChartPolarAxis.selectorChartRadiusAxis, selectorChartsInteractionRadiusAxisIndexes, optionalGetAxisIds, (radiusAxis, radiusIndexes, ids) => {
|
|
115
|
+
ids = ids ?? radiusAxis.axisIds;
|
|
116
|
+
if (radiusIndexes === null) {
|
|
117
|
+
return null;
|
|
118
|
+
}
|
|
119
|
+
return ids.map((id, axisIndex) => {
|
|
120
|
+
const radiusIndex = radiusIndexes[axisIndex];
|
|
121
|
+
if (radiusIndex === -1) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
return radiusAxis.axis[id].data?.[radiusIndex];
|
|
125
|
+
});
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Get radius-axis ids and corresponding data index that should be display in the tooltip.
|
|
130
|
+
*/
|
|
131
|
+
const selectorChartsInteractionTooltipRadiusAxes = exports.selectorChartsInteractionTooltipRadiusAxes = (0, _store.createSelectorMemoizedWithOptions)({
|
|
132
|
+
memoizeOptions: {
|
|
133
|
+
// Keep the same reference if array content is the same.
|
|
134
|
+
// If possible, avoid this pattern by creating selectors that
|
|
135
|
+
// uses string/number as arguments.
|
|
136
|
+
resultEqualityCheck: _isDeepEqual.isDeepEqual
|
|
137
|
+
}
|
|
138
|
+
})(selectorChartsInteractionRadiusAxisIndexes, _useChartPolarAxis.selectorChartRadiusAxis, (indexes, axes) => {
|
|
139
|
+
if (indexes === null) {
|
|
140
|
+
return [];
|
|
141
|
+
}
|
|
142
|
+
return axes.axisIds.map((axisId, axisIndex) => ({
|
|
143
|
+
axisId,
|
|
144
|
+
dataIndex: indexes[axisIndex]
|
|
145
|
+
})).filter(({
|
|
146
|
+
axisId,
|
|
147
|
+
dataIndex
|
|
148
|
+
}) => axes.axis[axisId].triggerTooltip && dataIndex >= 0);
|
|
149
|
+
});
|
|
150
|
+
|
|
151
|
+
// ============================= Cross axes selectors =============================
|
|
90
152
|
|
|
91
153
|
/**
|
|
92
154
|
* Return `true` if the axis tooltip has something to display.
|
|
93
155
|
*/
|
|
94
|
-
exports.
|
|
95
|
-
const selectorChartsInteractionPolarAxisTooltip = exports.selectorChartsInteractionPolarAxisTooltip = (0, _store.createSelector)(selectorChartsInteractionTooltipRotationAxes, rotationTooltip => rotationTooltip.length > 0);
|
|
156
|
+
const selectorChartsInteractionPolarAxisTooltip = exports.selectorChartsInteractionPolarAxisTooltip = (0, _store.createSelector)(selectorChartsInteractionTooltipRotationAxes, selectorChartsInteractionTooltipRadiusAxes, (rotationTooltip, radiusTooltip) => rotationTooltip.length > 0 || radiusTooltip.length > 0);
|
package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.mjs
CHANGED
|
@@ -2,8 +2,8 @@ import { isDeepEqual } from '@mui/x-internals/isDeepEqual';
|
|
|
2
2
|
import { createSelector, createSelectorMemoizedWithOptions } from '@mui/x-internals/store';
|
|
3
3
|
import { selectorChartsInteractionPointerX, selectorChartsInteractionPointerY } from "../useChartInteraction/useChartInteraction.selectors.mjs";
|
|
4
4
|
import { generateSvg2rotation } from "./coordinateTransformation.mjs";
|
|
5
|
-
import {
|
|
6
|
-
import { selectorChartPolarCenter, selectorChartRotationAxis } from "./useChartPolarAxis.selectors.mjs";
|
|
5
|
+
import { getRotationAxisIndex, getRadiusAxisIndex } from "./getAxisIndex.mjs";
|
|
6
|
+
import { selectorChartPolarCenter, selectorChartRadiusAxis, selectorChartRotationAxis } from "./useChartPolarAxis.selectors.mjs";
|
|
7
7
|
const optionalGetAxisId = (_, id) => id;
|
|
8
8
|
const optionalGetAxisIds = (_, ids) => ids;
|
|
9
9
|
|
|
@@ -11,10 +11,17 @@ const optionalGetAxisIds = (_, ids) => ids;
|
|
|
11
11
|
* Get interaction indexes
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
function indexGetter(value, axes, ids) {
|
|
15
|
-
|
|
14
|
+
function indexGetter(value, axes, ids, type) {
|
|
15
|
+
if (type === 'rotation') {
|
|
16
|
+
const rotationAxes = axes;
|
|
17
|
+
return Array.isArray(ids) ? ids.map(id => getRotationAxisIndex(rotationAxes.axis[id], value)) : getRotationAxisIndex(rotationAxes.axis[ids], value);
|
|
18
|
+
}
|
|
19
|
+
const radiusAxes = axes;
|
|
20
|
+
return Array.isArray(ids) ? ids.map(id => getRadiusAxisIndex(radiusAxes.axis[id], value)) : getRadiusAxisIndex(radiusAxes.axis[ids], value);
|
|
16
21
|
}
|
|
17
22
|
|
|
23
|
+
// ============================= Rotation axis =============================
|
|
24
|
+
|
|
18
25
|
/**
|
|
19
26
|
* Helper to get the rotation associated to the interaction coordinate.
|
|
20
27
|
*/
|
|
@@ -24,8 +31,8 @@ const selectorChartsInteractionRotationAngle = createSelector(selectorChartsInte
|
|
|
24
31
|
}
|
|
25
32
|
return generateSvg2rotation(center)(x, y);
|
|
26
33
|
});
|
|
27
|
-
export const selectorChartsInteractionRotationAxisIndex = createSelector(selectorChartsInteractionRotationAngle, selectorChartRotationAxis, optionalGetAxisId, (rotation, rotationAxis, id) => rotation === null ? null : indexGetter(rotation, rotationAxis, id ?? rotationAxis.axisIds[0]));
|
|
28
|
-
export const selectorChartsInteractionRotationAxisIndexes = createSelector(selectorChartsInteractionRotationAngle, selectorChartRotationAxis, optionalGetAxisIds, (rotation, rotationAxis, ids) => rotation === null ? null : indexGetter(rotation, rotationAxis, ids ?? rotationAxis.axisIds));
|
|
34
|
+
export const selectorChartsInteractionRotationAxisIndex = createSelector(selectorChartsInteractionRotationAngle, selectorChartRotationAxis, optionalGetAxisId, (rotation, rotationAxis, id) => rotation === null ? null : indexGetter(rotation, rotationAxis, id ?? rotationAxis.axisIds[0], 'rotation'));
|
|
35
|
+
export const selectorChartsInteractionRotationAxisIndexes = createSelector(selectorChartsInteractionRotationAngle, selectorChartRotationAxis, optionalGetAxisIds, (rotation, rotationAxis, ids) => rotation === null ? null : indexGetter(rotation, rotationAxis, ids ?? rotationAxis.axisIds, 'rotation'));
|
|
29
36
|
export const selectorChartsInteractionRotationAxisValue = createSelector(selectorChartRotationAxis, selectorChartsInteractionRotationAxisIndex, optionalGetAxisId, (rotationAxis, rotationIndex, id) => {
|
|
30
37
|
id = id ?? rotationAxis.axisIds[0];
|
|
31
38
|
if (rotationIndex === null || rotationIndex === -1 || rotationAxis.axisIds.length === 0) {
|
|
@@ -74,15 +81,70 @@ export const selectorChartsInteractionTooltipRotationAxes = createSelectorMemoiz
|
|
|
74
81
|
}) => axes.axis[axisId].triggerTooltip && dataIndex >= 0);
|
|
75
82
|
});
|
|
76
83
|
|
|
84
|
+
// ============================= Radius axis =============================
|
|
85
|
+
|
|
77
86
|
/**
|
|
78
|
-
*
|
|
87
|
+
* Helper to get the radius associated to the interaction coordinate.
|
|
79
88
|
*/
|
|
80
|
-
export const
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
}
|
|
89
|
+
export const selectorChartsInteractionRadius = createSelector(selectorChartsInteractionPointerX, selectorChartsInteractionPointerY, selectorChartPolarCenter, (x, y, center) => {
|
|
90
|
+
if (x === null || y === null) {
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
return Math.sqrt((x - center.cx) ** 2 + (y - center.cy) ** 2);
|
|
94
|
+
});
|
|
95
|
+
export const selectorChartsInteractionRadiusAxisIndex = createSelector(selectorChartsInteractionRadius, selectorChartRadiusAxis, optionalGetAxisId, (radius, radiusAxis, id) => radius === null ? null : indexGetter(radius, radiusAxis, id ?? radiusAxis.axisIds[0], 'radius'));
|
|
96
|
+
export const selectorChartsInteractionRadiusAxisIndexes = createSelector(selectorChartsInteractionRadius, selectorChartRadiusAxis, optionalGetAxisIds, (radius, radiusAxis, ids) => radius === null ? null : indexGetter(radius, radiusAxis, ids ?? radiusAxis.axisIds, 'radius'));
|
|
97
|
+
export const selectorChartsInteractionRadiusAxisValue = createSelector(selectorChartRadiusAxis, selectorChartsInteractionRadiusAxisIndex, optionalGetAxisId, (radiusAxis, radiusIndex, id) => {
|
|
98
|
+
id = id ?? radiusAxis.axisIds[0];
|
|
99
|
+
if (radiusIndex === null || radiusIndex === -1 || radiusAxis.axisIds.length === 0) {
|
|
100
|
+
return null;
|
|
101
|
+
}
|
|
102
|
+
const data = radiusAxis.axis[id]?.data;
|
|
103
|
+
if (!data) {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
return data[radiusIndex];
|
|
107
|
+
});
|
|
108
|
+
export const selectorChartsInteractionRadiusAxisValues = createSelector(selectorChartRadiusAxis, selectorChartsInteractionRadiusAxisIndexes, optionalGetAxisIds, (radiusAxis, radiusIndexes, ids) => {
|
|
109
|
+
ids = ids ?? radiusAxis.axisIds;
|
|
110
|
+
if (radiusIndexes === null) {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
return ids.map((id, axisIndex) => {
|
|
114
|
+
const radiusIndex = radiusIndexes[axisIndex];
|
|
115
|
+
if (radiusIndex === -1) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return radiusAxis.axis[id].data?.[radiusIndex];
|
|
119
|
+
});
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* Get radius-axis ids and corresponding data index that should be display in the tooltip.
|
|
124
|
+
*/
|
|
125
|
+
export const selectorChartsInteractionTooltipRadiusAxes = createSelectorMemoizedWithOptions({
|
|
126
|
+
memoizeOptions: {
|
|
127
|
+
// Keep the same reference if array content is the same.
|
|
128
|
+
// If possible, avoid this pattern by creating selectors that
|
|
129
|
+
// uses string/number as arguments.
|
|
130
|
+
resultEqualityCheck: isDeepEqual
|
|
131
|
+
}
|
|
132
|
+
})(selectorChartsInteractionRadiusAxisIndexes, selectorChartRadiusAxis, (indexes, axes) => {
|
|
133
|
+
if (indexes === null) {
|
|
134
|
+
return [];
|
|
135
|
+
}
|
|
136
|
+
return axes.axisIds.map((axisId, axisIndex) => ({
|
|
137
|
+
axisId,
|
|
138
|
+
dataIndex: indexes[axisIndex]
|
|
139
|
+
})).filter(({
|
|
140
|
+
axisId,
|
|
141
|
+
dataIndex
|
|
142
|
+
}) => axes.axis[axisId].triggerTooltip && dataIndex >= 0);
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
// ============================= Cross axes selectors =============================
|
|
84
146
|
|
|
85
147
|
/**
|
|
86
148
|
* Return `true` if the axis tooltip has something to display.
|
|
87
149
|
*/
|
|
88
|
-
export const selectorChartsInteractionPolarAxisTooltip = createSelector(selectorChartsInteractionTooltipRotationAxes, rotationTooltip => rotationTooltip.length > 0);
|
|
150
|
+
export const selectorChartsInteractionPolarAxisTooltip = createSelector(selectorChartsInteractionTooltipRotationAxes, selectorChartsInteractionTooltipRadiusAxes, (rotationTooltip, radiusTooltip) => rotationTooltip.length > 0 || radiusTooltip.length > 0);
|
package/models/axis.d.mts
CHANGED
|
@@ -10,6 +10,7 @@ import type { ChartsTextProps } from "../ChartsText/index.mjs";
|
|
|
10
10
|
import type { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from "./colorMapping.mjs";
|
|
11
11
|
import type { OrdinalTimeTicks } from "./timeTicks.mjs";
|
|
12
12
|
import { type ChartsTypeFeatureFlags } from "./featureFlags.mjs";
|
|
13
|
+
import { type ChartsRadialAxisClasses } from "../ChartsRadiusAxis/sharedRadialAxisClasses.mjs";
|
|
13
14
|
export type AxisId = string | number;
|
|
14
15
|
export type D3Scale<Domain extends {
|
|
15
16
|
toString(): string;
|
|
@@ -139,7 +140,9 @@ export interface ChartsXAxisProps extends ChartsAxisProps {
|
|
|
139
140
|
*/
|
|
140
141
|
tickLabelMinGap?: number;
|
|
141
142
|
}
|
|
142
|
-
type
|
|
143
|
+
export type ChartsCartesianAxisProps = ChartsXAxisProps | ChartsYAxisProps;
|
|
144
|
+
export type ChartsRadialAxisProps = ChartsRotationAxisProps | ChartsRadiusAxisProps;
|
|
145
|
+
type AxisSideConfig<AxisProps extends ChartsCartesianAxisProps> = {
|
|
143
146
|
/**
|
|
144
147
|
* Position of the axis.
|
|
145
148
|
*
|
|
@@ -177,6 +180,28 @@ export interface ChartsRotationAxisProps extends ChartsAxisProps {
|
|
|
177
180
|
* The gap between the axis and the label.
|
|
178
181
|
*/
|
|
179
182
|
labelGap?: number;
|
|
183
|
+
/**
|
|
184
|
+
* The position of the rotation axis.
|
|
185
|
+
* It can be 'inside' or 'outside'.
|
|
186
|
+
* @default 'outside'
|
|
187
|
+
*/
|
|
188
|
+
position?: 'inside' | 'outside' | 'none';
|
|
189
|
+
/**
|
|
190
|
+
* Set the position of the tick labels relative to the axis line.
|
|
191
|
+
* `'after'` places them outside the arc, `'before'` inside.
|
|
192
|
+
* @default position === 'outside' ? 'after' : 'before'
|
|
193
|
+
*/
|
|
194
|
+
tickLabelPosition?: 'after' | 'before';
|
|
195
|
+
/**
|
|
196
|
+
* Set the position of the tick relative to the axis line.
|
|
197
|
+
* `'after'` places them outside the arc, `'before'` inside.
|
|
198
|
+
* @default position === 'outside' ? 'after' : 'before'
|
|
199
|
+
*/
|
|
200
|
+
tickPosition?: 'after' | 'before';
|
|
201
|
+
/**
|
|
202
|
+
* Override or extend the styles applied to the component.
|
|
203
|
+
*/
|
|
204
|
+
classes?: Partial<ChartsRadialAxisClasses>;
|
|
180
205
|
}
|
|
181
206
|
export interface ChartsRadiusAxisProps extends ChartsAxisProps {
|
|
182
207
|
axis?: 'radius';
|
|
@@ -188,6 +213,29 @@ export interface ChartsRadiusAxisProps extends ChartsAxisProps {
|
|
|
188
213
|
* The maximal radius.
|
|
189
214
|
*/
|
|
190
215
|
maxRadius?: number;
|
|
216
|
+
/**
|
|
217
|
+
* The position of the axis in polar coordinates.
|
|
218
|
+
* It can be 'start', 'end', or a specific angle in degrees.
|
|
219
|
+
* @default 'start'
|
|
220
|
+
*/
|
|
221
|
+
position?: 'start' | 'end' | number | 'none';
|
|
222
|
+
/**
|
|
223
|
+
* Set the position of the tick labels relative to the axis line.
|
|
224
|
+
* The before/after is defined based on clockwise direction.
|
|
225
|
+
* Using `'auto'` sets it to `'before'` if position is `'start'` and `'after'` otherwise.
|
|
226
|
+
* @default 'auto'
|
|
227
|
+
*/
|
|
228
|
+
tickLabelPosition?: 'center' | 'after' | 'before' | 'auto';
|
|
229
|
+
/**
|
|
230
|
+
* Set the position of the tick relative to the axis line.
|
|
231
|
+
* The before/after is defined based on clockwise direction.
|
|
232
|
+
* @default position === 'start' ? 'before' : 'after'
|
|
233
|
+
*/
|
|
234
|
+
tickPosition?: 'after' | 'before';
|
|
235
|
+
/**
|
|
236
|
+
* Override or extend the styles applied to the component.
|
|
237
|
+
*/
|
|
238
|
+
classes?: Partial<ChartsRadialAxisClasses>;
|
|
191
239
|
}
|
|
192
240
|
export type ScaleName = keyof AxisScaleConfig;
|
|
193
241
|
export type ContinuousScaleName = 'linear' | 'log' | 'symlog' | 'pow' | 'sqrt' | 'time' | 'utc';
|
|
@@ -475,7 +523,7 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
|
|
|
475
523
|
/**
|
|
476
524
|
* Use this type for advanced typing. For basic usage, use `RotationAxis` or `RadiusAxis`.
|
|
477
525
|
*/
|
|
478
|
-
export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends
|
|
526
|
+
export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsRadialAxisProps = ChartsRadialAxisProps> = {
|
|
479
527
|
/**
|
|
480
528
|
* The offset of the axis in pixels. It can be used to move the axis from its default position.
|
|
481
529
|
* X-axis: A top axis will move up, and a bottom axis will move down.
|
|
@@ -487,7 +535,7 @@ export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps
|
|
|
487
535
|
/**
|
|
488
536
|
* Use this type for advanced typing. For basic usage, use `XAxis` or `YAxis`.
|
|
489
537
|
*/
|
|
490
|
-
export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends
|
|
538
|
+
export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsCartesianAxisProps = ChartsCartesianAxisProps> = {
|
|
491
539
|
/**
|
|
492
540
|
* The offset of the axis in pixels. It can be used to move the axis from its default position.
|
|
493
541
|
* X-axis: A top axis will move up, and a bottom axis will move down.
|
|
@@ -497,13 +545,13 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps exten
|
|
|
497
545
|
offset?: number;
|
|
498
546
|
} & CommonAxisConfig<S, V> & MinMaxConfig<S> & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & AxisSideConfig<AxisProps> & TickParams & AxisConfigExtension;
|
|
499
547
|
export interface AxisConfigExtension {}
|
|
500
|
-
export type PolarAxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps =
|
|
548
|
+
export type PolarAxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsRadialAxisProps> = Omit<PolarAxisConfig<S, V, AxisProps>, 'scaleType'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
|
|
501
549
|
/**
|
|
502
550
|
* If true, the contents of the axis will be displayed by a tooltip with `trigger='axis'`.
|
|
503
551
|
*/
|
|
504
552
|
triggerTooltip?: boolean;
|
|
505
553
|
};
|
|
506
|
-
export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps =
|
|
554
|
+
export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsCartesianAxisProps> = AxisProps extends any ? MakeRequired<Omit<DefaultedAxis<S, V, AxisProps>, 'scaleType'>, 'offset'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
|
|
507
555
|
/**
|
|
508
556
|
* An indication of the expected number of ticks.
|
|
509
557
|
*/
|
|
@@ -518,7 +566,7 @@ export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps ext
|
|
|
518
566
|
height: number;
|
|
519
567
|
} : {}) & (AxisProps extends ChartsYAxisProps ? AxisSideConfig<AxisProps> & {
|
|
520
568
|
width: number;
|
|
521
|
-
} : {});
|
|
569
|
+
} : {}) : never;
|
|
522
570
|
export type ComputedXAxis<S extends ScaleName = ScaleName, V = any> = ComputedAxis<S, V, ChartsXAxisProps>;
|
|
523
571
|
export type ComputedYAxis<S extends ScaleName = ScaleName, V = any> = ComputedAxis<S, V, ChartsYAxisProps>;
|
|
524
572
|
export declare function isBandScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<'band'> & {
|
|
@@ -580,7 +628,7 @@ export type RadiusAxis<S extends ScaleName = ScaleName, V = any> = S extends Sca
|
|
|
580
628
|
/**
|
|
581
629
|
* The axis configuration with missing values filled with default values.
|
|
582
630
|
*/
|
|
583
|
-
export type DefaultedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps =
|
|
631
|
+
export type DefaultedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsCartesianAxisProps> = AxisConfig<S, V, AxisProps> & {
|
|
584
632
|
zoom: DefaultizedZoomOptions | undefined;
|
|
585
633
|
};
|
|
586
634
|
/**
|
package/models/axis.d.ts
CHANGED
|
@@ -10,6 +10,7 @@ import type { ChartsTextProps } from "../ChartsText/index.js";
|
|
|
10
10
|
import type { ContinuousColorConfig, OrdinalColorConfig, PiecewiseColorConfig } from "./colorMapping.js";
|
|
11
11
|
import type { OrdinalTimeTicks } from "./timeTicks.js";
|
|
12
12
|
import { type ChartsTypeFeatureFlags } from "./featureFlags.js";
|
|
13
|
+
import { type ChartsRadialAxisClasses } from "../ChartsRadiusAxis/sharedRadialAxisClasses.js";
|
|
13
14
|
export type AxisId = string | number;
|
|
14
15
|
export type D3Scale<Domain extends {
|
|
15
16
|
toString(): string;
|
|
@@ -139,7 +140,9 @@ export interface ChartsXAxisProps extends ChartsAxisProps {
|
|
|
139
140
|
*/
|
|
140
141
|
tickLabelMinGap?: number;
|
|
141
142
|
}
|
|
142
|
-
type
|
|
143
|
+
export type ChartsCartesianAxisProps = ChartsXAxisProps | ChartsYAxisProps;
|
|
144
|
+
export type ChartsRadialAxisProps = ChartsRotationAxisProps | ChartsRadiusAxisProps;
|
|
145
|
+
type AxisSideConfig<AxisProps extends ChartsCartesianAxisProps> = {
|
|
143
146
|
/**
|
|
144
147
|
* Position of the axis.
|
|
145
148
|
*
|
|
@@ -177,6 +180,28 @@ export interface ChartsRotationAxisProps extends ChartsAxisProps {
|
|
|
177
180
|
* The gap between the axis and the label.
|
|
178
181
|
*/
|
|
179
182
|
labelGap?: number;
|
|
183
|
+
/**
|
|
184
|
+
* The position of the rotation axis.
|
|
185
|
+
* It can be 'inside' or 'outside'.
|
|
186
|
+
* @default 'outside'
|
|
187
|
+
*/
|
|
188
|
+
position?: 'inside' | 'outside' | 'none';
|
|
189
|
+
/**
|
|
190
|
+
* Set the position of the tick labels relative to the axis line.
|
|
191
|
+
* `'after'` places them outside the arc, `'before'` inside.
|
|
192
|
+
* @default position === 'outside' ? 'after' : 'before'
|
|
193
|
+
*/
|
|
194
|
+
tickLabelPosition?: 'after' | 'before';
|
|
195
|
+
/**
|
|
196
|
+
* Set the position of the tick relative to the axis line.
|
|
197
|
+
* `'after'` places them outside the arc, `'before'` inside.
|
|
198
|
+
* @default position === 'outside' ? 'after' : 'before'
|
|
199
|
+
*/
|
|
200
|
+
tickPosition?: 'after' | 'before';
|
|
201
|
+
/**
|
|
202
|
+
* Override or extend the styles applied to the component.
|
|
203
|
+
*/
|
|
204
|
+
classes?: Partial<ChartsRadialAxisClasses>;
|
|
180
205
|
}
|
|
181
206
|
export interface ChartsRadiusAxisProps extends ChartsAxisProps {
|
|
182
207
|
axis?: 'radius';
|
|
@@ -188,6 +213,29 @@ export interface ChartsRadiusAxisProps extends ChartsAxisProps {
|
|
|
188
213
|
* The maximal radius.
|
|
189
214
|
*/
|
|
190
215
|
maxRadius?: number;
|
|
216
|
+
/**
|
|
217
|
+
* The position of the axis in polar coordinates.
|
|
218
|
+
* It can be 'start', 'end', or a specific angle in degrees.
|
|
219
|
+
* @default 'start'
|
|
220
|
+
*/
|
|
221
|
+
position?: 'start' | 'end' | number | 'none';
|
|
222
|
+
/**
|
|
223
|
+
* Set the position of the tick labels relative to the axis line.
|
|
224
|
+
* The before/after is defined based on clockwise direction.
|
|
225
|
+
* Using `'auto'` sets it to `'before'` if position is `'start'` and `'after'` otherwise.
|
|
226
|
+
* @default 'auto'
|
|
227
|
+
*/
|
|
228
|
+
tickLabelPosition?: 'center' | 'after' | 'before' | 'auto';
|
|
229
|
+
/**
|
|
230
|
+
* Set the position of the tick relative to the axis line.
|
|
231
|
+
* The before/after is defined based on clockwise direction.
|
|
232
|
+
* @default position === 'start' ? 'before' : 'after'
|
|
233
|
+
*/
|
|
234
|
+
tickPosition?: 'after' | 'before';
|
|
235
|
+
/**
|
|
236
|
+
* Override or extend the styles applied to the component.
|
|
237
|
+
*/
|
|
238
|
+
classes?: Partial<ChartsRadialAxisClasses>;
|
|
191
239
|
}
|
|
192
240
|
export type ScaleName = keyof AxisScaleConfig;
|
|
193
241
|
export type ContinuousScaleName = 'linear' | 'log' | 'symlog' | 'pow' | 'sqrt' | 'time' | 'utc';
|
|
@@ -475,7 +523,7 @@ type CommonAxisConfig<S extends ScaleName = ScaleName, V = any> = {
|
|
|
475
523
|
/**
|
|
476
524
|
* Use this type for advanced typing. For basic usage, use `RotationAxis` or `RadiusAxis`.
|
|
477
525
|
*/
|
|
478
|
-
export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends
|
|
526
|
+
export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsRadialAxisProps = ChartsRadialAxisProps> = {
|
|
479
527
|
/**
|
|
480
528
|
* The offset of the axis in pixels. It can be used to move the axis from its default position.
|
|
481
529
|
* X-axis: A top axis will move up, and a bottom axis will move down.
|
|
@@ -487,7 +535,7 @@ export type PolarAxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps
|
|
|
487
535
|
/**
|
|
488
536
|
* Use this type for advanced typing. For basic usage, use `XAxis` or `YAxis`.
|
|
489
537
|
*/
|
|
490
|
-
export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends
|
|
538
|
+
export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsCartesianAxisProps = ChartsCartesianAxisProps> = {
|
|
491
539
|
/**
|
|
492
540
|
* The offset of the axis in pixels. It can be used to move the axis from its default position.
|
|
493
541
|
* X-axis: A top axis will move up, and a bottom axis will move down.
|
|
@@ -497,13 +545,13 @@ export type AxisConfig<S extends ScaleName = ScaleName, V = any, AxisProps exten
|
|
|
497
545
|
offset?: number;
|
|
498
546
|
} & CommonAxisConfig<S, V> & MinMaxConfig<S> & Omit<Partial<AxisProps>, 'axisId'> & Partial<Omit<AxisScaleConfig[S], 'scale'>> & AxisSideConfig<AxisProps> & TickParams & AxisConfigExtension;
|
|
499
547
|
export interface AxisConfigExtension {}
|
|
500
|
-
export type PolarAxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps =
|
|
548
|
+
export type PolarAxisDefaultized<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsRadialAxisProps> = Omit<PolarAxisConfig<S, V, AxisProps>, 'scaleType'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
|
|
501
549
|
/**
|
|
502
550
|
* If true, the contents of the axis will be displayed by a tooltip with `trigger='axis'`.
|
|
503
551
|
*/
|
|
504
552
|
triggerTooltip?: boolean;
|
|
505
553
|
};
|
|
506
|
-
export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps =
|
|
554
|
+
export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsCartesianAxisProps> = AxisProps extends any ? MakeRequired<Omit<DefaultedAxis<S, V, AxisProps>, 'scaleType'>, 'offset'> & AxisScaleConfig[S] & AxisScaleComputedConfig[S] & {
|
|
507
555
|
/**
|
|
508
556
|
* An indication of the expected number of ticks.
|
|
509
557
|
*/
|
|
@@ -518,7 +566,7 @@ export type ComputedAxis<S extends ScaleName = ScaleName, V = any, AxisProps ext
|
|
|
518
566
|
height: number;
|
|
519
567
|
} : {}) & (AxisProps extends ChartsYAxisProps ? AxisSideConfig<AxisProps> & {
|
|
520
568
|
width: number;
|
|
521
|
-
} : {});
|
|
569
|
+
} : {}) : never;
|
|
522
570
|
export type ComputedXAxis<S extends ScaleName = ScaleName, V = any> = ComputedAxis<S, V, ChartsXAxisProps>;
|
|
523
571
|
export type ComputedYAxis<S extends ScaleName = ScaleName, V = any> = ComputedAxis<S, V, ChartsYAxisProps>;
|
|
524
572
|
export declare function isBandScaleConfig(scaleConfig: PolarAxisConfig<ScaleName>): scaleConfig is PolarAxisConfig<'band'> & {
|
|
@@ -580,7 +628,7 @@ export type RadiusAxis<S extends ScaleName = ScaleName, V = any> = S extends Sca
|
|
|
580
628
|
/**
|
|
581
629
|
* The axis configuration with missing values filled with default values.
|
|
582
630
|
*/
|
|
583
|
-
export type DefaultedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps =
|
|
631
|
+
export type DefaultedAxis<S extends ScaleName = ScaleName, V = any, AxisProps extends ChartsAxisProps = ChartsCartesianAxisProps> = AxisConfig<S, V, AxisProps> & {
|
|
584
632
|
zoom: DefaultizedZoomOptions | undefined;
|
|
585
633
|
};
|
|
586
634
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.2.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The community edition of MUI X Charts components.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -28,15 +28,15 @@
|
|
|
28
28
|
},
|
|
29
29
|
"dependencies": {
|
|
30
30
|
"@babel/runtime": "^7.29.2",
|
|
31
|
-
"@mui/utils": "9.0.
|
|
31
|
+
"@mui/utils": "9.0.1",
|
|
32
32
|
"bezier-easing": "^2.1.0",
|
|
33
33
|
"clsx": "^2.1.1",
|
|
34
34
|
"prop-types": "^15.8.1",
|
|
35
35
|
"reselect": "^5.1.1",
|
|
36
36
|
"use-sync-external-store": "^1.6.0",
|
|
37
|
-
"@mui/x-internal-gestures": "^9.1.0",
|
|
38
37
|
"@mui/x-charts-vendor": "^9.0.0",
|
|
39
|
-
"@mui/x-internals": "^9.1.0"
|
|
38
|
+
"@mui/x-internals": "^9.1.0",
|
|
39
|
+
"@mui/x-internal-gestures": "^9.2.0"
|
|
40
40
|
},
|
|
41
41
|
"peerDependencies": {
|
|
42
42
|
"@emotion/react": "^11.9.0",
|