@mui/x-charts 7.0.0-alpha.8 → 7.0.0-beta.0

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.
Files changed (103) hide show
  1. package/BarChart/BarChart.js +1 -19
  2. package/BarChart/formatter.js +1 -1
  3. package/CHANGELOG.md +508 -30
  4. package/ChartContainer/ChartContainer.d.ts +12 -0
  5. package/ChartContainer/ChartContainer.js +197 -0
  6. package/ChartContainer/index.d.ts +1 -11
  7. package/ChartContainer/index.js +9 -63
  8. package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  9. package/ChartsTooltip/ChartsItemTooltipContent.js +1 -11
  10. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  11. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +3 -15
  12. package/LineChart/LineChart.js +1 -23
  13. package/LineChart/formatter.js +6 -2
  14. package/PieChart/PieArcLabel.js +1 -1
  15. package/PieChart/PieChart.js +1 -46
  16. package/README.md +3 -3
  17. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +16 -0
  18. package/ResponsiveChartContainer/ResponsiveChartContainer.js +250 -0
  19. package/ResponsiveChartContainer/index.d.ts +1 -15
  20. package/ResponsiveChartContainer/index.js +8 -113
  21. package/ScatterChart/Scatter.js +1 -20
  22. package/ScatterChart/ScatterChart.js +1 -20
  23. package/SparkLineChart/SparkLineChart.d.ts +2 -2
  24. package/SparkLineChart/SparkLineChart.js +2 -2
  25. package/esm/BarChart/BarChart.js +1 -19
  26. package/esm/BarChart/formatter.js +1 -1
  27. package/esm/ChartContainer/ChartContainer.js +189 -0
  28. package/esm/ChartContainer/index.js +1 -61
  29. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  30. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +1 -11
  31. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  32. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +4 -15
  33. package/esm/LineChart/LineChart.js +1 -23
  34. package/esm/LineChart/formatter.js +6 -2
  35. package/esm/PieChart/PieArcLabel.js +1 -1
  36. package/esm/PieChart/PieChart.js +1 -46
  37. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +245 -0
  38. package/esm/ResponsiveChartContainer/index.js +1 -115
  39. package/esm/ScatterChart/Scatter.js +1 -20
  40. package/esm/ScatterChart/ScatterChart.js +1 -20
  41. package/esm/SparkLineChart/SparkLineChart.js +2 -2
  42. package/esm/hooks/useAxisEvents.js +1 -3
  43. package/esm/internals/stackSeries.js +5 -3
  44. package/esm/models/index.js +1 -0
  45. package/esm/models/stacking.js +1 -0
  46. package/hooks/useAxisEvents.js +1 -3
  47. package/index.js +1 -1
  48. package/internals/defaultizeColor.d.ts +9 -9
  49. package/internals/stackSeries.d.ts +8 -3
  50. package/internals/stackSeries.js +4 -3
  51. package/legacy/BarChart/BarChart.js +1 -19
  52. package/legacy/BarChart/formatter.js +1 -1
  53. package/legacy/ChartContainer/ChartContainer.js +187 -0
  54. package/legacy/ChartContainer/index.js +1 -59
  55. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  56. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +1 -11
  57. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  58. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +4 -15
  59. package/legacy/LineChart/LineChart.js +1 -23
  60. package/legacy/LineChart/formatter.js +7 -3
  61. package/legacy/PieChart/PieArcLabel.js +3 -1
  62. package/legacy/PieChart/PieChart.js +1 -46
  63. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +253 -0
  64. package/legacy/ResponsiveChartContainer/index.js +1 -123
  65. package/legacy/ScatterChart/Scatter.js +1 -20
  66. package/legacy/ScatterChart/ScatterChart.js +1 -20
  67. package/legacy/SparkLineChart/SparkLineChart.js +2 -2
  68. package/legacy/hooks/useAxisEvents.js +1 -3
  69. package/legacy/index.js +1 -1
  70. package/legacy/internals/stackSeries.js +5 -3
  71. package/legacy/models/index.js +1 -0
  72. package/legacy/models/stacking.js +1 -0
  73. package/models/index.d.ts +1 -0
  74. package/models/index.js +11 -0
  75. package/models/seriesType/bar.d.ts +8 -2
  76. package/models/seriesType/common.d.ts +3 -4
  77. package/models/seriesType/index.d.ts +0 -1
  78. package/models/seriesType/line.d.ts +7 -1
  79. package/models/stacking.d.ts +2 -0
  80. package/models/stacking.js +5 -0
  81. package/modern/BarChart/BarChart.js +1 -19
  82. package/modern/BarChart/formatter.js +1 -1
  83. package/modern/ChartContainer/ChartContainer.js +189 -0
  84. package/modern/ChartContainer/index.js +1 -61
  85. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  86. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +1 -11
  87. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  88. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +3 -15
  89. package/modern/LineChart/LineChart.js +1 -23
  90. package/modern/LineChart/formatter.js +6 -2
  91. package/modern/PieChart/PieArcLabel.js +1 -1
  92. package/modern/PieChart/PieChart.js +1 -46
  93. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +242 -0
  94. package/modern/ResponsiveChartContainer/index.js +1 -112
  95. package/modern/ScatterChart/Scatter.js +1 -20
  96. package/modern/ScatterChart/ScatterChart.js +1 -20
  97. package/modern/SparkLineChart/SparkLineChart.js +2 -2
  98. package/modern/hooks/useAxisEvents.js +1 -3
  99. package/modern/index.js +1 -1
  100. package/modern/internals/stackSeries.js +4 -3
  101. package/modern/models/index.js +1 -0
  102. package/modern/models/stacking.js +1 -0
  103. package/package.json +7 -7
