@mui/x-charts 7.0.0-alpha.7 → 7.0.0-alpha.9

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 (154) hide show
  1. package/BarChart/BarChart.js +1 -0
  2. package/BarChart/BarElement.d.ts +37 -20
  3. package/BarChart/BarPlot.js +4 -4
  4. package/BarChart/formatter.js +2 -2
  5. package/CHANGELOG.md +554 -51
  6. package/ChartsAxis/ChartsAxis.js +4 -4
  7. package/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
  8. package/ChartsSurface.d.ts +2 -2
  9. package/ChartsSurface.js +33 -1
  10. package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
  11. package/ChartsTooltip/ChartsTooltipTable.js +2 -0
  12. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -4
  13. package/LineChart/AreaPlot.js +2 -2
  14. package/LineChart/LineChart.d.ts +1 -0
  15. package/LineChart/LineChart.js +2 -0
  16. package/LineChart/LineHighlightPlot.js +1 -1
  17. package/LineChart/LinePlot.js +2 -2
  18. package/LineChart/MarkPlot.js +1 -1
  19. package/LineChart/formatter.js +7 -3
  20. package/PieChart/PieArcLabel.js +1 -1
  21. package/PieChart/PieArcLabelPlot.d.ts +5 -0
  22. package/PieChart/PieArcLabelPlot.js +2 -0
  23. package/PieChart/PieArcPlot.d.ts +5 -0
  24. package/PieChart/PieArcPlot.js +1 -0
  25. package/PieChart/PieChart.d.ts +14 -2
  26. package/PieChart/PieChart.js +3 -2
  27. package/README.md +1 -1
  28. package/ResponsiveChartContainer/index.js +2 -2
  29. package/ScatterChart/ScatterChart.js +1 -0
  30. package/SparkLineChart/SparkLineChart.d.ts +16 -2
  31. package/SparkLineChart/SparkLineChart.js +9 -2
  32. package/context/CartesianContextProvider.d.ts +1 -1
  33. package/context/CartesianContextProvider.js +9 -8
  34. package/context/DrawingProvider.d.ts +1 -1
  35. package/context/DrawingProvider.js +8 -7
  36. package/context/HighlightProvider.d.ts +2 -2
  37. package/context/HighlightProvider.js +4 -3
  38. package/context/InteractionProvider.d.ts +2 -2
  39. package/context/InteractionProvider.js +4 -3
  40. package/context/SeriesContextProvider.d.ts +3 -1
  41. package/context/SeriesContextProvider.js +8 -7
  42. package/esm/BarChart/BarChart.js +1 -0
  43. package/esm/BarChart/BarPlot.js +4 -4
  44. package/esm/BarChart/formatter.js +2 -2
  45. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  46. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
  47. package/esm/ChartsSurface.js +35 -2
  48. package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
  49. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +3 -4
  50. package/esm/LineChart/AreaPlot.js +2 -2
  51. package/esm/LineChart/LineChart.js +2 -0
  52. package/esm/LineChart/LineHighlightPlot.js +1 -1
  53. package/esm/LineChart/LinePlot.js +2 -2
  54. package/esm/LineChart/MarkPlot.js +1 -1
  55. package/esm/LineChart/formatter.js +7 -3
  56. package/esm/PieChart/PieArcLabel.js +1 -1
  57. package/esm/PieChart/PieArcLabelPlot.js +2 -0
  58. package/esm/PieChart/PieArcPlot.js +1 -0
  59. package/esm/PieChart/PieChart.js +3 -2
  60. package/esm/ResponsiveChartContainer/index.js +2 -2
  61. package/esm/ScatterChart/ScatterChart.js +1 -0
  62. package/esm/SparkLineChart/SparkLineChart.js +9 -2
  63. package/esm/context/CartesianContextProvider.js +9 -8
  64. package/esm/context/DrawingProvider.js +8 -7
  65. package/esm/context/HighlightProvider.js +6 -4
  66. package/esm/context/InteractionProvider.js +6 -4
  67. package/esm/context/SeriesContextProvider.js +10 -8
  68. package/esm/hooks/useAxisEvents.js +1 -3
  69. package/esm/index.js +1 -0
  70. package/esm/internals/domUtils.js +3 -1
  71. package/esm/internals/stackSeries.js +5 -3
  72. package/esm/models/index.js +1 -0
  73. package/esm/models/stacking.js +1 -0
  74. package/hooks/useAxisEvents.js +1 -3
  75. package/index.d.ts +1 -0
  76. package/index.js +12 -1
  77. package/internals/defaultizeColor.d.ts +9 -9
  78. package/internals/domUtils.js +3 -1
  79. package/internals/stackSeries.d.ts +8 -3
  80. package/internals/stackSeries.js +4 -3
  81. package/legacy/BarChart/BarChart.js +1 -0
  82. package/legacy/BarChart/BarPlot.js +4 -4
  83. package/legacy/BarChart/formatter.js +2 -2
  84. package/legacy/ChartsAxis/ChartsAxis.js +4 -4
  85. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +7 -5
  86. package/legacy/ChartsSurface.js +35 -2
  87. package/legacy/ChartsTooltip/ChartsTooltipTable.js +2 -0
  88. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +3 -4
  89. package/legacy/LineChart/AreaPlot.js +2 -2
  90. package/legacy/LineChart/LineChart.js +2 -0
  91. package/legacy/LineChart/LineHighlightPlot.js +1 -1
  92. package/legacy/LineChart/LinePlot.js +2 -2
  93. package/legacy/LineChart/MarkPlot.js +1 -1
  94. package/legacy/LineChart/formatter.js +8 -4
  95. package/legacy/PieChart/PieArcLabel.js +3 -1
  96. package/legacy/PieChart/PieArcLabelPlot.js +2 -0
  97. package/legacy/PieChart/PieArcPlot.js +1 -0
  98. package/legacy/PieChart/PieChart.js +3 -2
  99. package/legacy/ResponsiveChartContainer/index.js +2 -2
  100. package/legacy/ScatterChart/ScatterChart.js +1 -0
  101. package/legacy/SparkLineChart/SparkLineChart.js +9 -2
  102. package/legacy/context/CartesianContextProvider.js +17 -17
  103. package/legacy/context/DrawingProvider.js +6 -6
  104. package/legacy/context/HighlightProvider.js +4 -3
  105. package/legacy/context/InteractionProvider.js +4 -3
  106. package/legacy/context/SeriesContextProvider.js +9 -8
  107. package/legacy/hooks/useAxisEvents.js +1 -3
  108. package/legacy/index.js +2 -1
  109. package/legacy/internals/domUtils.js +3 -3
  110. package/legacy/internals/stackSeries.js +5 -3
  111. package/legacy/models/index.js +1 -0
  112. package/legacy/models/stacking.js +1 -0
  113. package/models/index.d.ts +1 -0
  114. package/models/index.js +11 -0
  115. package/models/seriesType/bar.d.ts +8 -2
  116. package/models/seriesType/common.d.ts +3 -4
  117. package/models/seriesType/index.d.ts +0 -1
  118. package/models/seriesType/line.d.ts +7 -1
  119. package/models/seriesType/pie.d.ts +1 -0
  120. package/models/stacking.d.ts +2 -0
  121. package/models/stacking.js +5 -0
  122. package/modern/BarChart/BarChart.js +1 -0
  123. package/modern/BarChart/BarPlot.js +4 -4
  124. package/modern/BarChart/formatter.js +2 -2
  125. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  126. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
  127. package/modern/ChartsSurface.js +35 -2
  128. package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
  129. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +2 -4
  130. package/modern/LineChart/AreaPlot.js +2 -2
  131. package/modern/LineChart/LineChart.js +2 -0
  132. package/modern/LineChart/LineHighlightPlot.js +1 -1
  133. package/modern/LineChart/LinePlot.js +2 -2
  134. package/modern/LineChart/MarkPlot.js +1 -1
  135. package/modern/LineChart/formatter.js +7 -3
  136. package/modern/PieChart/PieArcLabel.js +1 -1
  137. package/modern/PieChart/PieArcLabelPlot.js +2 -0
  138. package/modern/PieChart/PieArcPlot.js +1 -0
  139. package/modern/PieChart/PieChart.js +3 -2
  140. package/modern/ResponsiveChartContainer/index.js +2 -2
  141. package/modern/ScatterChart/ScatterChart.js +1 -0
  142. package/modern/SparkLineChart/SparkLineChart.js +9 -2
  143. package/modern/context/CartesianContextProvider.js +9 -8
  144. package/modern/context/DrawingProvider.js +8 -7
  145. package/modern/context/HighlightProvider.js +6 -4
  146. package/modern/context/InteractionProvider.js +6 -4
  147. package/modern/context/SeriesContextProvider.js +10 -8
  148. package/modern/hooks/useAxisEvents.js +1 -3
  149. package/modern/index.js +2 -1
  150. package/modern/internals/domUtils.js +3 -1
  151. package/modern/internals/stackSeries.js +4 -3
  152. package/modern/models/index.js +1 -0
  153. package/modern/models/stacking.js +1 -0
  154. package/package.json +7 -7
