@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,108 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 9.2.0
|
|
4
|
+
|
|
5
|
+
_May 13, 2026_
|
|
6
|
+
|
|
7
|
+
We'd like to extend a big thank you to the 9 contributors who made this release possible. Here are some highlights ✨:
|
|
8
|
+
|
|
9
|
+
- ⚡️ Add a WebGL renderer to the [Bar chart](https://mui.com/x/react-charts/bars/#webgl-renderer)
|
|
10
|
+
- 📊 Add a radial charts with the [radial line](https://mui.com/x/react-charts/radial-lines/), [radial bar](https://mui.com/x/react-charts/radial-bars/), and the [radial grid and axes](https://mui.com/x/react-charts/radial-axes/)
|
|
11
|
+
- 🐞 Bugfixes
|
|
12
|
+
- 📚 Documentation improvements
|
|
13
|
+
|
|
14
|
+
Special thanks go out to these community members for their valuable contributions:
|
|
15
|
+
@Anexus5919, @mustafajw07
|
|
16
|
+
|
|
17
|
+
The following team members contributed to this release:
|
|
18
|
+
@aemartos, @alexfauquette, @bernardobelchior, @JCQuintas, @oliviertassinari, @sai6855, @siriwatknp
|
|
19
|
+
|
|
20
|
+
### Data Grid
|
|
21
|
+
|
|
22
|
+
#### `@mui/x-data-grid@9.2.0`
|
|
23
|
+
|
|
24
|
+
- [data grid] Add support for pinned columns in `GridVirtualScroller` (#22347) @sai6855
|
|
25
|
+
- [data grid] Remove unused CSS (#22390) @oliviertassinari
|
|
26
|
+
|
|
27
|
+
#### `@mui/x-data-grid-pro@9.2.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
28
|
+
|
|
29
|
+
Same changes as in `@mui/x-data-grid@9.2.0`.
|
|
30
|
+
|
|
31
|
+
#### `@mui/x-data-grid-premium@9.2.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
32
|
+
|
|
33
|
+
Same changes as in `@mui/x-data-grid-pro@9.2.0`.
|
|
34
|
+
|
|
35
|
+
### Date and Time Pickers
|
|
36
|
+
|
|
37
|
+
#### `@mui/x-date-pickers@9.2.0`
|
|
38
|
+
|
|
39
|
+
- [pickers] Trim test helpers' default load graph (#22421) @JCQuintas
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-date-pickers-pro@9.2.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-date-pickers@9.2.0`.
|
|
44
|
+
|
|
45
|
+
### Charts
|
|
46
|
+
|
|
47
|
+
#### `@mui/x-charts@9.2.0`
|
|
48
|
+
|
|
49
|
+
Internal changes.
|
|
50
|
+
|
|
51
|
+
#### `@mui/x-charts-pro@9.2.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
52
|
+
|
|
53
|
+
Same changes as in `@mui/x-charts@9.2.0`.
|
|
54
|
+
|
|
55
|
+
#### `@mui/x-charts-premium@9.2.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
56
|
+
|
|
57
|
+
Same changes as in `@mui/x-charts-pro@9.2.0`, plus:
|
|
58
|
+
|
|
59
|
+
- [charts-premium] Add `Highlight` support to `RadialBarChart` (#22322) @alexfauquette
|
|
60
|
+
- [charts-premium] Add `WebGL` renderer to `BarChartPremium` (#22354) @JCQuintas
|
|
61
|
+
- [charts-premium] Add mark shape support to the radial line (#22242) @alexfauquette
|
|
62
|
+
- [charts-premium] `RadialBarChart` support axis interaction with layout horizontal (#22319) @alexfauquette
|
|
63
|
+
|
|
64
|
+
### Tree View
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-tree-view@9.1.0`
|
|
67
|
+
|
|
68
|
+
Internal changes.
|
|
69
|
+
|
|
70
|
+
#### `@mui/x-tree-view-pro@9.1.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
71
|
+
|
|
72
|
+
Same changes as in `@mui/x-tree-view@9.1.0`.
|
|
73
|
+
|
|
74
|
+
### Scheduler
|
|
75
|
+
|
|
76
|
+
#### `@mui/x-scheduler@9.0.0-alpha.6`
|
|
77
|
+
|
|
78
|
+
- [scheduler] Complete ARIA grid semantics on `EventTimeline` and `EventCalendar` (#22266) @Anexus5919
|
|
79
|
+
- [scheduler] Improve UX for recurrence tab (#22287) @mustafajw07
|
|
80
|
+
|
|
81
|
+
#### `@mui/x-scheduler-premium@9.0.0-alpha.6` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
82
|
+
|
|
83
|
+
Same changes as in `@mui/x-scheduler@9.0.0-alpha.6`.
|
|
84
|
+
|
|
85
|
+
### Codemod
|
|
86
|
+
|
|
87
|
+
#### `@mui/x-codemod@9.1.0`
|
|
88
|
+
|
|
89
|
+
Internal changes.
|
|
90
|
+
|
|
91
|
+
### Docs
|
|
92
|
+
|
|
93
|
+
- [docs] Document the `RadialBarChart` (#22320) @alexfauquette
|
|
94
|
+
- [docs] Add histogram demo to bar-demo page (#22373) @siriwatknp
|
|
95
|
+
- [docs] Add radial bar to the nav bar (#22429) @alexfauquette
|
|
96
|
+
- [docs] Split radial grid and radial line pages (#22238) @alexfauquette
|
|
97
|
+
|
|
98
|
+
### Miscellaneous
|
|
99
|
+
|
|
100
|
+
- [test] Disable animations in chart benchmarks (#22433) @bernardobelchior
|
|
101
|
+
- [test] Move `x-internal-gestures` vitest isolate flag to test block (#22427) @JCQuintas
|
|
102
|
+
- [test] Reduce flakiness in `MobileTimeRangePicker` multi-input `describeValue` tests (#22422) @JCQuintas
|
|
103
|
+
- [x-license] Exclude compat test pins from Renovate major bumps (#22414) @aemartos
|
|
104
|
+
- [x-license] Add cross-major license format compatibility tests (#22335) @aemartos
|
|
105
|
+
|
|
3
106
|
## 9.1.0
|
|
4
107
|
|
|
5
108
|
_May 8, 2026_
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type ChartsRadialAxisHighlightRotationType = 'none' | 'line' | 'band';
|
|
2
|
-
export type ChartsRadialAxisHighlightRadiusType = 'none' | 'line';
|
|
2
|
+
export type ChartsRadialAxisHighlightRadiusType = 'none' | 'line' | 'band';
|
|
3
3
|
export type ChartsRadialAxisHighlightProps = {
|
|
4
4
|
rotation?: ChartsRadialAxisHighlightRotationType;
|
|
5
5
|
radius?: ChartsRadialAxisHighlightRadiusType;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type ChartsRadialAxisHighlightRotationType = 'none' | 'line' | 'band';
|
|
2
|
-
export type ChartsRadialAxisHighlightRadiusType = 'none' | 'line';
|
|
2
|
+
export type ChartsRadialAxisHighlightRadiusType = 'none' | 'line' | 'band';
|
|
3
3
|
export type ChartsRadialAxisHighlightProps = {
|
|
4
4
|
rotation?: ChartsRadialAxisHighlightRotationType;
|
|
5
5
|
radius?: ChartsRadialAxisHighlightRadiusType;
|
|
@@ -9,8 +9,9 @@ exports.default = ChartsRadiusAxisHighlight;
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _useStore = require("../internals/store/useStore");
|
|
11
11
|
var _useChartPolarAxis = require("../internals/plugins/featurePlugins/useChartPolarAxis");
|
|
12
|
-
var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
|
|
13
12
|
var _ChartsRadialAxisHighlightPath = require("./ChartsRadialAxisHighlightPath");
|
|
13
|
+
var _getRingPath = require("../internals/getRingPath");
|
|
14
|
+
var _scaleGuards = require("../internals/scaleGuards");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function polarToSvg(cx, cy, radius, angle) {
|
|
16
17
|
return [cx + radius * Math.sin(angle), cy - radius * Math.cos(angle)];
|
|
@@ -37,29 +38,25 @@ function ChartsRadiusAxisHighlight(props) {
|
|
|
37
38
|
axis: rotationAxes,
|
|
38
39
|
axisIds: rotationAxisIds
|
|
39
40
|
} = store.use(_useChartPolarAxis.selectorChartRotationAxis);
|
|
40
|
-
const
|
|
41
|
-
const
|
|
42
|
-
if (pointerX === null || pointerY === null) {
|
|
43
|
-
return null;
|
|
44
|
-
}
|
|
41
|
+
const pointerRadius = store.use(_useChartPolarAxis.selectorChartsInteractionRadius);
|
|
42
|
+
const radiusValue = store.use(_useChartPolarAxis.selectorChartsInteractionRadiusAxisValue);
|
|
45
43
|
const radiusAxisId = radiusAxisIds[0];
|
|
46
|
-
if (radiusAxisId === undefined) {
|
|
44
|
+
if (type === 'none' || radiusAxisId === undefined || pointerRadius === null) {
|
|
47
45
|
return null;
|
|
48
46
|
}
|
|
49
47
|
const radiusAxis = radiusAxes[radiusAxisId];
|
|
50
48
|
const radiusScale = radiusAxis.scale;
|
|
51
49
|
const innerRadius = radiusScale.range()[0];
|
|
52
50
|
const outerRadius = radiusScale.range()[1];
|
|
53
|
-
const pointerRadius = Math.sqrt((pointerX - cx) ** 2 + (pointerY - cy) ** 2);
|
|
54
51
|
if (pointerRadius < innerRadius || pointerRadius > outerRadius) {
|
|
55
52
|
return null;
|
|
56
53
|
}
|
|
54
|
+
const rotationAxisId = rotationAxisIds[0];
|
|
55
|
+
const rotationAxis = rotationAxisId !== undefined ? rotationAxes[rotationAxisId] : undefined;
|
|
56
|
+
const startAngle = rotationAxis?.scale.range()[0] ?? 0;
|
|
57
|
+
const endAngle = rotationAxis?.scale.range()[1] ?? 2 * Math.PI;
|
|
58
|
+
const isFullCircle = rotationAxis?.isFullCircle ?? Math.abs(endAngle - startAngle) >= 2 * Math.PI;
|
|
57
59
|
if (type === 'line') {
|
|
58
|
-
const rotationAxisId = rotationAxisIds[0];
|
|
59
|
-
const rotationAxis = rotationAxisId !== undefined ? rotationAxes[rotationAxisId] : undefined;
|
|
60
|
-
const startAngle = rotationAxis?.scale.range()[0] ?? 0;
|
|
61
|
-
const endAngle = rotationAxis?.scale.range()[1] ?? 2 * Math.PI;
|
|
62
|
-
const isFullCircle = rotationAxis?.isFullCircle ?? Math.abs(endAngle - startAngle) >= 2 * Math.PI;
|
|
63
60
|
if (isFullCircle) {
|
|
64
61
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsRadialAxisHighlightPath.ChartsRadialAxisHighlightCircle, {
|
|
65
62
|
cx: cx,
|
|
@@ -83,5 +80,25 @@ function ChartsRadiusAxisHighlight(props) {
|
|
|
83
80
|
}
|
|
84
81
|
});
|
|
85
82
|
}
|
|
86
|
-
|
|
83
|
+
if (!(0, _scaleGuards.isOrdinalScale)(radiusAxis.scale)) {
|
|
84
|
+
return null;
|
|
85
|
+
}
|
|
86
|
+
const radius = radiusAxis.scale(radiusValue);
|
|
87
|
+
const step = radiusAxis.scale.step();
|
|
88
|
+
const bandwidth = radiusAxis.scale.bandwidth();
|
|
89
|
+
const bandInnerRadius = radius - (step - bandwidth) / 2;
|
|
90
|
+
const bandOuterRadius = bandInnerRadius + step;
|
|
91
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsRadialAxisHighlightPath.ChartsRadialAxisHighlightPath, {
|
|
92
|
+
d: (0, _getRingPath.getRingPath)({
|
|
93
|
+
x: cx,
|
|
94
|
+
y: cy
|
|
95
|
+
}, bandInnerRadius, bandOuterRadius, isFullCircle ? undefined : {
|
|
96
|
+
start: startAngle,
|
|
97
|
+
end: endAngle
|
|
98
|
+
}),
|
|
99
|
+
className: classes.root,
|
|
100
|
+
ownerState: {
|
|
101
|
+
axisHighlight: 'band'
|
|
102
|
+
}
|
|
103
|
+
});
|
|
87
104
|
}
|
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import { useStore } from "../internals/store/useStore.mjs";
|
|
5
|
-
import { selectorChartPolarCenter, selectorChartRadiusAxis, selectorChartRotationAxis } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.mjs";
|
|
6
|
-
import { selectorChartsInteractionPointerX, selectorChartsInteractionPointerY } from "../internals/plugins/featurePlugins/useChartInteraction/index.mjs";
|
|
5
|
+
import { selectorChartPolarCenter, selectorChartRadiusAxis, selectorChartRotationAxis, selectorChartsInteractionRadius, selectorChartsInteractionRadiusAxisValue } from "../internals/plugins/featurePlugins/useChartPolarAxis/index.mjs";
|
|
7
6
|
import { ChartsRadialAxisHighlightCircle, ChartsRadialAxisHighlightPath } from "./ChartsRadialAxisHighlightPath.mjs";
|
|
7
|
+
import { getRingPath } from "../internals/getRingPath.mjs";
|
|
8
|
+
import { isOrdinalScale } from "../internals/scaleGuards.mjs";
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
function polarToSvg(cx, cy, radius, angle) {
|
|
10
11
|
return [cx + radius * Math.sin(angle), cy - radius * Math.cos(angle)];
|
|
@@ -31,29 +32,25 @@ export default function ChartsRadiusAxisHighlight(props) {
|
|
|
31
32
|
axis: rotationAxes,
|
|
32
33
|
axisIds: rotationAxisIds
|
|
33
34
|
} = store.use(selectorChartRotationAxis);
|
|
34
|
-
const
|
|
35
|
-
const
|
|
36
|
-
if (pointerX === null || pointerY === null) {
|
|
37
|
-
return null;
|
|
38
|
-
}
|
|
35
|
+
const pointerRadius = store.use(selectorChartsInteractionRadius);
|
|
36
|
+
const radiusValue = store.use(selectorChartsInteractionRadiusAxisValue);
|
|
39
37
|
const radiusAxisId = radiusAxisIds[0];
|
|
40
|
-
if (radiusAxisId === undefined) {
|
|
38
|
+
if (type === 'none' || radiusAxisId === undefined || pointerRadius === null) {
|
|
41
39
|
return null;
|
|
42
40
|
}
|
|
43
41
|
const radiusAxis = radiusAxes[radiusAxisId];
|
|
44
42
|
const radiusScale = radiusAxis.scale;
|
|
45
43
|
const innerRadius = radiusScale.range()[0];
|
|
46
44
|
const outerRadius = radiusScale.range()[1];
|
|
47
|
-
const pointerRadius = Math.sqrt((pointerX - cx) ** 2 + (pointerY - cy) ** 2);
|
|
48
45
|
if (pointerRadius < innerRadius || pointerRadius > outerRadius) {
|
|
49
46
|
return null;
|
|
50
47
|
}
|
|
48
|
+
const rotationAxisId = rotationAxisIds[0];
|
|
49
|
+
const rotationAxis = rotationAxisId !== undefined ? rotationAxes[rotationAxisId] : undefined;
|
|
50
|
+
const startAngle = rotationAxis?.scale.range()[0] ?? 0;
|
|
51
|
+
const endAngle = rotationAxis?.scale.range()[1] ?? 2 * Math.PI;
|
|
52
|
+
const isFullCircle = rotationAxis?.isFullCircle ?? Math.abs(endAngle - startAngle) >= 2 * Math.PI;
|
|
51
53
|
if (type === 'line') {
|
|
52
|
-
const rotationAxisId = rotationAxisIds[0];
|
|
53
|
-
const rotationAxis = rotationAxisId !== undefined ? rotationAxes[rotationAxisId] : undefined;
|
|
54
|
-
const startAngle = rotationAxis?.scale.range()[0] ?? 0;
|
|
55
|
-
const endAngle = rotationAxis?.scale.range()[1] ?? 2 * Math.PI;
|
|
56
|
-
const isFullCircle = rotationAxis?.isFullCircle ?? Math.abs(endAngle - startAngle) >= 2 * Math.PI;
|
|
57
54
|
if (isFullCircle) {
|
|
58
55
|
return /*#__PURE__*/_jsx(ChartsRadialAxisHighlightCircle, {
|
|
59
56
|
cx: cx,
|
|
@@ -77,5 +74,25 @@ export default function ChartsRadiusAxisHighlight(props) {
|
|
|
77
74
|
}
|
|
78
75
|
});
|
|
79
76
|
}
|
|
80
|
-
|
|
77
|
+
if (!isOrdinalScale(radiusAxis.scale)) {
|
|
78
|
+
return null;
|
|
79
|
+
}
|
|
80
|
+
const radius = radiusAxis.scale(radiusValue);
|
|
81
|
+
const step = radiusAxis.scale.step();
|
|
82
|
+
const bandwidth = radiusAxis.scale.bandwidth();
|
|
83
|
+
const bandInnerRadius = radius - (step - bandwidth) / 2;
|
|
84
|
+
const bandOuterRadius = bandInnerRadius + step;
|
|
85
|
+
return /*#__PURE__*/_jsx(ChartsRadialAxisHighlightPath, {
|
|
86
|
+
d: getRingPath({
|
|
87
|
+
x: cx,
|
|
88
|
+
y: cy
|
|
89
|
+
}, bandInnerRadius, bandOuterRadius, isFullCircle ? undefined : {
|
|
90
|
+
start: startAngle,
|
|
91
|
+
end: endAngle
|
|
92
|
+
}),
|
|
93
|
+
className: classes.root,
|
|
94
|
+
ownerState: {
|
|
95
|
+
axisHighlight: 'band'
|
|
96
|
+
}
|
|
97
|
+
});
|
|
81
98
|
}
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type ChartsRadialAxisClasses } from "./chartsRadiusAxisClasses.mjs";
|
|
3
|
-
export interface ChartsRadiusAxisProps {
|
|
4
|
-
/**
|
|
5
|
-
* Id of the radius axis to render.
|
|
6
|
-
* If not provided, it will use the first defined radius axis.
|
|
7
|
-
*/
|
|
8
|
-
axisId?: AxisId;
|
|
9
|
-
/**
|
|
10
|
-
* The position of the axis in polar coordinates.
|
|
11
|
-
* It can be 'start', 'end', or a specific angle in degrees.
|
|
12
|
-
* @default 'start'
|
|
13
|
-
*/
|
|
14
|
-
position?: 'start' | 'end' | number;
|
|
15
|
-
/**
|
|
16
|
-
* If `true`, the axis line is not rendered.
|
|
17
|
-
* @default false
|
|
18
|
-
*/
|
|
19
|
-
disableLine?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* If `true`, the ticks are not rendered.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
disableTicks?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* The size (in pixels) of the tick marks.
|
|
27
|
-
* @default 6
|
|
28
|
-
*/
|
|
29
|
-
tickSize?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Set the position of the tick labels relative to the axis line.
|
|
32
|
-
* The before/after is defined based on clockwise direction.
|
|
33
|
-
* @default 'after'
|
|
34
|
-
*/
|
|
35
|
-
tickLabelPosition?: 'center' | 'after' | 'before';
|
|
36
|
-
/**
|
|
37
|
-
* Set the position of the tick relative to the axis line.
|
|
38
|
-
* The before/after is defined based on clockwise direction.
|
|
39
|
-
* @default 'after'
|
|
40
|
-
*/
|
|
41
|
-
tickPosition?: 'after' | 'before';
|
|
42
|
-
/**
|
|
43
|
-
* A CSS class name applied to the root element.
|
|
44
|
-
*/
|
|
45
|
-
className?: string;
|
|
46
|
-
classes?: Partial<ChartsRadialAxisClasses>;
|
|
47
|
-
}
|
|
1
|
+
import type { ChartsRadiusAxisProps } from "../models/axis.mjs";
|
|
48
2
|
export declare function ChartsRadiusAxis(props: ChartsRadiusAxisProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type ChartsRadialAxisClasses } from "./chartsRadiusAxisClasses.js";
|
|
3
|
-
export interface ChartsRadiusAxisProps {
|
|
4
|
-
/**
|
|
5
|
-
* Id of the radius axis to render.
|
|
6
|
-
* If not provided, it will use the first defined radius axis.
|
|
7
|
-
*/
|
|
8
|
-
axisId?: AxisId;
|
|
9
|
-
/**
|
|
10
|
-
* The position of the axis in polar coordinates.
|
|
11
|
-
* It can be 'start', 'end', or a specific angle in degrees.
|
|
12
|
-
* @default 'start'
|
|
13
|
-
*/
|
|
14
|
-
position?: 'start' | 'end' | number;
|
|
15
|
-
/**
|
|
16
|
-
* If `true`, the axis line is not rendered.
|
|
17
|
-
* @default false
|
|
18
|
-
*/
|
|
19
|
-
disableLine?: boolean;
|
|
20
|
-
/**
|
|
21
|
-
* If `true`, the ticks are not rendered.
|
|
22
|
-
* @default false
|
|
23
|
-
*/
|
|
24
|
-
disableTicks?: boolean;
|
|
25
|
-
/**
|
|
26
|
-
* The size (in pixels) of the tick marks.
|
|
27
|
-
* @default 6
|
|
28
|
-
*/
|
|
29
|
-
tickSize?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Set the position of the tick labels relative to the axis line.
|
|
32
|
-
* The before/after is defined based on clockwise direction.
|
|
33
|
-
* @default 'after'
|
|
34
|
-
*/
|
|
35
|
-
tickLabelPosition?: 'center' | 'after' | 'before';
|
|
36
|
-
/**
|
|
37
|
-
* Set the position of the tick relative to the axis line.
|
|
38
|
-
* The before/after is defined based on clockwise direction.
|
|
39
|
-
* @default 'after'
|
|
40
|
-
*/
|
|
41
|
-
tickPosition?: 'after' | 'before';
|
|
42
|
-
/**
|
|
43
|
-
* A CSS class name applied to the root element.
|
|
44
|
-
*/
|
|
45
|
-
className?: string;
|
|
46
|
-
classes?: Partial<ChartsRadialAxisClasses>;
|
|
47
|
-
}
|
|
1
|
+
import type { ChartsRadiusAxisProps } from "../models/axis.js";
|
|
48
2
|
export declare function ChartsRadiusAxis(props: ChartsRadiusAxisProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -17,8 +17,7 @@ var _chartsRadiusAxisClasses = require("./chartsRadiusAxisClasses");
|
|
|
17
17
|
var _createGetLabelTextAnchors = require("./createGetLabelTextAnchors");
|
|
18
18
|
var _getLabelTransform = require("./getLabelTransform");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
/* Gap between a tick and its label. */
|
|
21
|
-
const TICK_LABEL_GAP = 3;
|
|
20
|
+
/* Gap between a tick and its label. */const TICK_LABEL_GAP = 3;
|
|
22
21
|
const getLabelTextAnchors = (0, _createGetLabelTextAnchors.createGetLabelTextAnchors)(_getLabelTransform.getLabelTransform);
|
|
23
22
|
|
|
24
23
|
/**
|
|
@@ -40,17 +39,22 @@ function getAxisAngleInRadians(position, rotationAxis) {
|
|
|
40
39
|
return 0;
|
|
41
40
|
}
|
|
42
41
|
function ChartsRadiusAxis(props) {
|
|
42
|
+
const radiusAxis = (0, _useAxis.useRadiusAxis)(props.axisId);
|
|
43
|
+
const settings = (0, _extends2.default)({}, radiusAxis, props);
|
|
43
44
|
const {
|
|
44
|
-
axisId,
|
|
45
45
|
position = 'start',
|
|
46
46
|
disableLine,
|
|
47
47
|
disableTicks,
|
|
48
|
-
tickLabelPosition = '
|
|
49
|
-
tickPosition = 'after',
|
|
48
|
+
tickLabelPosition: tickLabelPositionProp = 'auto',
|
|
49
|
+
tickPosition = position === 'start' ? 'before' : 'after',
|
|
50
50
|
tickSize = 6,
|
|
51
51
|
className,
|
|
52
52
|
classes: classesProp
|
|
53
|
-
} =
|
|
53
|
+
} = settings;
|
|
54
|
+
let tickLabelPosition = tickLabelPositionProp;
|
|
55
|
+
if (tickLabelPosition === 'auto') {
|
|
56
|
+
tickLabelPosition = position === 'start' ? 'before' : 'after';
|
|
57
|
+
}
|
|
54
58
|
const isCentered = tickLabelPosition === 'center';
|
|
55
59
|
const classes = (0, _chartsRadiusAxisClasses.useUtilityClasses)({
|
|
56
60
|
classes: classesProp,
|
|
@@ -64,7 +68,6 @@ function ChartsRadiusAxis(props) {
|
|
|
64
68
|
cx,
|
|
65
69
|
cy
|
|
66
70
|
} = store.use(_useChartPolarAxis.selectorChartPolarCenter);
|
|
67
|
-
const radiusAxis = (0, _useAxis.useRadiusAxis)(axisId);
|
|
68
71
|
const rotationAxis = (0, _useAxis.useRotationAxis)();
|
|
69
72
|
const ticks = (0, _useTicks.useTicks)({
|
|
70
73
|
scale: radiusAxis.scale,
|
|
@@ -74,7 +77,7 @@ function ChartsRadiusAxis(props) {
|
|
|
74
77
|
valueFormatter: radiusAxis?.valueFormatter,
|
|
75
78
|
direction: 'radius'
|
|
76
79
|
});
|
|
77
|
-
if (!radiusAxis) {
|
|
80
|
+
if (!radiusAxis || settings.position === 'none') {
|
|
78
81
|
return null;
|
|
79
82
|
}
|
|
80
83
|
const angle = getAxisAngleInRadians(position, rotationAxis);
|
|
@@ -102,17 +105,18 @@ function ChartsRadiusAxis(props) {
|
|
|
102
105
|
className: classes.line
|
|
103
106
|
}), ticks.map(({
|
|
104
107
|
offset: radius,
|
|
108
|
+
labelOffset,
|
|
105
109
|
formattedValue
|
|
106
110
|
}, index) => {
|
|
107
111
|
if (!formattedValue) {
|
|
108
112
|
return null;
|
|
109
113
|
}
|
|
110
|
-
const
|
|
111
|
-
const
|
|
114
|
+
const tickX = cx + dx * radius;
|
|
115
|
+
const tickY = cy + dy * radius;
|
|
112
116
|
|
|
113
117
|
// Compute the label position.
|
|
114
|
-
let labelX =
|
|
115
|
-
let labelY =
|
|
118
|
+
let labelX = cx + dx * (radius + labelOffset);
|
|
119
|
+
let labelY = cy + dy * (radius + labelOffset);
|
|
116
120
|
if (tickLabelGap !== 0) {
|
|
117
121
|
labelX += tickLabelGapDx;
|
|
118
122
|
labelY += tickLabelGapDy;
|
|
@@ -125,10 +129,10 @@ function ChartsRadiusAxis(props) {
|
|
|
125
129
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
126
130
|
className: classes.tickContainer,
|
|
127
131
|
children: [!disableTicks && /*#__PURE__*/(0, _jsxRuntime.jsx)("line", {
|
|
128
|
-
x1:
|
|
129
|
-
y1:
|
|
130
|
-
x2:
|
|
131
|
-
y2:
|
|
132
|
+
x1: tickX,
|
|
133
|
+
y1: tickY,
|
|
134
|
+
x2: tickX + tickDx,
|
|
135
|
+
y2: tickY + tickDy,
|
|
132
136
|
stroke: stroke,
|
|
133
137
|
className: classes.tick
|
|
134
138
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)("text", (0, _extends2.default)({
|
|
@@ -10,8 +10,9 @@ import { selectorChartPolarCenter } from "../internals/plugins/featurePlugins/us
|
|
|
10
10
|
import { useUtilityClasses } from "./chartsRadiusAxisClasses.mjs";
|
|
11
11
|
import { createGetLabelTextAnchors } from "./createGetLabelTextAnchors.mjs";
|
|
12
12
|
import { getLabelTransform } from "./getLabelTransform.mjs";
|
|
13
|
-
|
|
13
|
+
|
|
14
14
|
/* Gap between a tick and its label. */
|
|
15
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
const TICK_LABEL_GAP = 3;
|
|
16
17
|
const getLabelTextAnchors = createGetLabelTextAnchors(getLabelTransform);
|
|
17
18
|
|
|
@@ -34,17 +35,22 @@ function getAxisAngleInRadians(position, rotationAxis) {
|
|
|
34
35
|
return 0;
|
|
35
36
|
}
|
|
36
37
|
export function ChartsRadiusAxis(props) {
|
|
38
|
+
const radiusAxis = useRadiusAxis(props.axisId);
|
|
39
|
+
const settings = _extends({}, radiusAxis, props);
|
|
37
40
|
const {
|
|
38
|
-
axisId,
|
|
39
41
|
position = 'start',
|
|
40
42
|
disableLine,
|
|
41
43
|
disableTicks,
|
|
42
|
-
tickLabelPosition = '
|
|
43
|
-
tickPosition = 'after',
|
|
44
|
+
tickLabelPosition: tickLabelPositionProp = 'auto',
|
|
45
|
+
tickPosition = position === 'start' ? 'before' : 'after',
|
|
44
46
|
tickSize = 6,
|
|
45
47
|
className,
|
|
46
48
|
classes: classesProp
|
|
47
|
-
} =
|
|
49
|
+
} = settings;
|
|
50
|
+
let tickLabelPosition = tickLabelPositionProp;
|
|
51
|
+
if (tickLabelPosition === 'auto') {
|
|
52
|
+
tickLabelPosition = position === 'start' ? 'before' : 'after';
|
|
53
|
+
}
|
|
48
54
|
const isCentered = tickLabelPosition === 'center';
|
|
49
55
|
const classes = useUtilityClasses({
|
|
50
56
|
classes: classesProp,
|
|
@@ -58,7 +64,6 @@ export function ChartsRadiusAxis(props) {
|
|
|
58
64
|
cx,
|
|
59
65
|
cy
|
|
60
66
|
} = store.use(selectorChartPolarCenter);
|
|
61
|
-
const radiusAxis = useRadiusAxis(axisId);
|
|
62
67
|
const rotationAxis = useRotationAxis();
|
|
63
68
|
const ticks = useTicks({
|
|
64
69
|
scale: radiusAxis.scale,
|
|
@@ -68,7 +73,7 @@ export function ChartsRadiusAxis(props) {
|
|
|
68
73
|
valueFormatter: radiusAxis?.valueFormatter,
|
|
69
74
|
direction: 'radius'
|
|
70
75
|
});
|
|
71
|
-
if (!radiusAxis) {
|
|
76
|
+
if (!radiusAxis || settings.position === 'none') {
|
|
72
77
|
return null;
|
|
73
78
|
}
|
|
74
79
|
const angle = getAxisAngleInRadians(position, rotationAxis);
|
|
@@ -96,17 +101,18 @@ export function ChartsRadiusAxis(props) {
|
|
|
96
101
|
className: classes.line
|
|
97
102
|
}), ticks.map(({
|
|
98
103
|
offset: radius,
|
|
104
|
+
labelOffset,
|
|
99
105
|
formattedValue
|
|
100
106
|
}, index) => {
|
|
101
107
|
if (!formattedValue) {
|
|
102
108
|
return null;
|
|
103
109
|
}
|
|
104
|
-
const
|
|
105
|
-
const
|
|
110
|
+
const tickX = cx + dx * radius;
|
|
111
|
+
const tickY = cy + dy * radius;
|
|
106
112
|
|
|
107
113
|
// Compute the label position.
|
|
108
|
-
let labelX =
|
|
109
|
-
let labelY =
|
|
114
|
+
let labelX = cx + dx * (radius + labelOffset);
|
|
115
|
+
let labelY = cy + dy * (radius + labelOffset);
|
|
110
116
|
if (tickLabelGap !== 0) {
|
|
111
117
|
labelX += tickLabelGapDx;
|
|
112
118
|
labelY += tickLabelGapDy;
|
|
@@ -119,10 +125,10 @@ export function ChartsRadiusAxis(props) {
|
|
|
119
125
|
return /*#__PURE__*/_jsxs("g", {
|
|
120
126
|
className: classes.tickContainer,
|
|
121
127
|
children: [!disableTicks && /*#__PURE__*/_jsx("line", {
|
|
122
|
-
x1:
|
|
123
|
-
y1:
|
|
124
|
-
x2:
|
|
125
|
-
y2:
|
|
128
|
+
x1: tickX,
|
|
129
|
+
y1: tickY,
|
|
130
|
+
x2: tickX + tickDx,
|
|
131
|
+
y2: tickY + tickDy,
|
|
126
132
|
stroke: stroke,
|
|
127
133
|
className: classes.tick
|
|
128
134
|
}), /*#__PURE__*/_jsx("text", _extends({
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type ChartsRadialAxisClasses } from "./chartsRotationAxisClasses.mjs";
|
|
3
|
-
export interface ChartsRotationAxisProps {
|
|
4
|
-
/**
|
|
5
|
-
* Id of the rotation axis to render.
|
|
6
|
-
* If not provided, it will use the first defined rotation axis.
|
|
7
|
-
*/
|
|
8
|
-
axisId?: AxisId;
|
|
9
|
-
/**
|
|
10
|
-
* If `true`, the axis line is not rendered.
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
disableLine?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* If `true`, the ticks are not rendered.
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
disableTicks?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The position of the rotation axis.
|
|
21
|
-
* It can be 'inside' or 'outside'.
|
|
22
|
-
* @default 'outside'
|
|
23
|
-
*/
|
|
24
|
-
position?: 'inside' | 'outside';
|
|
25
|
-
/**
|
|
26
|
-
* The size (in pixels) of the tick marks.
|
|
27
|
-
* @default 6
|
|
28
|
-
*/
|
|
29
|
-
tickSize?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Set the position of the tick labels relative to the axis line.
|
|
32
|
-
* `'after'` places them outside the arc, `'before'` inside.
|
|
33
|
-
* @default position === 'outside' ? 'after' : 'before'
|
|
34
|
-
*/
|
|
35
|
-
tickLabelPosition?: 'after' | 'before';
|
|
36
|
-
/**
|
|
37
|
-
* Set the position of the tick relative to the axis line.
|
|
38
|
-
* `'after'` places them outside the arc, `'before'` inside.
|
|
39
|
-
* @default position === 'outside' ? 'after' : 'before'
|
|
40
|
-
*/
|
|
41
|
-
tickPosition?: 'after' | 'before';
|
|
42
|
-
/**
|
|
43
|
-
* A CSS class name applied to the root element.
|
|
44
|
-
*/
|
|
45
|
-
className?: string;
|
|
46
|
-
classes?: Partial<ChartsRadialAxisClasses>;
|
|
47
|
-
}
|
|
1
|
+
import type { ChartsRotationAxisProps } from "../models/axis.mjs";
|
|
48
2
|
export declare function ChartsRotationAxis(props: ChartsRotationAxisProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,48 +1,2 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import { type ChartsRadialAxisClasses } from "./chartsRotationAxisClasses.js";
|
|
3
|
-
export interface ChartsRotationAxisProps {
|
|
4
|
-
/**
|
|
5
|
-
* Id of the rotation axis to render.
|
|
6
|
-
* If not provided, it will use the first defined rotation axis.
|
|
7
|
-
*/
|
|
8
|
-
axisId?: AxisId;
|
|
9
|
-
/**
|
|
10
|
-
* If `true`, the axis line is not rendered.
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
disableLine?: boolean;
|
|
14
|
-
/**
|
|
15
|
-
* If `true`, the ticks are not rendered.
|
|
16
|
-
* @default false
|
|
17
|
-
*/
|
|
18
|
-
disableTicks?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* The position of the rotation axis.
|
|
21
|
-
* It can be 'inside' or 'outside'.
|
|
22
|
-
* @default 'outside'
|
|
23
|
-
*/
|
|
24
|
-
position?: 'inside' | 'outside';
|
|
25
|
-
/**
|
|
26
|
-
* The size (in pixels) of the tick marks.
|
|
27
|
-
* @default 6
|
|
28
|
-
*/
|
|
29
|
-
tickSize?: number;
|
|
30
|
-
/**
|
|
31
|
-
* Set the position of the tick labels relative to the axis line.
|
|
32
|
-
* `'after'` places them outside the arc, `'before'` inside.
|
|
33
|
-
* @default position === 'outside' ? 'after' : 'before'
|
|
34
|
-
*/
|
|
35
|
-
tickLabelPosition?: 'after' | 'before';
|
|
36
|
-
/**
|
|
37
|
-
* Set the position of the tick relative to the axis line.
|
|
38
|
-
* `'after'` places them outside the arc, `'before'` inside.
|
|
39
|
-
* @default position === 'outside' ? 'after' : 'before'
|
|
40
|
-
*/
|
|
41
|
-
tickPosition?: 'after' | 'before';
|
|
42
|
-
/**
|
|
43
|
-
* A CSS class name applied to the root element.
|
|
44
|
-
*/
|
|
45
|
-
className?: string;
|
|
46
|
-
classes?: Partial<ChartsRadialAxisClasses>;
|
|
47
|
-
}
|
|
1
|
+
import type { ChartsRotationAxisProps } from "../models/axis.js";
|
|
48
2
|
export declare function ChartsRotationAxis(props: ChartsRotationAxisProps): import("react/jsx-runtime").JSX.Element | null;
|