@mui/x-charts 6.18.7 → 6.19.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.js +1 -0
- package/BarChart/BarElement.d.ts +37 -20
- package/CHANGELOG.md +155 -0
- package/ChartsLegend/ChartsLegend.d.ts +5 -2
- package/ChartsLegend/ChartsLegend.js +137 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/ChartsSurface.d.ts +2 -2
- package/ChartsSurface.js +33 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +2 -0
- package/LineChart/formatter.js +5 -1
- package/PieChart/PieArcLabel.d.ts +1 -0
- package/PieChart/PieArcLabel.js +7 -8
- package/PieChart/PieArcLabelPlot.d.ts +5 -0
- package/PieChart/PieArcLabelPlot.js +16 -3
- package/PieChart/PieArcPlot.d.ts +5 -0
- package/PieChart/PieArcPlot.js +9 -1
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +6 -2
- 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/ScatterChart/ScatterChart.js +1 -0
- package/SparkLineChart/SparkLineChart.d.ts +15 -1
- package/SparkLineChart/SparkLineChart.js +8 -1
- package/context/CartesianContextProvider.d.ts +1 -1
- package/context/CartesianContextProvider.js +7 -6
- package/context/DrawingProvider.d.ts +1 -1
- package/context/DrawingProvider.js +8 -7
- package/context/HighlightProvider.d.ts +2 -2
- package/context/HighlightProvider.js +4 -3
- package/context/InteractionProvider.d.ts +2 -2
- package/context/InteractionProvider.js +4 -3
- package/context/SeriesContextProvider.d.ts +3 -1
- package/context/SeriesContextProvider.js +7 -6
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/ChartsLegend/ChartsLegend.js +139 -2
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/esm/ChartsSurface.js +35 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/formatter.js +5 -1
- package/esm/PieChart/PieArcLabel.js +7 -8
- package/esm/PieChart/PieArcLabelPlot.js +16 -3
- package/esm/PieChart/PieArcPlot.js +9 -1
- package/esm/PieChart/PieChart.js +6 -2
- 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/ScatterChart/ScatterChart.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +8 -1
- package/esm/context/CartesianContextProvider.js +7 -6
- package/esm/context/DrawingProvider.js +8 -7
- package/esm/context/HighlightProvider.js +6 -4
- package/esm/context/InteractionProvider.js +6 -4
- package/esm/context/SeriesContextProvider.js +9 -7
- package/esm/hooks/useDrawingArea.js +7 -3
- package/esm/index.js +2 -0
- package/esm/internals/stackSeries.js +5 -3
- package/esm/models/index.js +1 -0
- package/esm/models/stacking.js +1 -0
- package/hooks/useDrawingArea.d.ts +2 -0
- package/hooks/useDrawingArea.js +7 -3
- package/index.d.ts +2 -0
- package/index.js +23 -1
- package/internals/defaultizeColor.d.ts +7 -4
- package/internals/stackSeries.d.ts +8 -3
- package/internals/stackSeries.js +4 -3
- package/legacy/BarChart/BarChart.js +1 -0
- package/legacy/ChartsLegend/ChartsLegend.js +139 -2
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +5 -3
- package/legacy/ChartsReferenceLine/common.js +3 -4
- package/legacy/ChartsSurface.js +35 -2
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +8 -7
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/legacy/LineChart/LineChart.js +2 -0
- package/legacy/LineChart/formatter.js +6 -2
- package/legacy/PieChart/PieArcLabel.js +7 -6
- package/legacy/PieChart/PieArcLabelPlot.js +16 -4
- package/legacy/PieChart/PieArcPlot.js +10 -1
- package/legacy/PieChart/PieChart.js +6 -2
- 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/ScatterChart/ScatterChart.js +1 -0
- package/legacy/SparkLineChart/SparkLineChart.js +8 -1
- package/legacy/context/CartesianContextProvider.js +15 -15
- package/legacy/context/DrawingProvider.js +6 -6
- package/legacy/context/HighlightProvider.js +4 -3
- package/legacy/context/InteractionProvider.js +4 -3
- package/legacy/context/SeriesContextProvider.js +8 -7
- package/legacy/hooks/useDrawingArea.js +7 -3
- package/legacy/index.js +3 -1
- package/legacy/internals/components/AxisSharedComponents.js +5 -6
- 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 +15 -0
- package/models/stacking.d.ts +2 -0
- package/models/stacking.js +5 -0
- package/modern/BarChart/BarChart.js +1 -0
- package/modern/ChartsLegend/ChartsLegend.js +139 -2
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/modern/ChartsSurface.js +35 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/formatter.js +5 -1
- package/modern/PieChart/PieArcLabel.js +7 -8
- package/modern/PieChart/PieArcLabelPlot.js +16 -3
- package/modern/PieChart/PieArcPlot.js +9 -1
- package/modern/PieChart/PieChart.js +6 -2
- 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/ScatterChart/ScatterChart.js +1 -0
- package/modern/SparkLineChart/SparkLineChart.js +8 -1
- package/modern/context/CartesianContextProvider.js +7 -6
- package/modern/context/DrawingProvider.js +8 -7
- package/modern/context/HighlightProvider.js +6 -4
- package/modern/context/InteractionProvider.js +6 -4
- package/modern/context/SeriesContextProvider.js +9 -7
- package/modern/hooks/useDrawingArea.js +7 -3
- package/modern/index.js +3 -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
|
@@ -44,7 +44,21 @@ process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
|
|
|
44
44
|
}),
|
|
45
45
|
series: PropTypes.shape({
|
|
46
46
|
color: PropTypes.string,
|
|
47
|
-
data: PropTypes.arrayOf(PropTypes.number).
|
|
47
|
+
data: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.shape({
|
|
48
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
49
|
+
x: PropTypes.number.isRequired,
|
|
50
|
+
y: PropTypes.number.isRequired
|
|
51
|
+
})), PropTypes.arrayOf(PropTypes.shape({
|
|
52
|
+
color: PropTypes.string.isRequired,
|
|
53
|
+
endAngle: PropTypes.number.isRequired,
|
|
54
|
+
formattedValue: PropTypes.string.isRequired,
|
|
55
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
56
|
+
index: PropTypes.number.isRequired,
|
|
57
|
+
label: PropTypes.string,
|
|
58
|
+
padAngle: PropTypes.number.isRequired,
|
|
59
|
+
startAngle: PropTypes.number.isRequired,
|
|
60
|
+
value: PropTypes.number.isRequired
|
|
61
|
+
}))]).isRequired,
|
|
48
62
|
highlightScope: PropTypes.shape({
|
|
49
63
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
50
64
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
@@ -81,37 +81,7 @@ process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propType
|
|
|
81
81
|
/**
|
|
82
82
|
* The properties of the triggered axis.
|
|
83
83
|
*/
|
|
84
|
-
axis: PropTypes.
|
|
85
|
-
axisId: PropTypes.string,
|
|
86
|
-
classes: PropTypes.object,
|
|
87
|
-
data: PropTypes.array,
|
|
88
|
-
dataKey: PropTypes.string,
|
|
89
|
-
disableLine: PropTypes.bool,
|
|
90
|
-
disableTicks: PropTypes.bool,
|
|
91
|
-
fill: PropTypes.string,
|
|
92
|
-
hideTooltip: PropTypes.bool,
|
|
93
|
-
id: PropTypes.string.isRequired,
|
|
94
|
-
label: PropTypes.string,
|
|
95
|
-
labelFontSize: PropTypes.number,
|
|
96
|
-
labelStyle: PropTypes.object,
|
|
97
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
98
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
99
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
100
|
-
scale: PropTypes.func.isRequired,
|
|
101
|
-
scaleType: PropTypes.oneOf(['time']).isRequired,
|
|
102
|
-
slotProps: PropTypes.object,
|
|
103
|
-
slots: PropTypes.object,
|
|
104
|
-
stroke: PropTypes.string,
|
|
105
|
-
tickFontSize: PropTypes.number,
|
|
106
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
107
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
108
|
-
tickLabelStyle: PropTypes.object,
|
|
109
|
-
tickMaxStep: PropTypes.number,
|
|
110
|
-
tickMinStep: PropTypes.number,
|
|
111
|
-
tickNumber: PropTypes.number.isRequired,
|
|
112
|
-
tickSize: PropTypes.number,
|
|
113
|
-
valueFormatter: PropTypes.func
|
|
114
|
-
}).isRequired,
|
|
84
|
+
axis: PropTypes.object.isRequired,
|
|
115
85
|
/**
|
|
116
86
|
* Data identifying the triggered axis.
|
|
117
87
|
*/
|
|
@@ -140,29 +110,7 @@ process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propType
|
|
|
140
110
|
/**
|
|
141
111
|
* The series linked to the triggered axis.
|
|
142
112
|
*/
|
|
143
|
-
series: PropTypes.arrayOf(PropTypes.
|
|
144
|
-
area: PropTypes.bool,
|
|
145
|
-
color: PropTypes.string.isRequired,
|
|
146
|
-
connectNulls: PropTypes.bool,
|
|
147
|
-
curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
148
|
-
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
149
|
-
dataKey: PropTypes.string,
|
|
150
|
-
disableHighlight: PropTypes.bool,
|
|
151
|
-
highlightScope: PropTypes.shape({
|
|
152
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
153
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
154
|
-
}),
|
|
155
|
-
id: PropTypes.string.isRequired,
|
|
156
|
-
label: PropTypes.string,
|
|
157
|
-
showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
158
|
-
stack: PropTypes.string,
|
|
159
|
-
stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
160
|
-
stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
161
|
-
type: PropTypes.oneOf(['line']).isRequired,
|
|
162
|
-
valueFormatter: PropTypes.func.isRequired,
|
|
163
|
-
xAxisKey: PropTypes.string,
|
|
164
|
-
yAxisKey: PropTypes.string
|
|
165
|
-
})).isRequired,
|
|
113
|
+
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
166
114
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
167
115
|
} : void 0;
|
|
168
116
|
export { DefaultChartsAxisTooltipContent };
|
|
@@ -78,7 +78,21 @@ process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propType
|
|
|
78
78
|
*/
|
|
79
79
|
series: PropTypes.shape({
|
|
80
80
|
color: PropTypes.string,
|
|
81
|
-
data: PropTypes.arrayOf(PropTypes.number).
|
|
81
|
+
data: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.shape({
|
|
82
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
83
|
+
x: PropTypes.number.isRequired,
|
|
84
|
+
y: PropTypes.number.isRequired
|
|
85
|
+
})), PropTypes.arrayOf(PropTypes.shape({
|
|
86
|
+
color: PropTypes.string.isRequired,
|
|
87
|
+
endAngle: PropTypes.number.isRequired,
|
|
88
|
+
formattedValue: PropTypes.string.isRequired,
|
|
89
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
90
|
+
index: PropTypes.number.isRequired,
|
|
91
|
+
label: PropTypes.string,
|
|
92
|
+
padAngle: PropTypes.number.isRequired,
|
|
93
|
+
startAngle: PropTypes.number.isRequired,
|
|
94
|
+
value: PropTypes.number.isRequired
|
|
95
|
+
}))]).isRequired,
|
|
82
96
|
highlightScope: PropTypes.shape({
|
|
83
97
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
84
98
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
@@ -120,6 +120,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
120
120
|
* - 'none': display nothing.
|
|
121
121
|
* - 'line': display a line at the current mouse position.
|
|
122
122
|
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
123
|
+
* @default { x: 'line' }
|
|
123
124
|
*/
|
|
124
125
|
axisHighlight: PropTypes.shape({
|
|
125
126
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
@@ -156,6 +157,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
156
157
|
className: PropTypes.string,
|
|
157
158
|
/**
|
|
158
159
|
* Color palette used to colorize multiple series.
|
|
160
|
+
* @default blueberryTwilightPalette
|
|
159
161
|
*/
|
|
160
162
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
161
163
|
/**
|
|
@@ -11,7 +11,11 @@ const formatter = (params, dataset) => {
|
|
|
11
11
|
seriesOrder,
|
|
12
12
|
series
|
|
13
13
|
} = params;
|
|
14
|
-
const stackingGroups = getStackingGroups(params
|
|
14
|
+
const stackingGroups = getStackingGroups(_extends({}, params, {
|
|
15
|
+
defaultStrategy: {
|
|
16
|
+
stackOffset: 'none'
|
|
17
|
+
}
|
|
18
|
+
}));
|
|
15
19
|
|
|
16
20
|
// Create a data set with format adapted to d3
|
|
17
21
|
const d3Dataset = (_ref = dataset) != null ? _ref : [];
|
|
@@ -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';
|
|
@@ -29,8 +29,9 @@ function PieArcLabelPlot(props) {
|
|
|
29
29
|
const {
|
|
30
30
|
slots,
|
|
31
31
|
slotProps,
|
|
32
|
-
innerRadius
|
|
32
|
+
innerRadius,
|
|
33
33
|
outerRadius,
|
|
34
|
+
arcLabelRadius,
|
|
34
35
|
cornerRadius = 0,
|
|
35
36
|
paddingAngle = 0,
|
|
36
37
|
id,
|
|
@@ -48,6 +49,7 @@ function PieArcLabelPlot(props) {
|
|
|
48
49
|
const transformedData = useTransformData({
|
|
49
50
|
innerRadius,
|
|
50
51
|
outerRadius,
|
|
52
|
+
arcLabelRadius,
|
|
51
53
|
cornerRadius,
|
|
52
54
|
paddingAngle,
|
|
53
55
|
id,
|
|
@@ -71,6 +73,7 @@ function PieArcLabelPlot(props) {
|
|
|
71
73
|
paddingAngle: pA,
|
|
72
74
|
innerRadius: iR,
|
|
73
75
|
outerRadius: oR,
|
|
76
|
+
arcLabelRadius: aLR,
|
|
74
77
|
cornerRadius: cR
|
|
75
78
|
} = _ref,
|
|
76
79
|
style = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
@@ -80,6 +83,7 @@ function PieArcLabelPlot(props) {
|
|
|
80
83
|
paddingAngle: pA,
|
|
81
84
|
innerRadius: iR,
|
|
82
85
|
outerRadius: oR,
|
|
86
|
+
arcLabelRadius: aLR,
|
|
83
87
|
cornerRadius: cR,
|
|
84
88
|
style: style,
|
|
85
89
|
id: id,
|
|
@@ -102,8 +106,14 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
102
106
|
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
103
107
|
/**
|
|
104
108
|
* The minimal angle required to display the arc label.
|
|
109
|
+
* @default 0
|
|
105
110
|
*/
|
|
106
111
|
arcLabelMinAngle: PropTypes.number,
|
|
112
|
+
/**
|
|
113
|
+
* The radius between circle center and the arc label in px.
|
|
114
|
+
* @default (innerRadius - outerRadius) / 2
|
|
115
|
+
*/
|
|
116
|
+
arcLabelRadius: PropTypes.number,
|
|
107
117
|
/**
|
|
108
118
|
* The radius applied to arc corners (similar to border radius).
|
|
109
119
|
* @default 0
|
|
@@ -122,9 +132,11 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
122
132
|
})).isRequired,
|
|
123
133
|
/**
|
|
124
134
|
* Override the arc attibutes when it is faded.
|
|
135
|
+
* @default { additionalRadius: -5 }
|
|
125
136
|
*/
|
|
126
137
|
faded: PropTypes.shape({
|
|
127
138
|
additionalRadius: PropTypes.number,
|
|
139
|
+
arcLabelRadius: PropTypes.number,
|
|
128
140
|
color: PropTypes.string,
|
|
129
141
|
cornerRadius: PropTypes.number,
|
|
130
142
|
innerRadius: PropTypes.number,
|
|
@@ -136,6 +148,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
136
148
|
*/
|
|
137
149
|
highlighted: PropTypes.shape({
|
|
138
150
|
additionalRadius: PropTypes.number,
|
|
151
|
+
arcLabelRadius: PropTypes.number,
|
|
139
152
|
color: PropTypes.string,
|
|
140
153
|
cornerRadius: PropTypes.number,
|
|
141
154
|
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';
|
|
@@ -88,6 +88,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
88
88
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
89
89
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
90
90
|
// ----------------------------------------------------------------------
|
|
91
|
+
/**
|
|
92
|
+
* The radius between circle center and the arc label in px.
|
|
93
|
+
* @default (innerRadius - outerRadius) / 2
|
|
94
|
+
*/
|
|
95
|
+
arcLabelRadius: PropTypes.number,
|
|
91
96
|
/**
|
|
92
97
|
* The radius applied to arc corners (similar to border radius).
|
|
93
98
|
* @default 0
|
|
@@ -106,9 +111,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
106
111
|
})).isRequired,
|
|
107
112
|
/**
|
|
108
113
|
* Override the arc attibutes when it is faded.
|
|
114
|
+
* @default { additionalRadius: -5 }
|
|
109
115
|
*/
|
|
110
116
|
faded: PropTypes.shape({
|
|
111
117
|
additionalRadius: PropTypes.number,
|
|
118
|
+
arcLabelRadius: PropTypes.number,
|
|
112
119
|
color: PropTypes.string,
|
|
113
120
|
cornerRadius: PropTypes.number,
|
|
114
121
|
innerRadius: PropTypes.number,
|
|
@@ -120,6 +127,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
120
127
|
*/
|
|
121
128
|
highlighted: PropTypes.shape({
|
|
122
129
|
additionalRadius: PropTypes.number,
|
|
130
|
+
arcLabelRadius: PropTypes.number,
|
|
123
131
|
color: PropTypes.string,
|
|
124
132
|
cornerRadius: PropTypes.number,
|
|
125
133
|
innerRadius: PropTypes.number,
|
package/esm/PieChart/PieChart.js
CHANGED
|
@@ -108,7 +108,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
108
108
|
/**
|
|
109
109
|
* Indicate which axis to display the bottom of the charts.
|
|
110
110
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
111
|
-
* @default
|
|
111
|
+
* @default null
|
|
112
112
|
*/
|
|
113
113
|
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
114
114
|
axisId: PropTypes.string,
|
|
@@ -136,6 +136,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
136
136
|
className: PropTypes.string,
|
|
137
137
|
/**
|
|
138
138
|
* Color palette used to colorize multiple series.
|
|
139
|
+
* @default blueberryTwilightPalette
|
|
139
140
|
*/
|
|
140
141
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
141
142
|
/**
|
|
@@ -157,7 +158,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
157
158
|
/**
|
|
158
159
|
* Indicate which axis to display the left of the charts.
|
|
159
160
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
160
|
-
* @default
|
|
161
|
+
* @default null
|
|
161
162
|
*/
|
|
162
163
|
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
163
164
|
axisId: PropTypes.string,
|
|
@@ -238,6 +239,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
238
239
|
series: PropTypes.arrayOf(PropTypes.shape({
|
|
239
240
|
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
240
241
|
arcLabelMinAngle: PropTypes.number,
|
|
242
|
+
arcLabelRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
241
243
|
color: PropTypes.string,
|
|
242
244
|
cornerRadius: PropTypes.number,
|
|
243
245
|
cx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -251,6 +253,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
251
253
|
endAngle: PropTypes.number,
|
|
252
254
|
faded: PropTypes.shape({
|
|
253
255
|
additionalRadius: PropTypes.number,
|
|
256
|
+
arcLabelRadius: PropTypes.number,
|
|
254
257
|
color: PropTypes.string,
|
|
255
258
|
cornerRadius: PropTypes.number,
|
|
256
259
|
innerRadius: PropTypes.number,
|
|
@@ -259,6 +262,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
259
262
|
}),
|
|
260
263
|
highlighted: PropTypes.shape({
|
|
261
264
|
additionalRadius: PropTypes.number,
|
|
265
|
+
arcLabelRadius: PropTypes.number,
|
|
262
266
|
color: PropTypes.string,
|
|
263
267
|
cornerRadius: PropTypes.number,
|
|
264
268
|
innerRadius: PropTypes.number,
|
package/esm/PieChart/PiePlot.js
CHANGED
|
@@ -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 != null ? outerRadiusParam : availableRadius, availableRadius);
|
|
92
93
|
const innerRadius = getPercentageValue(innerRadiusParam != null ? innerRadiusParam : 0, availableRadius);
|
|
94
|
+
const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : getPercentageValue(arcLabelRadiusParam, availableRadius);
|
|
93
95
|
const cx = getPercentageValue(cxParam != null ? cxParam : '50%', width);
|
|
94
96
|
const cy = getPercentageValue(cyParam != null ? 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 != null ? 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;
|
|
@@ -34,26 +35,28 @@ export function useTransformData(series) {
|
|
|
34
35
|
};
|
|
35
36
|
}, [highlightScope, highlightedItem, seriesId]);
|
|
36
37
|
const dataWithHighlight = React.useMemo(() => data.map((item, itemIndex) => {
|
|
37
|
-
var
|
|
38
|
+
var _attributesOverride$p, _attributesOverride$i, _attributesOverride$o, _attributesOverride$c, _ref, _attributesOverride$a;
|
|
38
39
|
const {
|
|
39
40
|
isHighlighted,
|
|
40
41
|
isFaded
|
|
41
42
|
} = getHighlightStatus(itemIndex);
|
|
42
|
-
const
|
|
43
|
+
const attributesOverride = _extends({
|
|
43
44
|
additionalRadius: 0
|
|
44
45
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
45
|
-
const paddingAngle = Math.max(0, Math.PI * ((
|
|
46
|
-
const innerRadius = Math.max(0, (
|
|
47
|
-
const outerRadius = Math.max(0, (
|
|
48
|
-
const cornerRadius = (
|
|
49
|
-
|
|
46
|
+
const paddingAngle = Math.max(0, Math.PI * ((_attributesOverride$p = attributesOverride.paddingAngle) != null ? _attributesOverride$p : basePaddingAngle) / 180);
|
|
47
|
+
const innerRadius = Math.max(0, (_attributesOverride$i = attributesOverride.innerRadius) != null ? _attributesOverride$i : baseInnerRadius);
|
|
48
|
+
const outerRadius = Math.max(0, (_attributesOverride$o = attributesOverride.outerRadius) != null ? _attributesOverride$o : baseOuterRadius + attributesOverride.additionalRadius);
|
|
49
|
+
const cornerRadius = (_attributesOverride$c = attributesOverride.cornerRadius) != null ? _attributesOverride$c : baseCornerRadius;
|
|
50
|
+
const arcLabelRadius = (_ref = (_attributesOverride$a = attributesOverride.arcLabelRadius) != null ? _attributesOverride$a : baseArcLabelRadius) != null ? _ref : (innerRadius + outerRadius) / 2;
|
|
51
|
+
return _extends({}, item, attributesOverride, {
|
|
50
52
|
isFaded,
|
|
51
53
|
isHighlighted,
|
|
52
54
|
paddingAngle,
|
|
53
55
|
innerRadius,
|
|
54
56
|
outerRadius,
|
|
55
|
-
cornerRadius
|
|
57
|
+
cornerRadius,
|
|
58
|
+
arcLabelRadius
|
|
56
59
|
});
|
|
57
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, data, faded, getHighlightStatus, highlighted]);
|
|
60
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, getHighlightStatus, highlighted]);
|
|
58
61
|
return dataWithHighlight;
|
|
59
62
|
}
|
|
@@ -113,6 +113,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
113
113
|
className: PropTypes.string,
|
|
114
114
|
/**
|
|
115
115
|
* Color palette used to colorize multiple series.
|
|
116
|
+
* @default blueberryTwilightPalette
|
|
116
117
|
*/
|
|
117
118
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
118
119
|
/**
|
|
@@ -119,6 +119,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
119
119
|
className: PropTypes.string,
|
|
120
120
|
/**
|
|
121
121
|
* Color palette used to colorize multiple series.
|
|
122
|
+
* @default blueberryTwilightPalette
|
|
122
123
|
*/
|
|
123
124
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
124
125
|
/**
|
|
@@ -149,7 +150,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
149
150
|
* The margin between the SVG and the drawing area.
|
|
150
151
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
151
152
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
152
|
-
* @default
|
|
153
|
+
* @default {
|
|
154
|
+
* top: 5,
|
|
155
|
+
* bottom: 5,
|
|
156
|
+
* left: 5,
|
|
157
|
+
* right: 5,
|
|
158
|
+
* }
|
|
153
159
|
*/
|
|
154
160
|
margin: PropTypes.shape({
|
|
155
161
|
bottom: PropTypes.number,
|
|
@@ -198,6 +204,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
198
204
|
* Formatter used by the tooltip.
|
|
199
205
|
* @param {number} value The value to format.
|
|
200
206
|
* @returns {string} the formatted value.
|
|
207
|
+
* @default (v: number) => v.toString()
|
|
201
208
|
*/
|
|
202
209
|
valueFormatter: PropTypes.func,
|
|
203
210
|
viewBox: PropTypes.shape({
|
|
@@ -38,12 +38,13 @@ export const CartesianContext = /*#__PURE__*/React.createContext({
|
|
|
38
38
|
*
|
|
39
39
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
40
40
|
*/
|
|
41
|
-
function CartesianContextProvider({
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
41
|
+
function CartesianContextProvider(props) {
|
|
42
|
+
const {
|
|
43
|
+
xAxis: inXAxis,
|
|
44
|
+
yAxis: inYAxis,
|
|
45
|
+
dataset,
|
|
46
|
+
children
|
|
47
|
+
} = props;
|
|
47
48
|
const formattedSeries = React.useContext(SeriesContext);
|
|
48
49
|
const drawingArea = React.useContext(DrawingContext);
|
|
49
50
|
const xAxis = React.useMemo(() => inXAxis == null ? void 0 : inXAxis.map(axisConfig => {
|
|
@@ -23,13 +23,14 @@ export const SVGContext = /*#__PURE__*/React.createContext({
|
|
|
23
23
|
*
|
|
24
24
|
* - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
|
|
25
25
|
*/
|
|
26
|
-
function DrawingProvider({
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
function DrawingProvider(props) {
|
|
27
|
+
const {
|
|
28
|
+
width,
|
|
29
|
+
height,
|
|
30
|
+
margin,
|
|
31
|
+
svgRef,
|
|
32
|
+
children
|
|
33
|
+
} = props;
|
|
33
34
|
const drawingArea = useChartDimensions(width, height, margin);
|
|
34
35
|
return /*#__PURE__*/_jsx(SVGContext.Provider, {
|
|
35
36
|
value: svgRef,
|
|
@@ -29,9 +29,10 @@ const dataReducer = (prevState, action) => {
|
|
|
29
29
|
return prevState;
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
function HighlightProvider(props) {
|
|
33
|
+
const {
|
|
34
|
+
children
|
|
35
|
+
} = props;
|
|
35
36
|
const [data, dispatch] = React.useReducer(dataReducer, {
|
|
36
37
|
item: null,
|
|
37
38
|
scope: defaultScope
|
|
@@ -43,4 +44,5 @@ export function HighlightProvider({
|
|
|
43
44
|
value: value,
|
|
44
45
|
children: children
|
|
45
46
|
});
|
|
46
|
-
}
|
|
47
|
+
}
|
|
48
|
+
export { HighlightProvider };
|
|
@@ -31,9 +31,10 @@ const dataReducer = (prevState, action) => {
|
|
|
31
31
|
return prevState;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
34
|
+
function InteractionProvider(props) {
|
|
35
|
+
const {
|
|
36
|
+
children
|
|
37
|
+
} = props;
|
|
37
38
|
const [data, dispatch] = React.useReducer(dataReducer, {
|
|
38
39
|
item: null,
|
|
39
40
|
axis: {
|
|
@@ -48,4 +49,5 @@ export function InteractionProvider({
|
|
|
48
49
|
value: value,
|
|
49
50
|
children: children
|
|
50
51
|
});
|
|
51
|
-
}
|
|
52
|
+
}
|
|
53
|
+
export { InteractionProvider };
|
|
@@ -57,16 +57,18 @@ const formatSeries = (series, colors, dataset) => {
|
|
|
57
57
|
});
|
|
58
58
|
return formattedSeries;
|
|
59
59
|
};
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
60
|
+
function SeriesContextProvider(props) {
|
|
61
|
+
const {
|
|
62
|
+
series,
|
|
63
|
+
dataset,
|
|
64
|
+
colors = blueberryTwilightPalette,
|
|
65
|
+
children
|
|
66
|
+
} = props;
|
|
66
67
|
const theme = useTheme();
|
|
67
68
|
const formattedSeries = React.useMemo(() => formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset), [series, colors, theme.palette.mode, dataset]);
|
|
68
69
|
return /*#__PURE__*/_jsx(SeriesContext.Provider, {
|
|
69
70
|
value: formattedSeries,
|
|
70
71
|
children: children
|
|
71
72
|
});
|
|
72
|
-
}
|
|
73
|
+
}
|
|
74
|
+
export { SeriesContextProvider };
|