@@ -61,10 +61,10 @@ function LinePlot(props) {
61
61
  const xData = xAxis[xAxisKey].data;
62
62
  if (process.env.NODE_ENV !== 'production') {
63
63
  if (xData === undefined) {
64
- throw new Error(`MUI-X-Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot`);
64
+ throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
65
65
  }
66
66
  if (xData.length < stackedData.length) {
67
- throw new Error(`MUI-X-Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
67
+ throw new Error(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
68
68
  }
69
69
  }
70
70
  const linePath = d3Line().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
@@ -76,7 +76,7 @@ function MarkPlot(props) {
76
76
  return true;
77
77
  };
78
78
  if (xData === undefined) {
79
- throw new Error(`MUI-X-Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot`);
79
+ throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
80
80
  }
81
81
  return xData?.map((x, index) => {
82
82
  const value = data[index] == null ? null : stackedData[index][1];
@@ -10,7 +10,11 @@ const formatter = (params, dataset) => {
10
10
  seriesOrder,
11
11
  series
12
12
  } = params;
13
- const stackingGroups = getStackingGroups(params);
13
+ const stackingGroups = getStackingGroups(_extends({}, params, {
14
+ defaultStrategy: {
15
+ stackOffset: 'none'
16
+ }
17
+ }));
14
18
 
15
19
  // Create a data set with format adapted to d3
16
20
  const d3Dataset = dataset ?? [];
@@ -27,7 +31,7 @@ const formatter = (params, dataset) => {
27
31
  }
28
32
  });
29
33
  } else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
30
- throw new Error([`MUI-X-Charts: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
34
+ throw new Error([`MUI X Charts: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
31
35
  }
32
36
  });
33
37
  const completedSeries = {};
@@ -65,7 +69,7 @@ const formatter = (params, dataset) => {
65
69
  return {
66
70
  seriesOrder,
67
71
  stackingGroups,
68
- series: defaultizeValueFormatter(completedSeries, v => v?.toLocaleString())
72
+ series: defaultizeValueFormatter(completedSeries, v => v === null ? '' : v.toLocaleString())
69
73
  };
70
74
  };
71
75
  export default formatter;
@@ -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", "arcLabelRadius", "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';
@@ -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 xAxisIds[0] The id of the first provided axis
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 yAxisIds[0] The id of the first provided axis
161
+ * @default null
161
162
  */
162
163
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
163
164
  axisId: PropTypes.string,
@@ -60,11 +60,11 @@ const useChartDimensions = (inWidth, inHeight) => {
60
60
  }, [computeSize, inHeight, inWidth]);
61
61
  if (process.env.NODE_ENV !== 'production') {
62
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.`);
63
+ console.error(`MUI X Charts: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
64
64
  displayError.current = false;
65
65
  }
66
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.`);
67
+ console.error(`MUI X Charts: ChartContainer does not have \`height\` prop, and its container has no \`height\` defined.`);
68
68
  displayError.current = false;
69
69
  }
70
70
  }
@@ -118,6 +118,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
118
118
  className: PropTypes.string,
119
119
  /**
120
120
  * Color palette used to colorize multiple series.
121
+ * @default blueberryTwilightPalette
121
122
  */
122
123
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
123
124
  /**
@@ -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;
@@ -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 object Depends on the charts type.
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 | null) => (v === null ? '' : 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
- xAxis: inXAxis,
43
- yAxis: inYAxis,
44
- dataset,
45
- children
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-X-Charts: x-axis uses `dataKey` but no `dataset` is provided.');
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-X-Charts: y-axis uses `dataKey` but no `dataset` is provided.');
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
- width,
28
- height,
29
- margin,
30
- svgRef,
31
- children
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
- export function HighlightProvider({
33
- children
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
- export function InteractionProvider({
54
- children
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-X-Charts: series' id "${id}" is not unique`);
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
- export function SeriesContextProvider({
59
- series,
60
- dataset,
61
- colors = blueberryTwilightPalette,
62
- children
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 };
@@ -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.7
2
+ * @mui/x-charts v7.0.0-alpha.9
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
- const isSsr = () => !(typeof window !== 'undefined' && window.document && window.setTimeout);
5
+ function isSsr() {
6
+ return typeof window === 'undefined';
7
+ }
6
8
  const stringCache = {
7
9
  widthCache: {},
8
10
  cacheCount: 0
@@ -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.7",
3
+ "version": "7.0.0-alpha.9",
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.32",
33
+ "@mui/system": "^5.15.5",
34
+ "@mui/utils": "^5.15.5",
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
  },