@@ -0,0 +1,242 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
+ const _excluded = ["width", "height"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
7
+ import ownerWindow from '@mui/utils/ownerWindow';
8
+ import { styled } from '@mui/material/styles';
9
+ import { ChartContainer } from '../ChartContainer';
10
+ import { jsx as _jsx } from "react/jsx-runtime";
11
+ const useChartDimensions = (inWidth, inHeight) => {
12
+ const rootRef = React.useRef(null);
13
+ const displayError = React.useRef(false);
14
+ const [width, setWidth] = React.useState(0);
15
+ const [height, setHeight] = React.useState(0);
16
+
17
+ // Adaptation of the `computeSizeAndPublishResizeEvent` from the grid.
18
+ const computeSize = React.useCallback(() => {
19
+ const mainEl = rootRef?.current;
20
+ if (!mainEl) {
21
+ return;
22
+ }
23
+ const win = ownerWindow(mainEl);
24
+ const computedStyle = win.getComputedStyle(mainEl);
25
+ const newHeight = Math.floor(parseFloat(computedStyle.height)) || 0;
26
+ const newWidth = Math.floor(parseFloat(computedStyle.width)) || 0;
27
+ setWidth(newWidth);
28
+ setHeight(newHeight);
29
+ }, []);
30
+ React.useEffect(() => {
31
+ // Ensure the error detection occurs after the first rendering.
32
+ displayError.current = true;
33
+ }, []);
34
+ useEnhancedEffect(() => {
35
+ if (inWidth !== undefined && inHeight !== undefined) {
36
+ return () => {};
37
+ }
38
+ computeSize();
39
+ const elementToObserve = rootRef.current;
40
+ if (typeof ResizeObserver === 'undefined') {
41
+ return () => {};
42
+ }
43
+ let animationFrame;
44
+ const observer = new ResizeObserver(() => {
45
+ // See https://github.com/mui/mui-x/issues/8733
46
+ animationFrame = requestAnimationFrame(() => {
47
+ computeSize();
48
+ });
49
+ });
50
+ if (elementToObserve) {
51
+ observer.observe(elementToObserve);
52
+ }
53
+ return () => {
54
+ if (animationFrame) {
55
+ window.cancelAnimationFrame(animationFrame);
56
+ }
57
+ if (elementToObserve) {
58
+ observer.unobserve(elementToObserve);
59
+ }
60
+ };
61
+ }, [computeSize, inHeight, inWidth]);
62
+ if (process.env.NODE_ENV !== 'production') {
63
+ if (displayError.current && inWidth === undefined && width === 0) {
64
+ console.error(`MUI X Charts: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
65
+ displayError.current = false;
66
+ }
67
+ if (displayError.current && inHeight === undefined && height === 0) {
68
+ console.error(`MUI X Charts: ChartContainer does not have \`height\` prop, and its container has no \`height\` defined.`);
69
+ displayError.current = false;
70
+ }
71
+ }
72
+ return [rootRef, inWidth ?? width, inHeight ?? height];
73
+ };
74
+ const ResizableContainer = styled('div', {
75
+ name: 'MuiResponsiveChart',
76
+ slot: 'Container'
77
+ })(({
78
+ ownerState
79
+ }) => ({
80
+ width: ownerState.width ?? '100%',
81
+ height: ownerState.height ?? '100%',
82
+ display: 'flex',
83
+ position: 'relative',
84
+ flexGrow: 1,
85
+ flexDirection: 'column',
86
+ alignItems: 'center',
87
+ justifyContent: 'center',
88
+ overflow: 'hidden',
89
+ '&>svg': {
90
+ width: '100%',
91
+ height: '100%'
92
+ }
93
+ }));
94
+ const ResponsiveChartContainer = /*#__PURE__*/React.forwardRef(function ResponsiveChartContainer(props, ref) {
95
+ const {
96
+ width: inWidth,
97
+ height: inHeight
98
+ } = props,
99
+ other = _objectWithoutPropertiesLoose(props, _excluded);
100
+ const [containerRef, width, height] = useChartDimensions(inWidth, inHeight);
101
+ return /*#__PURE__*/_jsx(ResizableContainer, {
102
+ ref: containerRef,
103
+ ownerState: {
104
+ width: inWidth,
105
+ height: inHeight
106
+ },
107
+ children: width && height ? /*#__PURE__*/_jsx(ChartContainer, _extends({}, other, {
108
+ width: width,
109
+ height: height,
110
+ ref: ref
111
+ })) : null
112
+ });
113
+ });
114
+ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
115
+ // ----------------------------- Warning --------------------------------
116
+ // | These PropTypes are generated from the TypeScript type definitions |
117
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
118
+ // ----------------------------------------------------------------------
119
+ children: PropTypes.node,
120
+ className: PropTypes.string,
121
+ /**
122
+ * Color palette used to colorize multiple series.
123
+ * @default blueberryTwilightPalette
124
+ */
125
+ colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
126
+ /**
127
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
128
+ */
129
+ dataset: PropTypes.arrayOf(PropTypes.object),
130
+ desc: PropTypes.string,
131
+ /**
132
+ * If `true`, the charts will not listen to the mouse move event.
133
+ * It might break interactive features, but will improve performance.
134
+ * @default false
135
+ */
136
+ disableAxisListener: PropTypes.bool,
137
+ /**
138
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
139
+ * @default undefined
140
+ */
141
+ height: PropTypes.number,
142
+ /**
143
+ * The margin between the SVG and the drawing area.
144
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
145
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
146
+ * @default object Depends on the charts type.
147
+ */
148
+ margin: PropTypes.shape({
149
+ bottom: PropTypes.number,
150
+ left: PropTypes.number,
151
+ right: PropTypes.number,
152
+ top: PropTypes.number
153
+ }),
154
+ /**
155
+ * The array of series to display.
156
+ * Each type of series has its own specificity.
157
+ * Please refer to the appropriate docs page to learn more about it.
158
+ */
159
+ series: PropTypes.arrayOf(PropTypes.object).isRequired,
160
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
161
+ title: PropTypes.string,
162
+ viewBox: PropTypes.shape({
163
+ height: PropTypes.number,
164
+ width: PropTypes.number,
165
+ x: PropTypes.number,
166
+ y: PropTypes.number
167
+ }),
168
+ /**
169
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
170
+ * @default undefined
171
+ */
172
+ width: PropTypes.number,
173
+ /**
174
+ * The configuration of the x-axes.
175
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
176
+ */
177
+ xAxis: PropTypes.arrayOf(PropTypes.shape({
178
+ axisId: PropTypes.string,
179
+ classes: PropTypes.object,
180
+ data: PropTypes.array,
181
+ dataKey: PropTypes.string,
182
+ disableLine: PropTypes.bool,
183
+ disableTicks: PropTypes.bool,
184
+ fill: PropTypes.string,
185
+ hideTooltip: PropTypes.bool,
186
+ id: PropTypes.string,
187
+ label: PropTypes.string,
188
+ labelFontSize: PropTypes.number,
189
+ labelStyle: PropTypes.object,
190
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
191
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
192
+ position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
193
+ scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
194
+ slotProps: PropTypes.object,
195
+ slots: PropTypes.object,
196
+ stroke: PropTypes.string,
197
+ tickFontSize: PropTypes.number,
198
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
199
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
200
+ tickLabelStyle: PropTypes.object,
201
+ tickMaxStep: PropTypes.number,
202
+ tickMinStep: PropTypes.number,
203
+ tickNumber: PropTypes.number,
204
+ tickSize: PropTypes.number,
205
+ valueFormatter: PropTypes.func
206
+ })),
207
+ /**
208
+ * The configuration of the y-axes.
209
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
210
+ */
211
+ yAxis: PropTypes.arrayOf(PropTypes.shape({
212
+ axisId: PropTypes.string,
213
+ classes: PropTypes.object,
214
+ data: PropTypes.array,
215
+ dataKey: PropTypes.string,
216
+ disableLine: PropTypes.bool,
217
+ disableTicks: PropTypes.bool,
218
+ fill: PropTypes.string,
219
+ hideTooltip: PropTypes.bool,
220
+ id: PropTypes.string,
221
+ label: PropTypes.string,
222
+ labelFontSize: PropTypes.number,
223
+ labelStyle: PropTypes.object,
224
+ max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
225
+ min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
226
+ position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
227
+ scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
228
+ slotProps: PropTypes.object,
229
+ slots: PropTypes.object,
230
+ stroke: PropTypes.string,
231
+ tickFontSize: PropTypes.number,
232
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
233
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
234
+ tickLabelStyle: PropTypes.object,
235
+ tickMaxStep: PropTypes.number,
236
+ tickMinStep: PropTypes.number,
237
+ tickNumber: PropTypes.number,
238
+ tickSize: PropTypes.number,
239
+ valueFormatter: PropTypes.func
240
+ }))
241
+ } : void 0;
242
+ export { ResponsiveChartContainer };
@@ -1,112 +1 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["width", "height"];
4
- import * as React from 'react';
5
- import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
6
- import ownerWindow from '@mui/utils/ownerWindow';
7
- import { styled } from '@mui/material/styles';
8
- import { ChartContainer } from '../ChartContainer';
9
- import { jsx as _jsx } from "react/jsx-runtime";
10
- const useChartDimensions = (inWidth, inHeight) => {
11
- const rootRef = React.useRef(null);
12
- const displayError = React.useRef(false);
13
- const [width, setWidth] = React.useState(0);
14
- const [height, setHeight] = React.useState(0);
15
-
16
- // Adaptation of the `computeSizeAndPublishResizeEvent` from the grid.
17
- const computeSize = React.useCallback(() => {
18
- const mainEl = rootRef?.current;
19
- if (!mainEl) {
20
- return;
21
- }
22
- const win = ownerWindow(mainEl);
23
- const computedStyle = win.getComputedStyle(mainEl);
24
- const newHeight = Math.floor(parseFloat(computedStyle.height)) || 0;
25
- const newWidth = Math.floor(parseFloat(computedStyle.width)) || 0;
26
- setWidth(newWidth);
27
- setHeight(newHeight);
28
- }, []);
29
- React.useEffect(() => {
30
- // Ensure the error detection occurs after the first rendering.
31
- displayError.current = true;
32
- }, []);
33
- useEnhancedEffect(() => {
34
- if (inWidth !== undefined && inHeight !== undefined) {
35
- return () => {};
36
- }
37
- computeSize();
38
- const elementToObserve = rootRef.current;
39
- if (typeof ResizeObserver === 'undefined') {
40
- return () => {};
41
- }
42
- let animationFrame;
43
- const observer = new ResizeObserver(() => {
44
- // See https://github.com/mui/mui-x/issues/8733
45
- animationFrame = requestAnimationFrame(() => {
46
- computeSize();
47
- });
48
- });
49
- if (elementToObserve) {
50
- observer.observe(elementToObserve);
51
- }
52
- return () => {
53
- if (animationFrame) {
54
- window.cancelAnimationFrame(animationFrame);
55
- }
56
- if (elementToObserve) {
57
- observer.unobserve(elementToObserve);
58
- }
59
- };
60
- }, [computeSize, inHeight, inWidth]);
61
- if (process.env.NODE_ENV !== 'production') {
62
- if (displayError.current && inWidth === undefined && width === 0) {
63
- console.error(`MUI X Charts: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
64
- displayError.current = false;
65
- }
66
- if (displayError.current && inHeight === undefined && height === 0) {
67
- console.error(`MUI X Charts: ChartContainer does not have \`height\` prop, and its container has no \`height\` defined.`);
68
- displayError.current = false;
69
- }
70
- }
71
- return [rootRef, inWidth ?? width, inHeight ?? height];
72
- };
73
- const ResizableContainer = styled('div', {
74
- name: 'MuiResponsiveChart',
75
- slot: 'Container'
76
- })(({
77
- ownerState
78
- }) => ({
79
- width: ownerState.width ?? '100%',
80
- height: ownerState.height ?? '100%',
81
- display: 'flex',
82
- position: 'relative',
83
- flexGrow: 1,
84
- flexDirection: 'column',
85
- alignItems: 'center',
86
- justifyContent: 'center',
87
- overflow: 'hidden',
88
- '&>svg': {
89
- width: '100%',
90
- height: '100%'
91
- }
92
- }));
93
- export const ResponsiveChartContainer = /*#__PURE__*/React.forwardRef(function ResponsiveChartContainer(props, ref) {
94
- const {
95
- width: inWidth,
96
- height: inHeight
97
- } = props,
98
- other = _objectWithoutPropertiesLoose(props, _excluded);
99
- const [containerRef, width, height] = useChartDimensions(inWidth, inHeight);
100
- return /*#__PURE__*/_jsx(ResizableContainer, {
101
- ref: containerRef,
102
- ownerState: {
103
- width: inWidth,
104
- height: inHeight
105
- },
106
- children: width && height ? /*#__PURE__*/_jsx(ChartContainer, _extends({}, other, {
107
- width: width,
108
- height: height,
109
- ref: ref
110
- })) : null
111
- });
112
- });
1
+ export * from './ResponsiveChartContainer';
@@ -85,26 +85,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
85
85
  // ----------------------------------------------------------------------
