@mui/x-charts 7.0.0-alpha.5 → 7.0.0-alpha.8
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/BarChart/BarPlot.js +4 -4
- package/BarChart/formatter.js +1 -1
- package/CHANGELOG.md +357 -49
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/ChartsSurface.d.ts +2 -2
- package/ChartsSurface.js +33 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +2 -0
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +1 -1
- package/LineChart/formatter.js +2 -2
- 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/ResponsiveChartContainer/index.js +2 -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 +9 -8
- 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 +8 -7
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/BarChart/BarPlot.js +4 -4
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/esm/ChartsSurface.js +35 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/LineHighlightPlot.js +1 -1
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +1 -1
- package/esm/LineChart/formatter.js +2 -2
- 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/ResponsiveChartContainer/index.js +2 -2
- package/esm/ScatterChart/ScatterChart.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +8 -1
- package/esm/context/CartesianContextProvider.js +9 -8
- 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 +10 -8
- package/esm/index.js +1 -0
- package/esm/internals/domUtils.js +3 -1
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/defaultizeColor.d.ts +3 -0
- package/internals/domUtils.js +3 -1
- package/legacy/BarChart/BarChart.js +1 -0
- package/legacy/BarChart/BarPlot.js +4 -4
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +7 -5
- package/legacy/ChartsSurface.js +35 -2
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/legacy/LineChart/AreaPlot.js +2 -2
- package/legacy/LineChart/LineChart.js +2 -0
- package/legacy/LineChart/LineHighlightPlot.js +1 -1
- package/legacy/LineChart/LinePlot.js +2 -2
- package/legacy/LineChart/MarkPlot.js +1 -1
- package/legacy/LineChart/formatter.js +2 -2
- package/legacy/PieChart/PieArcLabel.js +7 -8
- 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/ResponsiveChartContainer/index.js +2 -2
- package/legacy/ScatterChart/ScatterChart.js +1 -0
- package/legacy/SparkLineChart/SparkLineChart.js +8 -1
- package/legacy/context/CartesianContextProvider.js +17 -17
- 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 +9 -8
- package/legacy/index.js +2 -1
- package/legacy/internals/domUtils.js +3 -3
- package/models/seriesType/pie.d.ts +15 -0
- package/modern/BarChart/BarChart.js +1 -0
- package/modern/BarChart/BarPlot.js +4 -4
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/modern/ChartsSurface.js +35 -2
- package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +1 -1
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +1 -1
- package/modern/LineChart/formatter.js +2 -2
- 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/ResponsiveChartContainer/index.js +2 -2
- package/modern/ScatterChart/ScatterChart.js +1 -0
- package/modern/SparkLineChart/SparkLineChart.js +8 -1
- package/modern/context/CartesianContextProvider.js +9 -8
- 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 +10 -8
- package/modern/index.js +2 -1
- package/modern/internals/domUtils.js +3 -1
- package/package.json +5 -5
|
@@ -120,6 +120,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
120
120
|
className: PropTypes.string,
|
|
121
121
|
/**
|
|
122
122
|
* Color palette used to colorize multiple series.
|
|
123
|
+
* @default blueberryTwilightPalette
|
|
123
124
|
*/
|
|
124
125
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
125
126
|
/**
|
|
@@ -150,7 +151,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
150
151
|
* The margin between the SVG and the drawing area.
|
|
151
152
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
152
153
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
153
|
-
* @default
|
|
154
|
+
* @default {
|
|
155
|
+
* top: 5,
|
|
156
|
+
* bottom: 5,
|
|
157
|
+
* left: 5,
|
|
158
|
+
* right: 5,
|
|
159
|
+
* }
|
|
154
160
|
*/
|
|
155
161
|
margin: PropTypes.shape({
|
|
156
162
|
bottom: PropTypes.number,
|
|
@@ -199,6 +205,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
199
205
|
* Formatter used by the tooltip.
|
|
200
206
|
* @param {number} value The value to format.
|
|
201
207
|
* @returns {string} the formatted value.
|
|
208
|
+
* @default (v: number) => v.toString()
|
|
202
209
|
*/
|
|
203
210
|
valueFormatter: PropTypes.func,
|
|
204
211
|
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 => {
|
|
@@ -52,7 +53,7 @@ function CartesianContextProvider({
|
|
|
52
53
|
return axisConfig;
|
|
53
54
|
}
|
|
54
55
|
if (dataset === undefined) {
|
|
55
|
-
throw Error('MUI
|
|
56
|
+
throw Error('MUI X Charts: x-axis uses `dataKey` but no `dataset` is provided.');
|
|
56
57
|
}
|
|
57
58
|
return _extends({}, axisConfig, {
|
|
58
59
|
data: dataset.map(d => d[dataKey])
|
|
@@ -64,7 +65,7 @@ function CartesianContextProvider({
|
|
|
64
65
|
return axisConfig;
|
|
65
66
|
}
|
|
66
67
|
if (dataset === undefined) {
|
|
67
|
-
throw Error('MUI
|
|
68
|
+
throw Error('MUI X Charts: y-axis uses `dataKey` but no `dataset` is provided.');
|
|
68
69
|
}
|
|
69
70
|
return _extends({}, axisConfig, {
|
|
70
71
|
data: dataset.map(d => d[dataKey])
|
|
@@ -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 };
|
|
@@ -50,9 +50,10 @@ const dataReducer = (prevState, action) => {
|
|
|
50
50
|
return prevState;
|
|
51
51
|
}
|
|
52
52
|
};
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
53
|
+
function InteractionProvider(props) {
|
|
54
|
+
const {
|
|
55
|
+
children
|
|
56
|
+
} = props;
|
|
56
57
|
const [data, dispatch] = React.useReducer(dataReducer, {
|
|
57
58
|
item: null,
|
|
58
59
|
axis: {
|
|
@@ -68,4 +69,5 @@ export function InteractionProvider({
|
|
|
68
69
|
value: value,
|
|
69
70
|
children: children
|
|
70
71
|
});
|
|
71
|
-
}
|
|
72
|
+
}
|
|
73
|
+
export { InteractionProvider };
|
|
@@ -39,7 +39,7 @@ const formatSeries = (series, colors, dataset) => {
|
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
if (seriesGroups[type]?.series[id] !== undefined) {
|
|
42
|
-
throw new Error(`MUI
|
|
42
|
+
throw new Error(`MUI X Charts: series' id "${id}" is not unique.`);
|
|
43
43
|
}
|
|
44
44
|
seriesGroups[type].series[id] = _extends({
|
|
45
45
|
id
|
|
@@ -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 };
|
package/modern/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v7.0.0-alpha.
|
|
2
|
+
* @mui/x-charts v7.0.0-alpha.8
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -26,4 +26,5 @@ export * from './PieChart';
|
|
|
26
26
|
export * from './ScatterChart';
|
|
27
27
|
export * from './SparkLineChart';
|
|
28
28
|
export * from './ChartContainer';
|
|
29
|
+
export * from './ChartsSurface';
|
|
29
30
|
export * from './ResponsiveChartContainer';
|
|
@@ -2,7 +2,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
// DOM utils taken from
|
|
3
3
|
// https://github.com/recharts/recharts/blob/master/src/util/DOMUtils.ts
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
function isSsr() {
|
|
6
|
+
return typeof window === 'undefined';
|
|
7
|
+
}
|
|
6
8
|
const stringCache = {
|
|
7
9
|
widthCache: {},
|
|
8
10
|
cacheCount: 0
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts",
|
|
3
|
-
"version": "7.0.0-alpha.
|
|
3
|
+
"version": "7.0.0-alpha.8",
|
|
4
4
|
"description": "The community edition of the charts components (MUI X).",
|
|
5
5
|
"author": "MUI Team",
|
|
6
6
|
"main": "./index.js",
|
|
@@ -28,10 +28,10 @@
|
|
|
28
28
|
"directory": "packages/x-charts"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@babel/runtime": "^7.23.
|
|
32
|
-
"@mui/base": "^5.0.0-beta.
|
|
33
|
-
"@mui/system": "^5.15.
|
|
34
|
-
"@mui/utils": "^5.15.
|
|
31
|
+
"@babel/runtime": "^7.23.7",
|
|
32
|
+
"@mui/base": "^5.0.0-beta.29",
|
|
33
|
+
"@mui/system": "^5.15.2",
|
|
34
|
+
"@mui/utils": "^5.15.2",
|
|
35
35
|
"@react-spring/rafz": "^9.7.3",
|
|
36
36
|
"@react-spring/web": "^9.7.3",
|
|
37
37
|
"clsx": "^2.0.0",
|