@mui/x-charts 7.12.1 → 7.13.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 (72) hide show
  1. package/BarChart/BarChart.js +2 -0
  2. package/BarChart/extremums.js +5 -3
  3. package/CHANGELOG.md +81 -0
  4. package/ChartContainer/ChartContainer.d.ts +3 -3
  5. package/ChartContainer/ChartContainer.js +4 -2
  6. package/ChartContainer/useChartContainerProps.d.ts +4 -2
  7. package/ChartContainer/useChartContainerProps.js +2 -2
  8. package/ChartContainer/useDefaultizeAxis.d.ts +1 -0
  9. package/ChartsTooltip/utils.js +4 -2
  10. package/ChartsXAxis/ChartsXAxis.js +11 -5
  11. package/ChartsYAxis/ChartsYAxis.js +11 -5
  12. package/LineChart/AreaPlot.js +11 -1
  13. package/LineChart/LineChart.js +2 -0
  14. package/LineChart/extremums.js +4 -15
  15. package/PieChart/PieChart.js +2 -0
  16. package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
  17. package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +1 -1
  18. package/ScatterChart/ScatterChart.js +2 -0
  19. package/ScatterChart/extremums.js +6 -14
  20. package/SparkLineChart/SparkLineChart.js +2 -0
  21. package/context/CartesianProvider/CartesianProvider.d.ts +3 -3
  22. package/context/CartesianProvider/CartesianProvider.js +2 -2
  23. package/context/CartesianProvider/defaultizeAxis.d.ts +1 -0
  24. package/context/CartesianProvider/getAxisExtremum.js +3 -10
  25. package/context/PluginProvider/ExtremumGetter.types.d.ts +1 -1
  26. package/esm/BarChart/BarChart.js +2 -0
  27. package/esm/BarChart/extremums.js +5 -3
  28. package/esm/ChartContainer/ChartContainer.js +5 -3
  29. package/esm/ChartContainer/useChartContainerProps.js +2 -2
  30. package/esm/ChartsTooltip/utils.js +4 -2
  31. package/esm/ChartsXAxis/ChartsXAxis.js +11 -5
  32. package/esm/ChartsYAxis/ChartsYAxis.js +11 -5
  33. package/esm/LineChart/AreaPlot.js +11 -1
  34. package/esm/LineChart/LineChart.js +2 -0
  35. package/esm/LineChart/extremums.js +4 -15
  36. package/esm/PieChart/PieChart.js +2 -0
  37. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
  38. package/esm/ScatterChart/ScatterChart.js +2 -0
  39. package/esm/ScatterChart/extremums.js +6 -14
  40. package/esm/SparkLineChart/SparkLineChart.js +2 -0
  41. package/esm/context/CartesianProvider/CartesianProvider.js +2 -2
  42. package/esm/context/CartesianProvider/getAxisExtremum.js +3 -10
  43. package/esm/hooks/useTicks.js +5 -2
  44. package/esm/internals/isInfinity.js +3 -0
  45. package/hooks/useTicks.js +5 -2
  46. package/index.js +1 -1
  47. package/internals/defaultizeColor.d.ts +1 -0
  48. package/internals/isInfinity.d.ts +1 -0
  49. package/internals/isInfinity.js +9 -0
  50. package/models/axis.d.ts +2 -0
  51. package/models/seriesType/line.d.ts +10 -0
  52. package/modern/BarChart/BarChart.js +2 -0
  53. package/modern/BarChart/extremums.js +5 -3
  54. package/modern/ChartContainer/ChartContainer.js +5 -3
  55. package/modern/ChartContainer/useChartContainerProps.js +2 -2
  56. package/modern/ChartsTooltip/utils.js +4 -2
  57. package/modern/ChartsXAxis/ChartsXAxis.js +11 -5
  58. package/modern/ChartsYAxis/ChartsYAxis.js +11 -5
  59. package/modern/LineChart/AreaPlot.js +11 -1
  60. package/modern/LineChart/LineChart.js +2 -0
  61. package/modern/LineChart/extremums.js +4 -15
  62. package/modern/PieChart/PieChart.js +2 -0
  63. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -0
  64. package/modern/ScatterChart/ScatterChart.js +2 -0
  65. package/modern/ScatterChart/extremums.js +6 -14
  66. package/modern/SparkLineChart/SparkLineChart.js +2 -0
  67. package/modern/context/CartesianProvider/CartesianProvider.js +2 -2
  68. package/modern/context/CartesianProvider/getAxisExtremum.js +3 -10
  69. package/modern/hooks/useTicks.js +5 -2
  70. package/modern/index.js +1 -1
  71. package/modern/internals/isInfinity.js +3 -0
  72. package/package.json +2 -2