86
86
  color: PropTypes.string.isRequired,
87
87
  markerSize: PropTypes.number.isRequired,
88
- series: PropTypes.shape({
89
- color: PropTypes.string.isRequired,
90
- data: PropTypes.arrayOf(PropTypes.shape({
91
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
92
- x: PropTypes.number.isRequired,
93
- y: PropTypes.number.isRequired
94
- })).isRequired,
95
- disableHover: PropTypes.bool,
96
- highlightScope: PropTypes.shape({
97
- faded: PropTypes.oneOf(['global', 'none', 'series']),
98
- highlighted: PropTypes.oneOf(['item', 'none', 'series'])
99
- }),
100
- id: PropTypes.string.isRequired,
101
- label: PropTypes.string,
102
- markerSize: PropTypes.number,
103
- type: PropTypes.oneOf(['scatter']).isRequired,
104
- valueFormatter: PropTypes.func.isRequired,
105
- xAxisKey: PropTypes.string,
106
- yAxisKey: PropTypes.string
107
- }).isRequired,
88
+ series: PropTypes.object.isRequired,
108
89
  xScale: PropTypes.func.isRequired,
109
90
  yScale: PropTypes.func.isRequired
110
91
  } : void 0;
@@ -222,26 +222,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
222
222
  tickNumber: PropTypes.number,
