@mui/x-charts 6.19.1 → 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 +84 -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/PieChart/PieArcLabelPlot.d.ts +5 -0
- package/PieChart/PieArcLabelPlot.js +2 -0
- package/PieChart/PieArcPlot.d.ts +5 -0
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +3 -2
- 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/PieChart/PieArcLabelPlot.js +2 -0
- package/esm/PieChart/PieArcPlot.js +1 -0
- package/esm/PieChart/PieChart.js +3 -2
- 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/hooks/useDrawingArea.d.ts +2 -0
- package/hooks/useDrawingArea.js +7 -3
- package/index.d.ts +2 -0
- package/index.js +23 -1
- 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/PieChart/PieArcLabelPlot.js +2 -0
- package/legacy/PieChart/PieArcPlot.js +1 -0
- package/legacy/PieChart/PieChart.js +3 -2
- 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/models/seriesType/pie.d.ts +1 -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/PieChart/PieArcLabelPlot.js +2 -0
- package/modern/PieChart/PieArcPlot.js +1 -0
- package/modern/PieChart/PieChart.js +3 -2
- 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/package.json +1 -1
|
@@ -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'])
|
|
@@ -117,6 +117,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
117
117
|
* - 'none': display nothing.
|
|
118
118
|
* - 'line': display a line at the current mouse position.
|
|
119
119
|
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
120
|
+
* @default { x: 'line' }
|
|
120
121
|
*/
|
|
121
122
|
axisHighlight: PropTypes.shape({
|
|
122
123
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
@@ -153,6 +154,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
153
154
|
className: PropTypes.string,
|
|
154
155
|
/**
|
|
155
156
|
* Color palette used to colorize multiple series.
|
|
157
|
+
* @default blueberryTwilightPalette
|
|
156
158
|
*/
|
|
157
159
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
158
160
|
/**
|
|
@@ -104,6 +104,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
104
104
|
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
105
105
|
/**
|
|
106
106
|
* The minimal angle required to display the arc label.
|
|
107
|
+
* @default 0
|
|
107
108
|
*/
|
|
108
109
|
arcLabelMinAngle: PropTypes.number,
|
|
109
110
|
/**
|
|
@@ -129,6 +130,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
129
130
|
})).isRequired,
|
|
130
131
|
/**
|
|
131
132
|
* Override the arc attibutes when it is faded.
|
|
133
|
+
* @default { additionalRadius: -5 }
|
|
132
134
|
*/
|
|
133
135
|
faded: PropTypes.shape({
|
|
134
136
|
additionalRadius: PropTypes.number,
|
|
@@ -110,6 +110,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
110
110
|
})).isRequired,
|
|
111
111
|
/**
|
|
112
112
|
* Override the arc attibutes when it is faded.
|
|
113
|
+
* @default { additionalRadius: -5 }
|
|
113
114
|
*/
|
|
114
115
|
faded: PropTypes.shape({
|
|
115
116
|
additionalRadius: PropTypes.number,
|
|
@@ -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,
|
|
@@ -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?.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 };
|
|
@@ -55,16 +55,18 @@ const formatSeries = (series, colors, dataset) => {
|
|
|
55
55
|
});
|
|
56
56
|
return formattedSeries;
|
|
57
57
|
};
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
58
|
+
function SeriesContextProvider(props) {
|
|
59
|
+
const {
|
|
60
|
+
series,
|
|
61
|
+
dataset,
|
|
62
|
+
colors = blueberryTwilightPalette,
|
|
63
|
+
children
|
|
64
|
+
} = props;
|
|
64
65
|
const theme = useTheme();
|
|
65
66
|
const formattedSeries = React.useMemo(() => formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset), [series, colors, theme.palette.mode, dataset]);
|
|
66
67
|
return /*#__PURE__*/_jsx(SeriesContext.Provider, {
|
|
67
68
|
value: formattedSeries,
|
|
68
69
|
children: children
|
|
69
70
|
});
|
|
70
|
-
}
|
|
71
|
+
}
|
|
72
|
+
export { SeriesContextProvider };
|
|
@@ -5,12 +5,16 @@ export function useDrawingArea() {
|
|
|
5
5
|
left,
|
|
6
6
|
top,
|
|
7
7
|
width,
|
|
8
|
-
height
|
|
8
|
+
height,
|
|
9
|
+
bottom,
|
|
10
|
+
right
|
|
9
11
|
} = React.useContext(DrawingContext);
|
|
10
12
|
return React.useMemo(() => ({
|
|
11
13
|
left,
|
|
12
14
|
top,
|
|
13
15
|
width,
|
|
14
|
-
height
|
|
15
|
-
|
|
16
|
+
height,
|
|
17
|
+
bottom,
|
|
18
|
+
right
|
|
19
|
+
}), [height, left, top, width, bottom, right]);
|
|
16
20
|
}
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v6.19.
|
|
2
|
+
* @mui/x-charts v6.19.3
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -24,4 +24,6 @@ export * from './PieChart';
|
|
|
24
24
|
export * from './ScatterChart';
|
|
25
25
|
export * from './SparkLineChart';
|
|
26
26
|
export * from './ChartContainer';
|
|
27
|
+
export * from './ChartsSurface';
|
|
28
|
+
export * from './ChartsLegend';
|
|
27
29
|
export * from './ResponsiveChartContainer';
|