@mui/x-charts 7.0.0-alpha.5 → 7.0.0-alpha.7
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 +185 -3
- package/LineChart/formatter.js +1 -1
- package/PieChart/PieArcLabel.d.ts +1 -0
- package/PieChart/PieArcLabel.js +7 -8
- package/PieChart/PieArcLabelPlot.js +14 -3
- package/PieChart/PieArcPlot.js +8 -1
- package/PieChart/PieChart.js +3 -0
- package/PieChart/PiePlot.js +3 -0
- package/PieChart/dataTransform/transition.js +9 -2
- package/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +11 -8
- package/esm/LineChart/formatter.js +1 -1
- package/esm/PieChart/PieArcLabel.js +7 -8
- package/esm/PieChart/PieArcLabelPlot.js +14 -3
- package/esm/PieChart/PieArcPlot.js +8 -1
- package/esm/PieChart/PieChart.js +3 -0
- package/esm/PieChart/PiePlot.js +3 -0
- package/esm/PieChart/dataTransform/transition.js +9 -2
- package/esm/PieChart/dataTransform/useTransformData.js +12 -9
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +3 -0
- package/legacy/LineChart/formatter.js +1 -1
- package/legacy/PieChart/PieArcLabel.js +7 -8
- package/legacy/PieChart/PieArcLabelPlot.js +14 -4
- package/legacy/PieChart/PieArcPlot.js +9 -1
- package/legacy/PieChart/PieChart.js +3 -0
- package/legacy/PieChart/PiePlot.js +3 -0
- package/legacy/PieChart/dataTransform/transition.js +9 -2
- package/legacy/PieChart/dataTransform/useTransformData.js +12 -9
- package/legacy/index.js +1 -1
- package/models/seriesType/pie.d.ts +14 -0
- package/modern/LineChart/formatter.js +1 -1
- package/modern/PieChart/PieArcLabel.js +7 -8
- package/modern/PieChart/PieArcLabelPlot.js +14 -3
- package/modern/PieChart/PieArcPlot.js +8 -1
- package/modern/PieChart/PieChart.js +3 -0
- package/modern/PieChart/PiePlot.js +3 -0
- package/modern/PieChart/dataTransform/transition.js +9 -2
- package/modern/PieChart/dataTransform/useTransformData.js +11 -8
- package/modern/index.js +1 -1
- package/package.json +5 -5
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,146 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## 7.0.0-alpha.7
|
|
7
|
+
|
|
8
|
+
_Jan 5, 2024_
|
|
9
|
+
|
|
10
|
+
We'd like to offer a big thanks to the 7 contributors who made this release possible. Here are some highlights ✨:
|
|
11
|
+
|
|
12
|
+
- 🎁 New component to create a Tree View from a structured data source:
|
|
13
|
+
|
|
14
|
+
You can now directly pass your data to the `RichTreeView` component instead of manually converting it into JSX `TreeItem` components:
|
|
15
|
+
|
|
16
|
+
```tsx
|
|
17
|
+
const ITEMS = [
|
|
18
|
+
{
|
|
19
|
+
id: 'node-1',
|
|
20
|
+
label: 'Node 1',
|
|
21
|
+
children: [
|
|
22
|
+
{ id: 'node-1-1', label: Node 1.1' },
|
|
23
|
+
{ id: 'node-1-2', label: Node 1.2' },
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
id: 'node-2',
|
|
28
|
+
label: 'Node 2',
|
|
29
|
+
},
|
|
30
|
+
];
|
|
31
|
+
|
|
32
|
+
<RichTreeView
|
|
33
|
+
items={MUI_X_PRODUCTS}
|
|
34
|
+
defaultCollapseIcon={<ExpandMoreIcon />}
|
|
35
|
+
defaultExpandIcon={<ChevronRightIcon />}
|
|
36
|
+
/>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
- 🌍 Improve Czech (cs-CZ) locale on the Data Grid
|
|
40
|
+
- 🐞 Bugfixes
|
|
41
|
+
|
|
42
|
+
### Data Grid
|
|
43
|
+
|
|
44
|
+
#### `@mui/x-data-grid@7.0.0-alpha.7`
|
|
45
|
+
|
|
46
|
+
- [DataGrid] Don't evaluate `hasEval` when `disableEval` is set (#11516) @reihwald
|
|
47
|
+
- [DataGrid] follow warning message guideline for `autoPageSize` and `autoHeight` (#11585) @Sboonny
|
|
48
|
+
- [DataGrid] Replace `eval` with `new Function` (#11557) @oliviertassinari
|
|
49
|
+
- [DataGrid] Warn devs when `autoPageSize` is used with `autoHeight` (#11554) @Sboonny
|
|
50
|
+
- [l10n] Improve Czech (cs-CZ) locale (#11526) @fdebef
|
|
51
|
+
|
|
52
|
+
#### `@mui/x-data-grid-pro@7.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
53
|
+
|
|
54
|
+
Same changes as in `@mui/x-data-grid@7.0.0-alpha.7`.
|
|
55
|
+
|
|
56
|
+
#### `@mui/x-data-grid-premium@7.0.0-alpha.7` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
57
|
+
|
|
58
|
+
Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.7`.
|
|
59
|
+
|
|
60
|
+
### Date Pickers
|
|
61
|
+
|
|
62
|
+
#### `@mui/x-date-pickers@7.0.0-alpha.7`
|
|
63
|
+
|
|
64
|
+
- [pickers] Fix views management (#11419) @LukasTy
|
|
65
|
+
|
|
66
|
+
#### `@mui/x-date-pickers-pro@7.0.0-alpha.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
67
|
+
|
|
68
|
+
Same changes as in `@mui/x-date-pickers@7.0.0-alpha.7`.
|
|
69
|
+
|
|
70
|
+
### Charts / `@mui/x-charts@7.0.0-alpha.7`
|
|
71
|
+
|
|
72
|
+
- [charts] Add `arcLabelRadius` property (#11487) @alexfauquette
|
|
73
|
+
- [charts] Fix `null` in line chart using dataset (#11550) @alexfauquette
|
|
74
|
+
|
|
75
|
+
### Tree View
|
|
76
|
+
|
|
77
|
+
#### Breaking changes
|
|
78
|
+
|
|
79
|
+
- The expansion props have been renamed to better describe their behaviors:
|
|
80
|
+
|
|
81
|
+
| Old name | New name |
|
|
82
|
+
| :---------------- | :---------------------- |
|
|
83
|
+
| `onNodeToggle` | `onExpandedNodesChange` |
|
|
84
|
+
| `expanded` | `expandedNodes` |
|
|
85
|
+
| `defaultExpanded` | `defaultExpandedNodes` |
|
|
86
|
+
|
|
87
|
+
```diff
|
|
88
|
+
<TreeView
|
|
89
|
+
- onNodeToggle={handleExpansionChange}
|
|
90
|
+
+ onExpandedNodesChange={handleExpansionChange}
|
|
91
|
+
|
|
92
|
+
- expanded={expandedNodes}
|
|
93
|
+
+ expandedNodes={expandedNodes}
|
|
94
|
+
|
|
95
|
+
- defaultExpanded={defaultExpandedNodes}
|
|
96
|
+
+ defaultExpandedNodes={defaultExpandedNodes}
|
|
97
|
+
/>
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
- The selection props have been renamed to better describe their behaviors:
|
|
101
|
+
|
|
102
|
+
| Old name | New name |
|
|
103
|
+
| :---------------- | :---------------------- |
|
|
104
|
+
| `onNodeSelect` | `onSelectedNodesChange` |
|
|
105
|
+
| `selected` | `selectedNodes` |
|
|
106
|
+
| `defaultSelected` | `defaultSelectedNodes` |
|
|
107
|
+
|
|
108
|
+
```diff
|
|
109
|
+
<TreeView
|
|
110
|
+
- onNodeSelect={handleSelectionChange}
|
|
111
|
+
+ onSelectedNodesChange={handleSelectionChange}
|
|
112
|
+
|
|
113
|
+
- selected={selectedNodes}
|
|
114
|
+
+ selectedNodes={selectedNodes}
|
|
115
|
+
|
|
116
|
+
- defaultSelected={defaultSelectedNodes}
|
|
117
|
+
+ defaultSelectedNodes={defaultSelectedNodes}
|
|
118
|
+
/>
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
#### `@mui/x-tree-view@7.0.0-alpha.7`
|
|
122
|
+
|
|
123
|
+
- [TreeView] Improve the expansion API (#11476) @flaviendelangle
|
|
124
|
+
- [TreeView] Improve the selection API (#11560) @flaviendelangle
|
|
125
|
+
- [TreeView] Introduce the `items` prop (#11059) @flaviendelangle
|
|
126
|
+
|
|
127
|
+
### Docs
|
|
128
|
+
|
|
129
|
+
- [docs] Add example for TreeView `onNodeExpansionToggle` prop (#11547) @flaviendelangle
|
|
130
|
+
- [docs] Clarify Pickers usage with Luxon (#11545) @LukasTy
|
|
131
|
+
- [docs] Complete transition to next branch (#11521) @oliviertassinari
|
|
132
|
+
- [docs] Fix 404 links in the docs @oliviertassinari
|
|
133
|
+
- [docs] Fix over page fetching @oliviertassinari
|
|
134
|
+
- [docs] Lint `next.config.js` (#11514) @oliviertassinari
|
|
135
|
+
|
|
136
|
+
### Core
|
|
137
|
+
|
|
138
|
+
- [core] Fix release changelog (#11496) @romgrk
|
|
139
|
+
- [core] Fix use of ::before & ::after (#11515) @oliviertassinari
|
|
140
|
+
- [core] Localize the issue template to MUI X (#11511) @oliviertassinari
|
|
141
|
+
- [core] Regen api files (#11542) @flaviendelangle
|
|
142
|
+
- [core] Remove issue emoji @oliviertassinari
|
|
143
|
+
- [core] Sync the release instructions with MUI Core @oliviertassinari
|
|
144
|
+
- [core] Yaml format match most common convention @oliviertassinari
|
|
145
|
+
|
|
6
146
|
## 7.0.0-alpha.6
|
|
7
147
|
|
|
8
148
|
_Dec 22, 2023_
|
|
@@ -65,7 +205,6 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.6`.
|
|
|
65
205
|
- [fields] Adjust `PickersInput` sizing styles (#11392) @noraleonte
|
|
66
206
|
- [fields] Fix section pasting (#11447) @LukasTy
|
|
67
207
|
- [pickers] Add `PickersTextField` `standard` and `filled` variants (#11250) @noraleonte
|
|
68
|
-
- [pickers] Add missing breaking changes to changelog (#11420) @MBilalShafi
|
|
69
208
|
- [pickers] Cleanup error messages in `PickersSectionList` (#11449) @flaviendelangle
|
|
70
209
|
- [pickers] Create new component `PickersSectionList` (#11352) @flaviendelangle
|
|
71
210
|
|
|
@@ -73,7 +212,7 @@ Same changes as in `@mui/x-data-grid-pro@7.0.0-alpha.6`.
|
|
|
73
212
|
|
|
74
213
|
Same changes as in `@mui/x-date-pickers@7.0.0-alpha.6`.
|
|
75
214
|
|
|
76
|
-
### Charts / `@mui/x-charts@7.0.0-alpha.
|
|
215
|
+
### Charts / `@mui/x-charts@7.0.0-alpha.5`
|
|
77
216
|
|
|
78
217
|
- [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
|
|
79
218
|
- [charts] Improve dataset typing (#11372) @alexfauquette
|
|
@@ -88,6 +227,7 @@ Same changes as in `@mui/x-date-pickers@7.0.0-alpha.6`.
|
|
|
88
227
|
|
|
89
228
|
### Core
|
|
90
229
|
|
|
230
|
+
- [core] Add missing breaking changes to changelog (#11420) @MBilalShafi
|
|
91
231
|
- [core] Cherry pick follow up (#11469) @LukasTy
|
|
92
232
|
- [core] Fix `cherry-pick` action (#11446) @LukasTy
|
|
93
233
|
- [core] Fix security regressions in cherry-pick-next-to-master.yml (#11482) @MBilalShafi
|
|
@@ -1200,6 +1340,48 @@ Here is an example of the renaming for the `<ChartsTooltip />` component.
|
|
|
1200
1340
|
- [core] Update release instructions as per v7 configuration (#10962) @MBilalShafi
|
|
1201
1341
|
- [license] Correctly throw errors (#10924) @oliviertassinari
|
|
1202
1342
|
|
|
1343
|
+
## 6.18.7
|
|
1344
|
+
|
|
1345
|
+
_Jan 5, 2024_
|
|
1346
|
+
|
|
1347
|
+
We'd like to offer a big thanks to the 4 contributors who made this release possible. Here are some highlights ✨:
|
|
1348
|
+
|
|
1349
|
+
- 🌍 Improve Czech (cs-CZ) locale on Data Grid (#11429) @wensiet
|
|
1350
|
+
- 🐞 Bugfixes
|
|
1351
|
+
|
|
1352
|
+
### Data Grid
|
|
1353
|
+
|
|
1354
|
+
#### `@mui/x-data-grid@6.18.7`
|
|
1355
|
+
|
|
1356
|
+
- [DataGrid] Don't evaluate `hasEval` when `disableEval` is set (#11553) @reihwald
|
|
1357
|
+
- [l10n] Update Czech (cs-CZ) locale (#11498) @fdebef
|
|
1358
|
+
|
|
1359
|
+
#### `@mui/x-data-grid-pro@6.18.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1360
|
+
|
|
1361
|
+
Same changes as in `@mui/x-data-grid@6.18.7`.
|
|
1362
|
+
|
|
1363
|
+
#### `@mui/x-data-grid-premium@6.18.7` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
1364
|
+
|
|
1365
|
+
Same changes as in `@mui/x-data-grid-pro@6.18.7`.
|
|
1366
|
+
|
|
1367
|
+
### Date Pickers
|
|
1368
|
+
|
|
1369
|
+
#### `@mui/x-date-pickers@6.18.7`
|
|
1370
|
+
|
|
1371
|
+
- [pickers] Fix views management (@LukasTy) (#11572)
|
|
1372
|
+
|
|
1373
|
+
#### `@mui/x-date-pickers-pro@6.18.7` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
1374
|
+
|
|
1375
|
+
Same changes as in `@mui/x-date-pickers@6.18.7`.
|
|
1376
|
+
|
|
1377
|
+
### Charts / `@mui/x-charts@6.18.7`
|
|
1378
|
+
|
|
1379
|
+
- [charts] Fix `null` in line chart using dataset (@alexfauquette) (#11561)
|
|
1380
|
+
|
|
1381
|
+
### Docs
|
|
1382
|
+
|
|
1383
|
+
- [docs] Clarify Pickers usage with Luxon (#11566) @LukasTy
|
|
1384
|
+
|
|
1203
1385
|
## 6.18.6
|
|
1204
1386
|
|
|
1205
1387
|
_Dec 22, 2023_
|
|
@@ -1234,7 +1416,7 @@ Same changes as in `@mui/x-data-grid-pro@6.18.6`.
|
|
|
1234
1416
|
|
|
1235
1417
|
Same changes as in `@mui/x-date-pickers@6.18.6`.
|
|
1236
1418
|
|
|
1237
|
-
### Charts / `@mui/x-charts@6.18.
|
|
1419
|
+
### Charts / `@mui/x-charts@6.18.4`
|
|
1238
1420
|
|
|
1239
1421
|
- [charts] Allow percentage values for pie chart center and radius (#11464) @alexfauquette
|
|
1240
1422
|
- [charts] Make error message more explicit (#11457) @alexfauquette
|
package/LineChart/formatter.js
CHANGED
|
@@ -61,7 +61,7 @@ const formatter = (params, dataset) => {
|
|
|
61
61
|
warnedOnce = true;
|
|
62
62
|
console.error([`MUI-X charts: your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return null;
|
|
65
65
|
}
|
|
66
66
|
return value;
|
|
67
67
|
}) : series[id].data,
|
|
@@ -23,6 +23,7 @@ export type PieArcLabelProps = PieArcLabelOwnerState & React.ComponentPropsWitho
|
|
|
23
23
|
endAngle: SpringValue<number>;
|
|
24
24
|
innerRadius: SpringValue<number>;
|
|
25
25
|
outerRadius: SpringValue<number>;
|
|
26
|
+
arcLabelRadius: SpringValue<number>;
|
|
26
27
|
cornerRadius: SpringValue<number>;
|
|
27
28
|
paddingAngle: SpringValue<number>;
|
|
28
29
|
} & {
|
package/PieChart/PieArcLabel.js
CHANGED
|
@@ -18,7 +18,7 @@ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateU
|
|
|
18
18
|
var _styles = require("@mui/material/styles");
|
|
19
19
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "
|
|
21
|
+
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
22
22
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
23
23
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
24
24
|
function getPieArcLabelUtilityClass(slot) {
|
|
@@ -52,7 +52,7 @@ const PieArcLabelRoot = (0, _styles.styled)(_web.animated.text, {
|
|
|
52
52
|
* Helper to compute label position.
|
|
53
53
|
* It's not an inline function because we need it in inerpolation.
|
|
54
54
|
*/
|
|
55
|
-
const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle,
|
|
55
|
+
const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle, arcLabelRadius, cornerRadius) => {
|
|
56
56
|
if (!formattedArcLabel) {
|
|
57
57
|
return 0;
|
|
58
58
|
}
|
|
@@ -60,8 +60,8 @@ const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle,
|
|
|
60
60
|
padAngle,
|
|
61
61
|
startAngle,
|
|
62
62
|
endAngle,
|
|
63
|
-
innerRadius,
|
|
64
|
-
outerRadius
|
|
63
|
+
innerRadius: arcLabelRadius,
|
|
64
|
+
outerRadius: arcLabelRadius
|
|
65
65
|
});
|
|
66
66
|
if (variable === 'x') {
|
|
67
67
|
return x;
|
|
@@ -76,8 +76,7 @@ function PieArcLabel(props) {
|
|
|
76
76
|
startAngle,
|
|
77
77
|
endAngle,
|
|
78
78
|
paddingAngle,
|
|
79
|
-
|
|
80
|
-
outerRadius,
|
|
79
|
+
arcLabelRadius,
|
|
81
80
|
cornerRadius,
|
|
82
81
|
formattedArcLabel,
|
|
83
82
|
isHighlighted,
|
|
@@ -97,8 +96,8 @@ function PieArcLabel(props) {
|
|
|
97
96
|
className: classes.root
|
|
98
97
|
}, other, {
|
|
99
98
|
style: (0, _extends2.default)({
|
|
100
|
-
x: (0, _web.to)([startAngle, endAngle, paddingAngle,
|
|
101
|
-
y: (0, _web.to)([startAngle, endAngle, paddingAngle,
|
|
99
|
+
x: (0, _web.to)([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
|
|
100
|
+
y: (0, _web.to)([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
|
|
102
101
|
}, style),
|
|
103
102
|
children: formattedArcLabel
|
|
104
103
|
}));
|
|
@@ -14,8 +14,8 @@ var _transition = require("./dataTransform/transition");
|
|
|
14
14
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
15
15
|
var _PieArcLabel = require("./PieArcLabel");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
18
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
17
|
+
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
18
|
+
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
21
|
const RATIO = 180 / Math.PI;
|
|
@@ -36,8 +36,9 @@ function PieArcLabelPlot(props) {
|
|
|
36
36
|
const {
|
|
37
37
|
slots,
|
|
38
38
|
slotProps,
|
|
39
|
-
innerRadius
|
|
39
|
+
innerRadius,
|
|
40
40
|
outerRadius,
|
|
41
|
+
arcLabelRadius,
|
|
41
42
|
cornerRadius = 0,
|
|
42
43
|
paddingAngle = 0,
|
|
43
44
|
id,
|
|
@@ -55,6 +56,7 @@ function PieArcLabelPlot(props) {
|
|
|
55
56
|
const transformedData = (0, _useTransformData.useTransformData)({
|
|
56
57
|
innerRadius,
|
|
57
58
|
outerRadius,
|
|
59
|
+
arcLabelRadius,
|
|
58
60
|
cornerRadius,
|
|
59
61
|
paddingAngle,
|
|
60
62
|
id,
|
|
@@ -78,6 +80,7 @@ function PieArcLabelPlot(props) {
|
|
|
78
80
|
paddingAngle: pA,
|
|
79
81
|
innerRadius: iR,
|
|
80
82
|
outerRadius: oR,
|
|
83
|
+
arcLabelRadius: aLR,
|
|
81
84
|
cornerRadius: cR
|
|
82
85
|
} = _ref,
|
|
83
86
|
style = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
|
|
@@ -87,6 +90,7 @@ function PieArcLabelPlot(props) {
|
|
|
87
90
|
paddingAngle: pA,
|
|
88
91
|
innerRadius: iR,
|
|
89
92
|
outerRadius: oR,
|
|
93
|
+
arcLabelRadius: aLR,
|
|
90
94
|
cornerRadius: cR,
|
|
91
95
|
style: style,
|
|
92
96
|
id: id,
|
|
@@ -111,6 +115,11 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
111
115
|
* The minimal angle required to display the arc label.
|
|
112
116
|
*/
|
|
113
117
|
arcLabelMinAngle: _propTypes.default.number,
|
|
118
|
+
/**
|
|
119
|
+
* The radius between circle center and the arc label in px.
|
|
120
|
+
* @default (innerRadius - outerRadius) / 2
|
|
121
|
+
*/
|
|
122
|
+
arcLabelRadius: _propTypes.default.number,
|
|
114
123
|
/**
|
|
115
124
|
* The radius applied to arc corners (similar to border radius).
|
|
116
125
|
* @default 0
|
|
@@ -132,6 +141,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
132
141
|
*/
|
|
133
142
|
faded: _propTypes.default.shape({
|
|
134
143
|
additionalRadius: _propTypes.default.number,
|
|
144
|
+
arcLabelRadius: _propTypes.default.number,
|
|
135
145
|
color: _propTypes.default.string,
|
|
136
146
|
cornerRadius: _propTypes.default.number,
|
|
137
147
|
innerRadius: _propTypes.default.number,
|
|
@@ -143,6 +153,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
143
153
|
*/
|
|
144
154
|
highlighted: _propTypes.default.shape({
|
|
145
155
|
additionalRadius: _propTypes.default.number,
|
|
156
|
+
arcLabelRadius: _propTypes.default.number,
|
|
146
157
|
color: _propTypes.default.string,
|
|
147
158
|
cornerRadius: _propTypes.default.number,
|
|
148
159
|
innerRadius: _propTypes.default.number,
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -15,7 +15,7 @@ var _transition = require("./dataTransform/transition");
|
|
|
15
15
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onClick", "skipAnimation"],
|
|
18
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
18
|
+
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
21
|
function PieArcPlot(props) {
|
|
@@ -96,6 +96,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
96
96
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
97
97
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
98
98
|
// ----------------------------------------------------------------------
|
|
99
|
+
/**
|
|
100
|
+
* The radius between circle center and the arc label in px.
|
|
101
|
+
* @default (innerRadius - outerRadius) / 2
|
|
102
|
+
*/
|
|
103
|
+
arcLabelRadius: _propTypes.default.number,
|
|
99
104
|
/**
|
|
100
105
|
* The radius applied to arc corners (similar to border radius).
|
|
101
106
|
* @default 0
|
|
@@ -117,6 +122,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
117
122
|
*/
|
|
118
123
|
faded: _propTypes.default.shape({
|
|
119
124
|
additionalRadius: _propTypes.default.number,
|
|
125
|
+
arcLabelRadius: _propTypes.default.number,
|
|
120
126
|
color: _propTypes.default.string,
|
|
121
127
|
cornerRadius: _propTypes.default.number,
|
|
122
128
|
innerRadius: _propTypes.default.number,
|
|
@@ -128,6 +134,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
128
134
|
*/
|
|
129
135
|
highlighted: _propTypes.default.shape({
|
|
130
136
|
additionalRadius: _propTypes.default.number,
|
|
137
|
+
arcLabelRadius: _propTypes.default.number,
|
|
131
138
|
color: _propTypes.default.string,
|
|
132
139
|
cornerRadius: _propTypes.default.number,
|
|
133
140
|
innerRadius: _propTypes.default.number,
|
package/PieChart/PieChart.js
CHANGED
|
@@ -246,6 +246,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
246
246
|
series: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
247
247
|
arcLabel: _propTypes.default.oneOfType([_propTypes.default.oneOf(['formattedValue', 'label', 'value']), _propTypes.default.func]),
|
|
248
248
|
arcLabelMinAngle: _propTypes.default.number,
|
|
249
|
+
arcLabelRadius: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
249
250
|
color: _propTypes.default.string,
|
|
250
251
|
cornerRadius: _propTypes.default.number,
|
|
251
252
|
cx: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -259,6 +260,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
259
260
|
endAngle: _propTypes.default.number,
|
|
260
261
|
faded: _propTypes.default.shape({
|
|
261
262
|
additionalRadius: _propTypes.default.number,
|
|
263
|
+
arcLabelRadius: _propTypes.default.number,
|
|
262
264
|
color: _propTypes.default.string,
|
|
263
265
|
cornerRadius: _propTypes.default.number,
|
|
264
266
|
innerRadius: _propTypes.default.number,
|
|
@@ -267,6 +269,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
267
269
|
}),
|
|
268
270
|
highlighted: _propTypes.default.shape({
|
|
269
271
|
additionalRadius: _propTypes.default.number,
|
|
272
|
+
arcLabelRadius: _propTypes.default.number,
|
|
270
273
|
color: _propTypes.default.string,
|
|
271
274
|
cornerRadius: _propTypes.default.number,
|
|
272
275
|
innerRadius: _propTypes.default.number,
|
package/PieChart/PiePlot.js
CHANGED
|
@@ -87,6 +87,7 @@ function PiePlot(props) {
|
|
|
87
87
|
const {
|
|
88
88
|
innerRadius: innerRadiusParam,
|
|
89
89
|
outerRadius: outerRadiusParam,
|
|
90
|
+
arcLabelRadius: arcLabelRadiusParam,
|
|
90
91
|
cornerRadius,
|
|
91
92
|
paddingAngle,
|
|
92
93
|
arcLabel,
|
|
@@ -98,6 +99,7 @@ function PiePlot(props) {
|
|
|
98
99
|
} = series[seriesId];
|
|
99
100
|
const outerRadius = (0, _utils.getPercentageValue)(outerRadiusParam ?? availableRadius, availableRadius);
|
|
100
101
|
const innerRadius = (0, _utils.getPercentageValue)(innerRadiusParam ?? 0, availableRadius);
|
|
102
|
+
const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : (0, _utils.getPercentageValue)(arcLabelRadiusParam, availableRadius);
|
|
101
103
|
const cx = (0, _utils.getPercentageValue)(cxParam ?? '50%', width);
|
|
102
104
|
const cy = (0, _utils.getPercentageValue)(cyParam ?? '50%', height);
|
|
103
105
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
@@ -105,6 +107,7 @@ function PiePlot(props) {
|
|
|
105
107
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PieArcLabelPlot.PieArcLabelPlot, {
|
|
106
108
|
innerRadius: innerRadius,
|
|
107
109
|
outerRadius: outerRadius ?? availableRadius,
|
|
110
|
+
arcLabelRadius: arcLabelRadius,
|
|
108
111
|
cornerRadius: cornerRadius,
|
|
109
112
|
paddingAngle: paddingAngle,
|
|
110
113
|
id: seriesId,
|
|
@@ -76,6 +76,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
76
76
|
from: ({
|
|
77
77
|
innerRadius,
|
|
78
78
|
outerRadius,
|
|
79
|
+
arcLabelRadius,
|
|
79
80
|
cornerRadius,
|
|
80
81
|
startAngle,
|
|
81
82
|
endAngle,
|
|
@@ -84,6 +85,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
84
85
|
innerRadius,
|
|
85
86
|
outerRadius: (innerRadius + outerRadius) / 2,
|
|
86
87
|
cornerRadius,
|
|
88
|
+
arcLabelRadius,
|
|
87
89
|
startAngle: (startAngle + endAngle) / 2,
|
|
88
90
|
endAngle: (startAngle + endAngle) / 2,
|
|
89
91
|
paddingAngle,
|
|
@@ -96,6 +98,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
96
98
|
}) => ({
|
|
97
99
|
innerRadius,
|
|
98
100
|
outerRadius: innerRadius,
|
|
101
|
+
arcLabelRadius: innerRadius,
|
|
99
102
|
startAngle: (startAngle + endAngle) / 2,
|
|
100
103
|
endAngle: (startAngle + endAngle) / 2,
|
|
101
104
|
opacity: 0
|
|
@@ -104,12 +107,14 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
104
107
|
innerRadius,
|
|
105
108
|
outerRadius,
|
|
106
109
|
startAngle,
|
|
107
|
-
endAngle
|
|
110
|
+
endAngle,
|
|
111
|
+
arcLabelRadius
|
|
108
112
|
}) => ({
|
|
109
113
|
innerRadius,
|
|
110
114
|
outerRadius,
|
|
111
115
|
startAngle,
|
|
112
116
|
endAngle,
|
|
117
|
+
arcLabelRadius,
|
|
113
118
|
opacity: 1
|
|
114
119
|
}),
|
|
115
120
|
update: ({
|
|
@@ -118,7 +123,8 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
118
123
|
cornerRadius,
|
|
119
124
|
startAngle,
|
|
120
125
|
endAngle,
|
|
121
|
-
paddingAngle
|
|
126
|
+
paddingAngle,
|
|
127
|
+
arcLabelRadius
|
|
122
128
|
}) => ({
|
|
123
129
|
innerRadius,
|
|
124
130
|
outerRadius,
|
|
@@ -126,6 +132,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
126
132
|
startAngle,
|
|
127
133
|
endAngle,
|
|
128
134
|
paddingAngle,
|
|
135
|
+
arcLabelRadius,
|
|
129
136
|
opacity: 1
|
|
130
137
|
}),
|
|
131
138
|
config: {
|
|
@@ -20,6 +20,7 @@ function useTransformData(series) {
|
|
|
20
20
|
highlighted,
|
|
21
21
|
paddingAngle: basePaddingAngle = 0,
|
|
22
22
|
innerRadius: baseInnerRadius = 0,
|
|
23
|
+
arcLabelRadius: baseArcLabelRadius,
|
|
23
24
|
outerRadius: baseOuterRadius,
|
|
24
25
|
cornerRadius: baseCornerRadius = 0
|
|
25
26
|
} = series;
|
|
@@ -47,21 +48,23 @@ function useTransformData(series) {
|
|
|
47
48
|
isHighlighted,
|
|
48
49
|
isFaded
|
|
49
50
|
} = getHighlightStatus(itemIndex);
|
|
50
|
-
const
|
|
51
|
+
const attributesOverride = (0, _extends2.default)({
|
|
51
52
|
additionalRadius: 0
|
|
52
53
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
53
|
-
const paddingAngle = Math.max(0, Math.PI * (
|
|
54
|
-
const innerRadius = Math.max(0,
|
|
55
|
-
const outerRadius = Math.max(0,
|
|
56
|
-
const cornerRadius =
|
|
57
|
-
|
|
54
|
+
const paddingAngle = Math.max(0, Math.PI * (attributesOverride.paddingAngle ?? basePaddingAngle) / 180);
|
|
55
|
+
const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
|
|
56
|
+
const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
|
|
57
|
+
const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
|
|
58
|
+
const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
|
|
59
|
+
return (0, _extends2.default)({}, item, attributesOverride, {
|
|
58
60
|
isFaded,
|
|
59
61
|
isHighlighted,
|
|
60
62
|
paddingAngle,
|
|
61
63
|
innerRadius,
|
|
62
64
|
outerRadius,
|
|
63
|
-
cornerRadius
|
|
65
|
+
cornerRadius,
|
|
66
|
+
arcLabelRadius
|
|
64
67
|
});
|
|
65
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, data, faded, getHighlightStatus, highlighted]);
|
|
68
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, getHighlightStatus, highlighted]);
|
|
66
69
|
return dataWithHighlight;
|
|
67
70
|
}
|
|
@@ -58,7 +58,7 @@ const formatter = (params, dataset) => {
|
|
|
58
58
|
warnedOnce = true;
|
|
59
59
|
console.error([`MUI-X charts: your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
|
|
60
60
|
}
|
|
61
|
-
return
|
|
61
|
+
return null;
|
|
62
62
|
}
|
|
63
63
|
return value;
|
|
64
64
|
}) : series[id].data,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "
|
|
3
|
+
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { animated, to } from '@react-spring/web';
|
|
@@ -41,7 +41,7 @@ const PieArcLabelRoot = styled(animated.text, {
|
|
|
41
41
|
* Helper to compute label position.
|
|
42
42
|
* It's not an inline function because we need it in inerpolation.
|
|
43
43
|
*/
|
|
44
|
-
const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle,
|
|
44
|
+
const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle, arcLabelRadius, cornerRadius) => {
|
|
45
45
|
if (!formattedArcLabel) {
|
|
46
46
|
return 0;
|
|
47
47
|
}
|
|
@@ -49,8 +49,8 @@ const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle,
|
|
|
49
49
|
padAngle,
|
|
50
50
|
startAngle,
|
|
51
51
|
endAngle,
|
|
52
|
-
innerRadius,
|
|
53
|
-
outerRadius
|
|
52
|
+
innerRadius: arcLabelRadius,
|
|
53
|
+
outerRadius: arcLabelRadius
|
|
54
54
|
});
|
|
55
55
|
if (variable === 'x') {
|
|
56
56
|
return x;
|
|
@@ -65,8 +65,7 @@ function PieArcLabel(props) {
|
|
|
65
65
|
startAngle,
|
|
66
66
|
endAngle,
|
|
67
67
|
paddingAngle,
|
|
68
|
-
|
|
69
|
-
outerRadius,
|
|
68
|
+
arcLabelRadius,
|
|
70
69
|
cornerRadius,
|
|
71
70
|
formattedArcLabel,
|
|
72
71
|
isHighlighted,
|
|
@@ -86,8 +85,8 @@ function PieArcLabel(props) {
|
|
|
86
85
|
className: classes.root
|
|
87
86
|
}, other, {
|
|
88
87
|
style: _extends({
|
|
89
|
-
x: to([startAngle, endAngle, paddingAngle,
|
|
90
|
-
y: to([startAngle, endAngle, paddingAngle,
|
|
88
|
+
x: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
|
|
89
|
+
y: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
|
|
91
90
|
}, style),
|
|
92
91
|
children: formattedArcLabel
|
|
93
92
|
}));
|