223
223
  tickSize: PropTypes.number
224
224
  }), PropTypes.string]),
225
- series: PropTypes.arrayOf(PropTypes.shape({
226
- color: PropTypes.string,
227
- data: PropTypes.arrayOf(PropTypes.shape({
228
- id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
229
- x: PropTypes.number.isRequired,
230
- y: PropTypes.number.isRequired
231
- })).isRequired,
232
- disableHover: PropTypes.bool,
233
- highlightScope: PropTypes.shape({
234
- faded: PropTypes.oneOf(['global', 'none', 'series']),
235
- highlighted: PropTypes.oneOf(['item', 'none', 'series'])
236
- }),
237
- id: PropTypes.string,
238
- label: PropTypes.string,
239
- markerSize: PropTypes.number,
240
- type: PropTypes.oneOf(['scatter']),
241
- valueFormatter: PropTypes.func,
242
- xAxisKey: PropTypes.string,
243
- yAxisKey: PropTypes.string
244
- })).isRequired,
225
+ series: PropTypes.arrayOf(PropTypes.object).isRequired,
245
226
  /**
246
227
  * The props used for each component slot.
247
228
  * @default {}
@@ -42,7 +42,7 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
42
42
  slotProps,
43
43
  data,
44
44
  plotType = 'line',
45
- valueFormatter = v => v.toString(),
45
+ valueFormatter = v => v === null ? '' : v.toString(),
46
46
  area,
47
47
  curve = 'linear'
48
48
  } = props;
@@ -205,7 +205,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
205
205
  * Formatter used by the tooltip.
206
206
  * @param {number} value The value to format.
207
207
  * @returns {string} the formatted value.
208
- * @default (v: number) => v.toString()
208
+ * @default (v: number | null) => (v === null ? '' : v.toString())
209
209
  */