@@ -45,7 +45,7 @@ export const useChartContainerProps = (props, ref) => {
45
45
  colors,
46
46
  dataset
47
47
  };
48
- const cartesianContextProps = {
48
+ const cartesianProviderProps = {
49
49
  xAxis: defaultizedXAxis,
50
50
  yAxis: defaultizedYAxis,
51
51
  dataset
@@ -71,7 +71,7 @@ export const useChartContainerProps = (props, ref) => {
71
71
  children,
72
72
  drawingProviderProps,
73
73
  seriesProviderProps,
74
- cartesianContextProps,
74
+ cartesianProviderProps,
75
75
  zAxisContextProps,
76
76
  highlightedProviderProps,
77
77
  chartsSurfaceProps,
@@ -47,8 +47,10 @@ export function useMouseTracker() {
47
47
  if (element === null) {
48
48
  return () => {};
49
49
  }
50
- const handleOut = () => {
51
- setMousePosition(null);
50
+ const handleOut = event => {
51
+ if (event.pointerType !== 'mouse') {
52
+ setMousePosition(null);
53
+ }
52
54
  };
53
55
  const handleMove = event => {
54
56
  setMousePosition({
@@ -15,6 +15,8 @@ import { getMinXTranslation } from '../internals/geometry';
15
15
  import { useMounted } from '../hooks/useMounted';
16
16
  import { useDrawingArea } from '../hooks/useDrawingArea';
17
17
  import { getWordsByLines } from '../internals/getWordsByLines';
18
+ import { isInfinity } from '../internals/isInfinity';
19
+ import { isBandScale } from '../internals/isBandScale';
18
20
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
19
21
  const useUtilityClasses = ownerState => {
20
22
  const {
@@ -137,7 +139,8 @@ function ChartsXAxis(inProps) {
137
139
  tickInterval,
138
140
  tickLabelInterval,
139
141
  tickPlacement,
140
- tickLabelPlacement
142
+ tickLabelPlacement,
143
+ sx
141
144
  } = defaultizedProps;
142
145
  const theme = useTheme();
143
146
  const classes = useUtilityClasses(_extends({}, defaultizedProps, {
@@ -199,15 +202,17 @@ function ChartsXAxis(inProps) {
199
202
  ownerState: {}
200
203
  });
201
204
  const domain = xScale.domain();
202
- if (domain.length === 0 || domain[0] === domain[1]) {
203
- // Skip axis rendering if
204
- // - the data is empty (for band and point axis)
205
- // - No data is associated to the axis (other scale types)
205
+ const ordinalAxis = isBandScale(xScale);
206
+ // Skip axis rendering if no data is available
207
+ // - The domain is an empty array for band/point scales.
208
+ // - The domains contains Infinity for continuous scales.
209
+ if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(isInfinity)) {
206
210
  return null;
207
211
  }
208
212
  return /*#__PURE__*/_jsxs(AxisRoot, {
209
213
  transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
210
214
  className: classes.root,
215
+ sx: sx,
211
216
  children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
212
217
  x1: left,
213
218
  x2: left + width,
@@ -305,6 +310,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
305
310
  * @default 'currentColor'
306
311
  */
307
312
  stroke: PropTypes.string,
313
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
308
314
  /**
309
315
  * The font size of the axis ticks text.
310
316
  * @default 12
@@ -12,6 +12,8 @@ import { useDrawingArea } from '../hooks/useDrawingArea';
12
12
  import { AxisRoot } from '../internals/components/AxisSharedComponents';
13
13
  import { ChartsText } from '../ChartsText';
14
14
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
15
+ import { isInfinity } from '../internals/isInfinity';
16
+ import { isBandScale } from '../internals/isBandScale';
15
17
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
18
  const useUtilityClasses = ownerState => {
17
19
  const {
@@ -78,7 +80,8 @@ function ChartsYAxis(inProps) {
78
80
  tickPlacement,
79
81
  tickLabelPlacement,
80
82
  tickInterval,
81
- tickLabelInterval
83
+ tickLabelInterval,
84
+ sx
82
85
  } = defaultizedProps;
83
86
  const theme = useTheme();
84
87
  const isRTL = theme.direction === 'rtl';
@@ -145,15 +148,17 @@ function ChartsYAxis(inProps) {
145
148
  ownerState: {}
146
149
  });
147
150
  const domain = yScale.domain();
148
- if (domain.length === 0 || domain[0] === domain[1]) {
149
- // Skip axis rendering if
150
- // - the data is empty (for band and point axis)
151
- // - No data is associated to the axis (other scale types)
151
+ const ordinalAxis = isBandScale(yScale);
152
+ // Skip axis rendering if no data is available
153
+ // - The domain is an empty array for band/point scales.
154
+ // - The domains contains Infinity for continuous scales.
155
+ if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(isInfinity)) {
152
156
  return null;
153
157
  }
154
158
  return /*#__PURE__*/_jsxs(AxisRoot, {
155
159
  transform: `translate(${position === 'right' ? left + width : left}, 0)`,
156
160
  className: classes.root,
161
+ sx: sx,
157
162
  children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
158
163
  y1: top,
159
164
  y2: top + height,
@@ -253,6 +258,7 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
253
258
  * @default 'currentColor'
254
259
  */
255
260
  stroke: PropTypes.string,
261
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
256
262
  /**
257
263
  * The font size of the axis ticks text.
258
264
  * @default 12
@@ -42,7 +42,8 @@ const useAggregatedData = () => {
42
42
  yAxisKey = defaultYAxisId,
43
43
  stackedData,
44
44
  data,
45
- connectNulls
45
+ connectNulls,
46
+ baseline
46
47
  } = series[seriesId];
47
48
  const xAxisId = xAxisIdProp ?? xAxisKey;
48
49
  const yAxisId = yAxisIdProp ?? yAxisKey;
@@ -59,6 +60,15 @@ const useAggregatedData = () => {
59
60
  }
60
61
  }
61
62
  const areaPath = d3Area().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
63
+ if (typeof baseline === 'number') {
64
+ return yScale(baseline);
65
+ }
66
+ if (baseline === 'max') {
67
+ return yScale.range()[1];
68
+ }
69
+ if (baseline === 'min') {
70
+ return yScale.range()[0];
71
+ }
62
72
  const value = d.y && yScale(d.y[0]);
63
73
  if (Number.isNaN(value)) {
64
74
  return yScale.range()[0];
@@ -274,6 +274,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
274
274
  slotProps: PropTypes.object,
275
275
  slots: PropTypes.object,
276
276
  stroke: PropTypes.string,
277
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
277
278
  tickFontSize: PropTypes.number,
278
279
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
279
280
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -326,6 +327,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
326
327
  slotProps: PropTypes.object,
327
328
  slots: PropTypes.object,
328
329
  stroke: PropTypes.string,
330
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
329
331
  tickFontSize: PropTypes.number,
330
332
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
331
333
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -7,16 +7,10 @@ export const getExtremumX = params => {
7
7
  return [minX, maxX];
8
8
  };
9
9
  function getSeriesExtremums(getValues, stackedData) {
10
- if (stackedData.length === 0) {
11
- return [null, null];
12
- }
13
10
  return stackedData.reduce((seriesAcc, stackedValue) => {
14
11
  const [base, value] = getValues(stackedValue);
15
- if (seriesAcc[0] === null) {
16
- return [Math.min(base, value), Math.max(base, value)];
17
- }
18
12
  return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
19
- }, getValues(stackedData[0]));
13
+ }, [Infinity, -Infinity]);
20
14
  }
21
15
  export const getExtremumY = params => {
22
16
  const {
@@ -33,16 +27,11 @@ export const getExtremumY = params => {
33
27
  stackedData
34
28
  } = series[seriesId];
35
29
  const isArea = area !== undefined;
36
- const getValues = isArea && axis.scaleType !== 'log' ? d => d : d => [d[1], d[1]]; // Since this series is not used to display an area, we do not consider the base (the d[0]).
37
30
 
31
+ // Since this series is not used to display an area, we do not consider the base (the d[0]).
32
+ const getValues = isArea && axis.scaleType !== 'log' && typeof series[seriesId].baseline !== 'string' ? d => d : d => [d[1], d[1]];
38
33
  const seriesExtremums = getSeriesExtremums(getValues, stackedData);
39
- if (acc[0] === null) {
40
- return seriesExtremums;
41
- }
42
- if (seriesExtremums[0] === null) {
43
- return acc;
44
- }
45
34
  const [seriesMin, seriesMax] = seriesExtremums;
46
35
  return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
47
- }, [null, null]);
36
+ }, [Infinity, -Infinity]);
48
37
  };
@@ -318,6 +318,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
318
318
  slotProps: PropTypes.object,
319
319
  slots: PropTypes.object,
320
320
  stroke: PropTypes.string,
321
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
321
322
  tickFontSize: PropTypes.number,
322
323
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
323
324
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -370,6 +371,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
370
371
  slotProps: PropTypes.object,
371
372
  slots: PropTypes.object,
372
373
  stroke: PropTypes.string,
374
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
373
375
  tickFontSize: PropTypes.number,
374
376
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
375
377
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -130,6 +130,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
130
130
  slotProps: PropTypes.object,
131
131
  slots: PropTypes.object,
132
132
  stroke: PropTypes.string,
133
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
133
134
  tickFontSize: PropTypes.number,
134
135
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
135
136
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -182,6 +183,7 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
182
183
  slotProps: PropTypes.object,
183
184
  slots: PropTypes.object,
184
185
  stroke: PropTypes.string,
186
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
185
187
  tickFontSize: PropTypes.number,
186
188
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
187
189
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -255,6 +255,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
255
255
  slotProps: PropTypes.object,
256
256
  slots: PropTypes.object,
257
257
  stroke: PropTypes.string,
258
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
258
259
  tickFontSize: PropTypes.number,
259
260
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
260
261
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -307,6 +308,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
307
308
  slotProps: PropTypes.object,
308
309
  slots: PropTypes.object,
309
310
  stroke: PropTypes.string,
311
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
310
312
  tickFontSize: PropTypes.number,
311
313
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
312
314
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -1,10 +1,4 @@
1
1
  const mergeMinMax = (acc, val) => {
2
- if (acc[0] === null || acc[1] === null) {
3
- return val;
4
- }
5
- if (val[0] === null || val[1] === null) {
6
- return acc;
7
- }
8
2
  return [Math.min(acc[0], val[0]), Math.max(acc[1], val[1])];
9
3
  };
10
4
  export const getExtremumX = params => {
@@ -20,11 +14,10 @@ export const getExtremumX = params => {
20
14
  const seriesMinMax = series[seriesId].data.reduce((accSeries, {
21
15
  x
22
16
  }) => {
23
- const val = [x, x];
24
- return mergeMinMax(accSeries, val);
25
- }, [null, null]);
17
+ return mergeMinMax(accSeries, [x, x]);
18
+ }, [Infinity, -Infinity]);
26
19
  return mergeMinMax(acc, seriesMinMax);
27
- }, [null, null]);
20
+ }, [Infinity, -Infinity]);
28
21
  };
29
22
  export const getExtremumY = params => {
30
23
  const {
@@ -39,9 +32,8 @@ export const getExtremumY = params => {
39
32
  const seriesMinMax = series[seriesId].data.reduce((accSeries, {
40
33
  y
41
34
  }) => {
42
- const val = [y, y];
43
- return mergeMinMax(accSeries, val);
44
- }, [null, null]);
35
+ return mergeMinMax(accSeries, [y, y]);
36
+ }, [Infinity, -Infinity]);
45
37
  return mergeMinMax(acc, seriesMinMax);
46
- }, [null, null]);
38
+ }, [Infinity, -Infinity]);
47
39
  };
@@ -279,6 +279,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
279
279
  slotProps: PropTypes.object,
280
280
  slots: PropTypes.object,
281
281
  stroke: PropTypes.string,
282
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
282
283
  tickFontSize: PropTypes.number,
283
284
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
284
285
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -330,6 +331,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
330
331
  slotProps: PropTypes.object,
331
332
  slots: PropTypes.object,
332
333
  stroke: PropTypes.string,
334
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
333
335
  tickFontSize: PropTypes.number,
334
336
  tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
335
337
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
@@ -6,7 +6,7 @@ import { computeValue } from './computeValue';
6
6
  import { useXExtremumGetter } from '../PluginProvider/useXExtremumGetter';
7
7
  import { useYExtremumGetter } from '../PluginProvider';
8
8
  import { jsx as _jsx } from "react/jsx-runtime";
9
- function CartesianContextProvider(props) {
9
+ function CartesianProvider(props) {
10
10
  const {
11
11
  xAxis,
12
12
  yAxis,
@@ -47,4 +47,4 @@ function CartesianContextProvider(props) {
47
47
  children: children
48
48
  });
49
49
  }
50
- export { CartesianContextProvider };
50
+ export { CartesianProvider };
@@ -5,17 +5,10 @@ const axisExtremumCallback = (acc, chartType, axis, getters, isDefaultAxis, form
5
5
  series,
6
6
  axis,
7
7
  isDefaultAxis
8
- }) ?? [null, null];
9
- const [minData, maxData] = acc;
10
- if (minData === null || maxData === null) {
11
- return [minChartTypeData, maxChartTypeData];
12
- }
13
- if (minChartTypeData === null || maxChartTypeData === null) {
14
- return [minData, maxData];
15
- }
16
- return [Math.min(minChartTypeData, minData), Math.max(maxChartTypeData, maxData)];
8
+ }) ?? [Infinity, -Infinity];
9
+ return [Math.min(minChartTypeData, acc[0]), Math.max(maxChartTypeData, acc[1])];
17
10
  };
18
11
  export const getAxisExtremum = (axis, getters, isDefaultAxis, formattedSeries) => {
19
12
  const charTypes = Object.keys(getters);
20
- return charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis, formattedSeries), [null, null]);
13
+ return charTypes.reduce((acc, charType) => axisExtremumCallback(acc, charType, axis, getters, isDefaultAxis, formattedSeries), [Infinity, -Infinity]);
21
14
  };
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
2
  import { isBandScale } from '../internals/isBandScale';
3
+ import { isInfinity } from '../internals/isInfinity';
3
4
  export function getTickNumber(params) {
4
5
  const {
5
6
  tickMaxStep,
@@ -60,8 +61,10 @@ export function useTicks(options) {
60
61
  labelOffset: 0
61
62
  }));
62
63
  }
63
- if (scale.domain().length === 0 || scale.domain()[0] === scale.domain()[1]) {
64
- // The axis should not be visible, so ticks should also be hidden.
64
+ const domain = scale.domain();
65
+ // Skip axis rendering if no data is available
66
+ // - The domains contains Infinity for continuous scales.
67
+ if (domain.some(isInfinity)) {
65
68
  return [];
66
69
  }
67
70
  const ticks = typeof tickInterval === 'object' ? tickInterval : scale.ticks(tickNumber);
package/modern/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.12.1
2
+ * @mui/x-charts v7.13.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -0,0 +1,3 @@
1
+ export function isInfinity(v) {
2
+ return typeof v === 'number' && !Number.isFinite(v);
3
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mui/x-charts",
3
- "version": "7.12.1",
3
+ "version": "7.13.0",
4
4
  "description": "The community edition of the Charts components (MUI X).",
5
5
  "author": "MUI Team",
6
6
  "main": "./index.js",
@@ -36,7 +36,7 @@
36
36
  "@react-spring/web": "^9.7.4",
37
37
  "clsx": "^2.1.1",
38
38
  "prop-types": "^15.8.1",
39
- "@mui/x-charts-vendor": "7.12.1"
39
+ "@mui/x-charts-vendor": "7.13.0"
40
40
  },
41
41
  "peerDependencies": {
42
42
  "@emotion/react": "^11.9.0",