@mui/x-charts 6.18.7 → 6.19.1
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 +71 -0
- package/LineChart/formatter.js +5 -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 +5 -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/esm/internals/stackSeries.js +5 -3
- package/esm/models/index.js +1 -0
- package/esm/models/stacking.js +1 -0
- package/index.js +1 -1
- package/internals/defaultizeColor.d.ts +7 -4
- package/internals/stackSeries.d.ts +8 -3
- package/internals/stackSeries.js +4 -3
- package/legacy/LineChart/formatter.js +6 -2
- package/legacy/PieChart/PieArcLabel.js +7 -6
- 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/legacy/internals/stackSeries.js +5 -3
- package/legacy/models/index.js +1 -0
- package/legacy/models/stacking.js +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/seriesType/bar.d.ts +6 -0
- package/models/seriesType/common.d.ts +2 -3
- package/models/seriesType/index.d.ts +0 -1
- package/models/seriesType/line.d.ts +6 -0
- package/models/seriesType/pie.d.ts +14 -0
- package/models/stacking.d.ts +2 -0
- package/models/stacking.js +5 -0
- package/modern/LineChart/formatter.js +5 -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/modern/internals/stackSeries.js +4 -3
- package/modern/models/index.js +1 -0
- package/modern/models/stacking.js +1 -0
- package/package.json +1 -1
package/models/index.js
CHANGED
|
@@ -24,4 +24,15 @@ Object.keys(_layout).forEach(function (key) {
|
|
|
24
24
|
return _layout[key];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
});
|
|
28
|
+
var _stacking = require("./stacking");
|
|
29
|
+
Object.keys(_stacking).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _stacking[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _stacking[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
27
38
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DefaultizedProps } from '../helpers';
|
|
2
|
+
import type { StackOffsetType } from '../stacking';
|
|
2
3
|
import { CartesianSeriesType, CommonSeriesType, CommonDefaultizedProps, StackableSeriesType } from './common';
|
|
3
4
|
export interface BarSeriesType extends CommonSeriesType<number>, CartesianSeriesType, StackableSeriesType {
|
|
4
5
|
type: 'bar';
|
|
@@ -16,6 +17,11 @@ export interface BarSeriesType extends CommonSeriesType<number>, CartesianSeries
|
|
|
16
17
|
* @default 'vertical'
|
|
17
18
|
*/
|
|
18
19
|
layout?: 'horizontal' | 'vertical';
|
|
20
|
+
/**
|
|
21
|
+
* Defines how stacked series handle negative values.
|
|
22
|
+
* @default 'diverging'
|
|
23
|
+
*/
|
|
24
|
+
stackOffset?: StackOffsetType;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* An object that allows to identify a single bar.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HighlightScope } from '../../context/HighlightProvider';
|
|
2
|
-
import type {
|
|
2
|
+
import type { StackOffsetType, StackOrderType } from '../stacking';
|
|
3
3
|
export type CommonSeriesType<TValue> = {
|
|
4
4
|
id?: string;
|
|
5
5
|
color?: string;
|
|
@@ -34,9 +34,8 @@ export type StackableSeriesType = {
|
|
|
34
34
|
stackOffset?: StackOffsetType;
|
|
35
35
|
/**
|
|
36
36
|
* The order in which series' of the same group are stacked together.
|
|
37
|
+
* @default 'none'
|
|
37
38
|
*/
|
|
38
39
|
stackOrder?: StackOrderType;
|
|
39
40
|
};
|
|
40
|
-
export type StackOrderType = keyof typeof StackOrder;
|
|
41
|
-
export type StackOffsetType = keyof typeof StackOffset;
|
|
42
41
|
export type DefaultizedCartesianSeriesType = Required<CartesianSeriesType>;
|
|
@@ -13,5 +13,4 @@ export * from './line';
|
|
|
13
13
|
export * from './bar';
|
|
14
14
|
export * from './scatter';
|
|
15
15
|
export * from './pie';
|
|
16
|
-
export type { StackOrderType, StackOffsetType } from './common';
|
|
17
16
|
export type { AllSeriesType, CartesianSeriesType, DefaultizedSeriesType, DefaultizedCartesianSeriesType, StackableSeriesType, };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DefaultizedProps } from '../helpers';
|
|
2
|
+
import type { StackOffsetType } from '../stacking';
|
|
2
3
|
import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType, StackableSeriesType } from './common';
|
|
3
4
|
export type CurveType = 'catmullRom' | 'linear' | 'monotoneX' | 'monotoneY' | 'natural' | 'step' | 'stepBefore' | 'stepAfter';
|
|
4
5
|
export interface ShowMarkParams<AxisValue = number | Date> {
|
|
@@ -53,6 +54,11 @@ export interface LineSeriesType extends CommonSeriesType<number>, CartesianSerie
|
|
|
53
54
|
* @default false
|
|
54
55
|
*/
|
|
55
56
|
connectNulls?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Defines how stacked series handle negative values.
|
|
59
|
+
* @default 'none'
|
|
60
|
+
*/
|
|
61
|
+
stackOffset?: StackOffsetType;
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
58
64
|
* An object that allows to identify a single line.
|
|
@@ -29,6 +29,13 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
29
29
|
* @default '100%'
|
|
30
30
|
*/
|
|
31
31
|
outerRadius?: number | string;
|
|
32
|
+
/**
|
|
33
|
+
* The radius between circle center and the arc label.
|
|
34
|
+
* Can be a number (in px) or a string with a percentage such as '50%'.
|
|
35
|
+
* The '100%' is the maximal radius that fit into the drawing area.
|
|
36
|
+
* @default (innerRadius - outerRadius) / 2
|
|
37
|
+
*/
|
|
38
|
+
arcLabelRadius?: number | string;
|
|
32
39
|
/**
|
|
33
40
|
* The radius applied to arc corners (similar to border radius).
|
|
34
41
|
* @default 0
|
|
@@ -85,6 +92,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
85
92
|
outerRadius?: number;
|
|
86
93
|
cornerRadius?: number;
|
|
87
94
|
paddingAngle?: number;
|
|
95
|
+
arcLabelRadius?: number;
|
|
88
96
|
color?: string;
|
|
89
97
|
};
|
|
90
98
|
/**
|
|
@@ -100,6 +108,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
100
108
|
outerRadius?: number;
|
|
101
109
|
cornerRadius?: number;
|
|
102
110
|
paddingAngle?: number;
|
|
111
|
+
arcLabelRadius?: number;
|
|
103
112
|
color?: string;
|
|
104
113
|
};
|
|
105
114
|
}
|
|
@@ -128,4 +137,9 @@ export interface ComputedPieRadius {
|
|
|
128
137
|
* The radius between circle center and the end of the arc.
|
|
129
138
|
*/
|
|
130
139
|
outerRadius: number;
|
|
140
|
+
/**
|
|
141
|
+
* The radius between circle center and the arc label in px.
|
|
142
|
+
* @default (innerRadius - outerRadius) / 2
|
|
143
|
+
*/
|
|
144
|
+
arcLabelRadius?: number;
|
|
131
145
|
}
|
|
@@ -10,7 +10,11 @@ const formatter = (params, dataset) => {
|
|
|
10
10
|
seriesOrder,
|
|
11
11
|
series
|
|
12
12
|
} = params;
|
|
13
|
-
const stackingGroups = getStackingGroups(params
|
|
13
|
+
const stackingGroups = getStackingGroups(_extends({}, params, {
|
|
14
|
+
defaultStrategy: {
|
|
15
|
+
stackOffset: 'none'
|
|
16
|
+
}
|
|
17
|
+
}));
|
|
14
18
|
|
|
15
19
|
// Create a data set with format adapted to d3
|
|
16
20
|
const d3Dataset = dataset ?? [];
|
|
@@ -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", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
3
|
+
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "innerRadius", "outerRadius", "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
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
4
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
3
|
+
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
4
|
+
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useTransition } from '@react-spring/web';
|
|
@@ -27,8 +27,9 @@ function PieArcLabelPlot(props) {
|
|
|
27
27
|
const {
|
|
28
28
|
slots,
|
|
29
29
|
slotProps,
|
|
30
|
-
innerRadius
|
|
30
|
+
innerRadius,
|
|
31
31
|
outerRadius,
|
|
32
|
+
arcLabelRadius,
|
|
32
33
|
cornerRadius = 0,
|
|
33
34
|
paddingAngle = 0,
|
|
34
35
|
id,
|
|
@@ -46,6 +47,7 @@ function PieArcLabelPlot(props) {
|
|
|
46
47
|
const transformedData = useTransformData({
|
|
47
48
|
innerRadius,
|
|
48
49
|
outerRadius,
|
|
50
|
+
arcLabelRadius,
|
|
49
51
|
cornerRadius,
|
|
50
52
|
paddingAngle,
|
|
51
53
|
id,
|
|
@@ -69,6 +71,7 @@ function PieArcLabelPlot(props) {
|
|
|
69
71
|
paddingAngle: pA,
|
|
70
72
|
innerRadius: iR,
|
|
71
73
|
outerRadius: oR,
|
|
74
|
+
arcLabelRadius: aLR,
|
|
72
75
|
cornerRadius: cR
|
|
73
76
|
} = _ref,
|
|
74
77
|
style = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
@@ -78,6 +81,7 @@ function PieArcLabelPlot(props) {
|
|
|
78
81
|
paddingAngle: pA,
|
|
79
82
|
innerRadius: iR,
|
|
80
83
|
outerRadius: oR,
|
|
84
|
+
arcLabelRadius: aLR,
|
|
81
85
|
cornerRadius: cR,
|
|
82
86
|
style: style,
|
|
83
87
|
id: id,
|
|
@@ -102,6 +106,11 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
102
106
|
* The minimal angle required to display the arc label.
|
|
103
107
|
*/
|
|
104
108
|
arcLabelMinAngle: PropTypes.number,
|
|
109
|
+
/**
|
|
110
|
+
* The radius between circle center and the arc label in px.
|
|
111
|
+
* @default (innerRadius - outerRadius) / 2
|
|
112
|
+
*/
|
|
113
|
+
arcLabelRadius: PropTypes.number,
|
|
105
114
|
/**
|
|
106
115
|
* The radius applied to arc corners (similar to border radius).
|
|
107
116
|
* @default 0
|
|
@@ -123,6 +132,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
123
132
|
*/
|
|
124
133
|
faded: PropTypes.shape({
|
|
125
134
|
additionalRadius: PropTypes.number,
|
|
135
|
+
arcLabelRadius: PropTypes.number,
|
|
126
136
|
color: PropTypes.string,
|
|
127
137
|
cornerRadius: PropTypes.number,
|
|
128
138
|
innerRadius: PropTypes.number,
|
|
@@ -134,6 +144,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
134
144
|
*/
|
|
135
145
|
highlighted: PropTypes.shape({
|
|
136
146
|
additionalRadius: PropTypes.number,
|
|
147
|
+
arcLabelRadius: PropTypes.number,
|
|
137
148
|
color: PropTypes.string,
|
|
138
149
|
cornerRadius: PropTypes.number,
|
|
139
150
|
innerRadius: PropTypes.number,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onClick", "skipAnimation"],
|
|
4
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
4
|
+
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useTransition } from '@react-spring/web';
|
|
@@ -87,6 +87,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
87
87
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
88
88
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
89
89
|
// ----------------------------------------------------------------------
|
|
90
|
+
/**
|
|
91
|
+
* The radius between circle center and the arc label in px.
|
|
92
|
+
* @default (innerRadius - outerRadius) / 2
|
|
93
|
+
*/
|
|
94
|
+
arcLabelRadius: PropTypes.number,
|
|
90
95
|
/**
|
|
91
96
|
* The radius applied to arc corners (similar to border radius).
|
|
92
97
|
* @default 0
|
|
@@ -108,6 +113,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
108
113
|
*/
|
|
109
114
|
faded: PropTypes.shape({
|
|
110
115
|
additionalRadius: PropTypes.number,
|
|
116
|
+
arcLabelRadius: PropTypes.number,
|
|
111
117
|
color: PropTypes.string,
|
|
112
118
|
cornerRadius: PropTypes.number,
|
|
113
119
|
innerRadius: PropTypes.number,
|
|
@@ -119,6 +125,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
119
125
|
*/
|
|
120
126
|
highlighted: PropTypes.shape({
|
|
121
127
|
additionalRadius: PropTypes.number,
|
|
128
|
+
arcLabelRadius: PropTypes.number,
|
|
122
129
|
color: PropTypes.string,
|
|
123
130
|
cornerRadius: PropTypes.number,
|
|
124
131
|
innerRadius: PropTypes.number,
|
|
@@ -238,6 +238,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
238
238
|
series: PropTypes.arrayOf(PropTypes.shape({
|
|
239
239
|
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
240
240
|
arcLabelMinAngle: PropTypes.number,
|
|
241
|
+
arcLabelRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
241
242
|
color: PropTypes.string,
|
|
242
243
|
cornerRadius: PropTypes.number,
|
|
243
244
|
cx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -251,6 +252,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
251
252
|
endAngle: PropTypes.number,
|
|
252
253
|
faded: PropTypes.shape({
|
|
253
254
|
additionalRadius: PropTypes.number,
|
|
255
|
+
arcLabelRadius: PropTypes.number,
|
|
254
256
|
color: PropTypes.string,
|
|
255
257
|
cornerRadius: PropTypes.number,
|
|
256
258
|
innerRadius: PropTypes.number,
|
|
@@ -259,6 +261,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
259
261
|
}),
|
|
260
262
|
highlighted: PropTypes.shape({
|
|
261
263
|
additionalRadius: PropTypes.number,
|
|
264
|
+
arcLabelRadius: PropTypes.number,
|
|
262
265
|
color: PropTypes.string,
|
|
263
266
|
cornerRadius: PropTypes.number,
|
|
264
267
|
innerRadius: PropTypes.number,
|
|
@@ -79,6 +79,7 @@ function PiePlot(props) {
|
|
|
79
79
|
const {
|
|
80
80
|
innerRadius: innerRadiusParam,
|
|
81
81
|
outerRadius: outerRadiusParam,
|
|
82
|
+
arcLabelRadius: arcLabelRadiusParam,
|
|
82
83
|
cornerRadius,
|
|
83
84
|
paddingAngle,
|
|
84
85
|
arcLabel,
|
|
@@ -90,6 +91,7 @@ function PiePlot(props) {
|
|
|
90
91
|
} = series[seriesId];
|
|
91
92
|
const outerRadius = getPercentageValue(outerRadiusParam ?? availableRadius, availableRadius);
|
|
92
93
|
const innerRadius = getPercentageValue(innerRadiusParam ?? 0, availableRadius);
|
|
94
|
+
const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : getPercentageValue(arcLabelRadiusParam, availableRadius);
|
|
93
95
|
const cx = getPercentageValue(cxParam ?? '50%', width);
|
|
94
96
|
const cy = getPercentageValue(cyParam ?? '50%', height);
|
|
95
97
|
return /*#__PURE__*/_jsx("g", {
|
|
@@ -97,6 +99,7 @@ function PiePlot(props) {
|
|
|
97
99
|
children: /*#__PURE__*/_jsx(PieArcLabelPlot, {
|
|
98
100
|
innerRadius: innerRadius,
|
|
99
101
|
outerRadius: outerRadius ?? availableRadius,
|
|
102
|
+
arcLabelRadius: arcLabelRadius,
|
|
100
103
|
cornerRadius: cornerRadius,
|
|
101
104
|
paddingAngle: paddingAngle,
|
|
102
105
|
id: seriesId,
|
|
@@ -70,6 +70,7 @@ export const defaultLabelTransitionConfig = {
|
|
|
70
70
|
from: ({
|
|
71
71
|
innerRadius,
|
|
72
72
|
outerRadius,
|
|
73
|
+
arcLabelRadius,
|
|
73
74
|
cornerRadius,
|
|
74
75
|
startAngle,
|
|
75
76
|
endAngle,
|
|
@@ -78,6 +79,7 @@ export const defaultLabelTransitionConfig = {
|
|
|
78
79
|
innerRadius,
|
|
79
80
|
outerRadius: (innerRadius + outerRadius) / 2,
|
|
80
81
|
cornerRadius,
|
|
82
|
+
arcLabelRadius,
|
|
81
83
|
startAngle: (startAngle + endAngle) / 2,
|
|
82
84
|
endAngle: (startAngle + endAngle) / 2,
|
|
83
85
|
paddingAngle,
|
|
@@ -90,6 +92,7 @@ export const defaultLabelTransitionConfig = {
|
|
|
90
92
|
}) => ({
|
|
91
93
|
innerRadius,
|
|
92
94
|
outerRadius: innerRadius,
|
|
95
|
+
arcLabelRadius: innerRadius,
|
|
93
96
|
startAngle: (startAngle + endAngle) / 2,
|
|
94
97
|
endAngle: (startAngle + endAngle) / 2,
|
|
95
98
|
opacity: 0
|
|
@@ -98,12 +101,14 @@ export const defaultLabelTransitionConfig = {
|
|
|
98
101
|
innerRadius,
|
|
99
102
|
outerRadius,
|
|
100
103
|
startAngle,
|
|
101
|
-
endAngle
|
|
104
|
+
endAngle,
|
|
105
|
+
arcLabelRadius
|
|
102
106
|
}) => ({
|
|
103
107
|
innerRadius,
|
|
104
108
|
outerRadius,
|
|
105
109
|
startAngle,
|
|
106
110
|
endAngle,
|
|
111
|
+
arcLabelRadius,
|
|
107
112
|
opacity: 1
|
|
108
113
|
}),
|
|
109
114
|
update: ({
|
|
@@ -112,7 +117,8 @@ export const defaultLabelTransitionConfig = {
|
|
|
112
117
|
cornerRadius,
|
|
113
118
|
startAngle,
|
|
114
119
|
endAngle,
|
|
115
|
-
paddingAngle
|
|
120
|
+
paddingAngle,
|
|
121
|
+
arcLabelRadius
|
|
116
122
|
}) => ({
|
|
117
123
|
innerRadius,
|
|
118
124
|
outerRadius,
|
|
@@ -120,6 +126,7 @@ export const defaultLabelTransitionConfig = {
|
|
|
120
126
|
startAngle,
|
|
121
127
|
endAngle,
|
|
122
128
|
paddingAngle,
|
|
129
|
+
arcLabelRadius,
|
|
123
130
|
opacity: 1
|
|
124
131
|
}),
|
|
125
132
|
config: {
|
|
@@ -11,6 +11,7 @@ export function useTransformData(series) {
|
|
|
11
11
|
highlighted,
|
|
12
12
|
paddingAngle: basePaddingAngle = 0,
|
|
13
13
|
innerRadius: baseInnerRadius = 0,
|
|
14
|
+
arcLabelRadius: baseArcLabelRadius,
|
|
14
15
|
outerRadius: baseOuterRadius,
|
|
15
16
|
cornerRadius: baseCornerRadius = 0
|
|
16
17
|
} = series;
|
|
@@ -38,21 +39,23 @@ export function useTransformData(series) {
|
|
|
38
39
|
isHighlighted,
|
|
39
40
|
isFaded
|
|
40
41
|
} = getHighlightStatus(itemIndex);
|
|
41
|
-
const
|
|
42
|
+
const attributesOverride = _extends({
|
|
42
43
|
additionalRadius: 0
|
|
43
44
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
44
|
-
const paddingAngle = Math.max(0, Math.PI * (
|
|
45
|
-
const innerRadius = Math.max(0,
|
|
46
|
-
const outerRadius = Math.max(0,
|
|
47
|
-
const cornerRadius =
|
|
48
|
-
|
|
45
|
+
const paddingAngle = Math.max(0, Math.PI * (attributesOverride.paddingAngle ?? basePaddingAngle) / 180);
|
|
46
|
+
const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
|
|
47
|
+
const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
|
|
48
|
+
const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
|
|
49
|
+
const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
|
|
50
|
+
return _extends({}, item, attributesOverride, {
|
|
49
51
|
isFaded,
|
|
50
52
|
isHighlighted,
|
|
51
53
|
paddingAngle,
|
|
52
54
|
innerRadius,
|
|
53
55
|
outerRadius,
|
|
54
|
-
cornerRadius
|
|
56
|
+
cornerRadius,
|
|
57
|
+
arcLabelRadius
|
|
55
58
|
});
|
|
56
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, data, faded, getHighlightStatus, highlighted]);
|
|
59
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, getHighlightStatus, highlighted]);
|
|
57
60
|
return dataWithHighlight;
|
|
58
61
|
}
|
package/modern/index.js
CHANGED
|
@@ -56,7 +56,8 @@ export const StackOffset = {
|
|
|
56
56
|
export const getStackingGroups = params => {
|
|
57
57
|
const {
|
|
58
58
|
series,
|
|
59
|
-
seriesOrder
|
|
59
|
+
seriesOrder,
|
|
60
|
+
defaultStrategy
|
|
60
61
|
} = params;
|
|
61
62
|
const stackingGroups = [];
|
|
62
63
|
const stackIndex = {};
|
|
@@ -76,8 +77,8 @@ export const getStackingGroups = params => {
|
|
|
76
77
|
stackIndex[stack] = stackingGroups.length;
|
|
77
78
|
stackingGroups.push({
|
|
78
79
|
ids: [id],
|
|
79
|
-
stackingOrder: StackOrder[stackOrder ?? 'none'],
|
|
80
|
-
stackingOffset: StackOffset[stackOffset ?? 'diverging']
|
|
80
|
+
stackingOrder: StackOrder[stackOrder ?? defaultStrategy?.stackOrder ?? 'none'],
|
|
81
|
+
stackingOffset: StackOffset[stackOffset ?? defaultStrategy?.stackOffset ?? 'diverging']
|
|
81
82
|
});
|
|
82
83
|
} else {
|
|
83
84
|
stackingGroups[stackIndex[stack]].ids.push(id);
|
package/modern/models/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|