210
210
  valueFormatter: PropTypes.func,
211
211
  viewBox: PropTypes.shape({
@@ -61,9 +61,7 @@ export const useAxisEvents = disableAxisListener => {
61
61
  }
62
62
  }
63
63
  if (v <= valueAsNumber) {
64
- if (index === axisData.length - 1 ||
65
- // @ts-ignore
66
- Math.abs(value - v) < Math.abs(value - getAsANumber(axisData[index + 1]))) {
64
+ if (index === axisData.length - 1 || Math.abs(getAsANumber(value) - v) < Math.abs(getAsANumber(value) - getAsANumber(axisData[index + 1]))) {
67
65
  return true;
68
66
  }
69
67
  }
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.0.0-alpha.8
2
+ * @mui/x-charts v7.0.0-beta.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -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);
@@ -1,3 +1,4 @@
1
1
  export * from './seriesType';
2
2
  export * from './layout';
3
+ export * from './stacking';
3
4
  export {};
@@ -0,0 +1 @@
1
+ export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "7.0.0-alpha.8",
3
+ "version": "7.0.0-beta.0",
4
4
  "description": "The community edition of the charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -28,13 +28,13 @@
28
28
  "directory": "packages/x-charts"
29
29
  },
30
30
  "dependencies": {
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",
31
+ "@babel/runtime": "^7.23.8",
32
+ "@mui/base": "^5.0.0-beta.33",
33
+ "@mui/system": "^5.15.6",
34
+ "@mui/utils": "^5.15.6",
35
35
  "@react-spring/rafz": "^9.7.3",
36
36
  "@react-spring/web": "^9.7.3",
37
- "clsx": "^2.0.0",
37
+ "clsx": "^2.1.0",
38
38
  "d3-color": "^3.1.0",
39
39
  "d3-delaunay": "^6.0.4",
40
40
  "d3-scale": "^4.0.2",
@@ -44,7 +44,7 @@
44
44
  "peerDependencies": {
45
45
  "@emotion/react": "^11.9.0",
46
46
  "@emotion/styled": "^11.8.1",
47
- "@mui/material": "^5.4.1",
47
+ "@mui/material": "^5.15.0",
48
48
  "react": "^17.0.0 || ^18.0.0",
49
49
  "react-dom": "^17.0.0 || ^18.0.0"
50
50
  },