@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.
Files changed (140) 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 +1 -1
  5. package/CHANGELOG.md +357 -49
  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/LineChart/AreaPlot.js +2 -2
  13. package/LineChart/LineChart.d.ts +1 -0
  14. package/LineChart/LineChart.js +2 -0
  15. package/LineChart/LineHighlightPlot.js +1 -1
  16. package/LineChart/LinePlot.js +2 -2
  17. package/LineChart/MarkPlot.js +1 -1
  18. package/LineChart/formatter.js +2 -2
  19. package/PieChart/PieArcLabel.d.ts +1 -0
  20. package/PieChart/PieArcLabel.js +7 -8
  21. package/PieChart/PieArcLabelPlot.d.ts +5 -0
  22. package/PieChart/PieArcLabelPlot.js +16 -3
  23. package/PieChart/PieArcPlot.d.ts +5 -0
  24. package/PieChart/PieArcPlot.js +9 -1
  25. package/PieChart/PieChart.d.ts +14 -2
  26. package/PieChart/PieChart.js +6 -2
  27. package/PieChart/PiePlot.js +3 -0
  28. package/PieChart/dataTransform/transition.js +9 -2
  29. package/PieChart/dataTransform/useTransformData.d.ts +1 -0
  30. package/PieChart/dataTransform/useTransformData.js +11 -8
  31. package/ResponsiveChartContainer/index.js +2 -2
  32. package/ScatterChart/ScatterChart.js +1 -0
  33. package/SparkLineChart/SparkLineChart.d.ts +15 -1
  34. package/SparkLineChart/SparkLineChart.js +8 -1
  35. package/context/CartesianContextProvider.d.ts +1 -1
  36. package/context/CartesianContextProvider.js +9 -8
  37. package/context/DrawingProvider.d.ts +1 -1
  38. package/context/DrawingProvider.js +8 -7
  39. package/context/HighlightProvider.d.ts +2 -2
  40. package/context/HighlightProvider.js +4 -3
  41. package/context/InteractionProvider.d.ts +2 -2
  42. package/context/InteractionProvider.js +4 -3
  43. package/context/SeriesContextProvider.d.ts +3 -1
  44. package/context/SeriesContextProvider.js +8 -7
  45. package/esm/BarChart/BarChart.js +1 -0
  46. package/esm/BarChart/BarPlot.js +4 -4
  47. package/esm/BarChart/formatter.js +1 -1
  48. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  49. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
  50. package/esm/ChartsSurface.js +35 -2
  51. package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
  52. package/esm/LineChart/AreaPlot.js +2 -2
  53. package/esm/LineChart/LineChart.js +2 -0
  54. package/esm/LineChart/LineHighlightPlot.js +1 -1
  55. package/esm/LineChart/LinePlot.js +2 -2
  56. package/esm/LineChart/MarkPlot.js +1 -1
  57. package/esm/LineChart/formatter.js +2 -2
  58. package/esm/PieChart/PieArcLabel.js +7 -8
  59. package/esm/PieChart/PieArcLabelPlot.js +16 -3
  60. package/esm/PieChart/PieArcPlot.js +9 -1
  61. package/esm/PieChart/PieChart.js +6 -2
  62. package/esm/PieChart/PiePlot.js +3 -0
  63. package/esm/PieChart/dataTransform/transition.js +9 -2
  64. package/esm/PieChart/dataTransform/useTransformData.js +12 -9
  65. package/esm/ResponsiveChartContainer/index.js +2 -2
  66. package/esm/ScatterChart/ScatterChart.js +1 -0
  67. package/esm/SparkLineChart/SparkLineChart.js +8 -1
  68. package/esm/context/CartesianContextProvider.js +9 -8
  69. package/esm/context/DrawingProvider.js +8 -7
  70. package/esm/context/HighlightProvider.js +6 -4
  71. package/esm/context/InteractionProvider.js +6 -4
  72. package/esm/context/SeriesContextProvider.js +10 -8
  73. package/esm/index.js +1 -0
  74. package/esm/internals/domUtils.js +3 -1
  75. package/index.d.ts +1 -0
  76. package/index.js +12 -1
  77. package/internals/defaultizeColor.d.ts +3 -0
  78. package/internals/domUtils.js +3 -1
  79. package/legacy/BarChart/BarChart.js +1 -0
  80. package/legacy/BarChart/BarPlot.js +4 -4
  81. package/legacy/BarChart/formatter.js +1 -1
  82. package/legacy/ChartsAxis/ChartsAxis.js +4 -4
  83. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +7 -5
  84. package/legacy/ChartsSurface.js +35 -2
  85. package/legacy/ChartsTooltip/ChartsTooltipTable.js +2 -0
  86. package/legacy/LineChart/AreaPlot.js +2 -2
  87. package/legacy/LineChart/LineChart.js +2 -0
  88. package/legacy/LineChart/LineHighlightPlot.js +1 -1
  89. package/legacy/LineChart/LinePlot.js +2 -2
  90. package/legacy/LineChart/MarkPlot.js +1 -1
  91. package/legacy/LineChart/formatter.js +2 -2
  92. package/legacy/PieChart/PieArcLabel.js +7 -8
  93. package/legacy/PieChart/PieArcLabelPlot.js +16 -4
  94. package/legacy/PieChart/PieArcPlot.js +10 -1
  95. package/legacy/PieChart/PieChart.js +6 -2
  96. package/legacy/PieChart/PiePlot.js +3 -0
  97. package/legacy/PieChart/dataTransform/transition.js +9 -2
  98. package/legacy/PieChart/dataTransform/useTransformData.js +12 -9
  99. package/legacy/ResponsiveChartContainer/index.js +2 -2
  100. package/legacy/ScatterChart/ScatterChart.js +1 -0
  101. package/legacy/SparkLineChart/SparkLineChart.js +8 -1
  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/index.js +2 -1
  108. package/legacy/internals/domUtils.js +3 -3
  109. package/models/seriesType/pie.d.ts +15 -0
  110. package/modern/BarChart/BarChart.js +1 -0
  111. package/modern/BarChart/BarPlot.js +4 -4
  112. package/modern/BarChart/formatter.js +1 -1
  113. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  114. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
  115. package/modern/ChartsSurface.js +35 -2
  116. package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
  117. package/modern/LineChart/AreaPlot.js +2 -2
  118. package/modern/LineChart/LineChart.js +2 -0
  119. package/modern/LineChart/LineHighlightPlot.js +1 -1
  120. package/modern/LineChart/LinePlot.js +2 -2
  121. package/modern/LineChart/MarkPlot.js +1 -1
  122. package/modern/LineChart/formatter.js +2 -2
  123. package/modern/PieChart/PieArcLabel.js +7 -8
  124. package/modern/PieChart/PieArcLabelPlot.js +16 -3
  125. package/modern/PieChart/PieArcPlot.js +9 -1
  126. package/modern/PieChart/PieChart.js +6 -2
  127. package/modern/PieChart/PiePlot.js +3 -0
  128. package/modern/PieChart/dataTransform/transition.js +9 -2
  129. package/modern/PieChart/dataTransform/useTransformData.js +11 -8
  130. package/modern/ResponsiveChartContainer/index.js +2 -2
  131. package/modern/ScatterChart/ScatterChart.js +1 -0
  132. package/modern/SparkLineChart/SparkLineChart.js +8 -1
  133. package/modern/context/CartesianContextProvider.js +9 -8
  134. package/modern/context/DrawingProvider.js +8 -7
  135. package/modern/context/HighlightProvider.js +6 -4
  136. package/modern/context/InteractionProvider.js +6 -4
  137. package/modern/context/SeriesContextProvider.js +10 -8
  138. package/modern/index.js +2 -1
  139. package/modern/internals/domUtils.js +3 -1
  140. package/package.json +5 -5
@@ -29,6 +29,13 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
29
29
  * @default '100%'
30
30
  */
31
31
  outerRadius?: number | string;
32
+ /**
33
+ * The radius between circle center and the arc label.
34
+ * Can be a number (in px) or a string with a percentage such as '50%'.
35
+ * The '100%' is the maximal radius that fit into the drawing area.
36
+ * @default (innerRadius - outerRadius) / 2
37
+ */
38
+ arcLabelRadius?: number | string;
32
39
  /**
33
40
  * The radius applied to arc corners (similar to border radius).
34
41
  * @default 0
@@ -56,6 +63,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
56
63
  arcLabel?: 'formattedValue' | 'label' | 'value' | ((item: DefaultizedPieValueType) => string);
57
64
  /**
58
65
  * The minimal angle required to display the arc label.
66
+ * @default 0
59
67
  */
60
68
  arcLabelMinAngle?: number;
61
69
  /**
@@ -85,6 +93,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
85
93
  outerRadius?: number;
86
94
  cornerRadius?: number;
87
95
  paddingAngle?: number;
96
+ arcLabelRadius?: number;
88
97
  color?: string;
89
98
  };
90
99
  /**
@@ -100,6 +109,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
100
109
  outerRadius?: number;
101
110
  cornerRadius?: number;
102
111
  paddingAngle?: number;
112
+ arcLabelRadius?: number;
103
113
  color?: string;
104
114
  };
105
115
  }
@@ -128,4 +138,9 @@ export interface ComputedPieRadius {
128
138
  * The radius between circle center and the end of the arc.
129
139
  */
130
140
  outerRadius: number;
141
+ /**
142
+ * The radius between circle center and the arc label in px.
143
+ * @default (innerRadius - outerRadius) / 2
144
+ */
145
+ arcLabelRadius?: number;
131
146
  }
@@ -153,6 +153,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
153
153
  className: PropTypes.string,
154
154
  /**
155
155
  * Color palette used to colorize multiple series.
156
+ * @default blueberryTwilightPalette
156
157
  */
157
158
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
158
159
  /**
@@ -69,18 +69,18 @@ const useCompletedData = () => {
69
69
  let baseScaleConfig;
70
70
  if (verticalLayout) {
71
71
  if (!isBandScaleConfig(xAxisConfig)) {
72
- throw new Error(`MUI-X-Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}"`);
72
+ throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}".`);
73
73
  }
74
74
  if (xAxis[xAxisKey].data === undefined) {
75
- throw new Error(`MUI-X-Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud have data property`);
75
+ throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} shoud have data property.`);
76
76
  }
77
77
  baseScaleConfig = xAxisConfig;
78
78
  } else {
79
79
  if (!isBandScaleConfig(yAxisConfig)) {
80
- throw new Error(`MUI-X-Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}"`);
80
+ throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud be of type "band" to display the bar series of id "${seriesId}".`);
81
81
  }
82
82
  if (yAxis[yAxisKey].data === undefined) {
83
- throw new Error(`MUI-X-Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud have data property`);
83
+ throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} shoud have data property.`);
84
84
  }
85
85
  baseScaleConfig = yAxisConfig;
86
86
  }
@@ -25,7 +25,7 @@ const formatter = (params, dataset) => {
25
25
  }
26
26
  });
27
27
  } else if (dataset === undefined) {
28
- throw new Error([`MUI-X-Charts: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
28
+ throw new Error([`MUI X Charts: bar series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
29
29
  }
30
30
  });
31
31
  const completedSeries = {};
@@ -58,16 +58,16 @@ function ChartsAxis(props) {
58
58
  const topId = getAxisId(topAxis);
59
59
  const rightId = getAxisId(rightAxis);
60
60
  if (topId !== null && !xAxis[topId]) {
61
- throw Error([`MUI-X-Charts: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
61
+ throw Error([`MUI X Charts: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
62
62
  }
63
63
  if (leftId !== null && !yAxis[leftId]) {
64
- throw Error([`MUI-X-Charts: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
64
+ throw Error([`MUI X Charts: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
65
65
  }
66
66
  if (rightId !== null && !yAxis[rightId]) {
67
- throw Error([`MUI-X-Charts: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
67
+ throw Error([`MUI X Charts: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
68
68
  }
69
69
  if (bottomId !== null && !xAxis[bottomId]) {
70
- throw Error([`MUI-X-Charts: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
70
+ throw Error([`MUI X Charts: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
71
71
  }
72
72
  const topAxisProps = mergeProps(topAxis, slots, slotProps);
73
73
  const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
@@ -5,13 +5,17 @@ import { ChartsXReferenceLine } from './ChartsXReferenceLine';
5
5
  import { ChartsYReferenceLine } from './ChartsYReferenceLine';
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
7
7
  function ChartsReferenceLine(props) {
8
- if (props.x !== undefined && props.y !== undefined) {
9
- throw new Error('MUI-X-Charts: The ChartsReferenceLine can not have both `x` and `y` props set.');
8
+ const {
9
+ x,
10
+ y
11
+ } = props;
12
+ if (x !== undefined && y !== undefined) {
13
+ throw new Error('MUI X Charts: The ChartsReferenceLine can not have both `x` and `y` props set.');
10
14
  }
11
- if (props.x === undefined && props.y === undefined) {
12
- throw new Error('MUI-X-Charts: The ChartsReferenceLine should have a value in `x` or `y` prop.');
15
+ if (x === undefined && y === undefined) {
16
+ throw new Error('MUI X Charts: The ChartsReferenceLine should have a value in `x` or `y` prop.');
13
17
  }
14
- if (props.x !== undefined) {
18
+ if (x !== undefined) {
15
19
  return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));
16
20
  }
17
21
  return /*#__PURE__*/_jsx(ChartsYReferenceLine, _extends({}, props));
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className"];
4
4
  import { styled } from '@mui/material/styles';
5
+ import PropTypes from 'prop-types';
5
6
  import * as React from 'react';
6
7
  import { useAxisEvents } from './hooks/useAxisEvents';
7
8
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -10,7 +11,7 @@ const ChartChartsSurfaceStyles = styled('svg', {
10
11
  name: 'MuiChartsSurface',
11
12
  slot: 'Root'
12
13
  })(() => ({}));
13
- export const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props, ref) {
14
+ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props, ref) {
14
15
  const {
15
16
  children,
16
17
  width,
@@ -38,4 +39,36 @@ export const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurfac
38
39
  children: props.desc
39
40
  }), children]
40
41
  }));
41
- });
42
+ });
43
+ process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
44
+ // ----------------------------- Warning --------------------------------
45
+ // | These PropTypes are generated from the TypeScript type definitions |
46
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
47
+ // ----------------------------------------------------------------------
48
+ children: PropTypes.node,
49
+ className: PropTypes.string,
50
+ desc: PropTypes.string,
51
+ /**
52
+ * If `true`, the charts will not listen to the mouse move event.
53
+ * It might break interactive features, but will improve performance.
54
+ * @default false
55
+ */
56
+ disableAxisListener: PropTypes.bool,
57
+ /**
58
+ * The height of the chart in px.
59
+ */
60
+ height: PropTypes.number.isRequired,
61
+ sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
62
+ title: PropTypes.string,
63
+ viewBox: PropTypes.shape({
64
+ height: PropTypes.number,
65
+ width: PropTypes.number,
66
+ x: PropTypes.number,
67
+ y: PropTypes.number
68
+ }),
69
+ /**
70
+ * The width of the chart in px.
71
+ */
72
+ width: PropTypes.number.isRequired
73
+ } : void 0;
74
+ export { ChartsSurface };
@@ -59,6 +59,8 @@ export const ChartsTooltipCell = styled('td', {
59
59
  paddingRight: theme.spacing(2)
60
60
  }
61
61
  }));
62
+
63
+ // eslint-disable-next-line material-ui/no-styled-box
62
64
  export const ChartsTooltipMark = styled(Box, {
63
65
  name: 'MuiChartsTooltip',
64
66
  slot: 'Mark'
@@ -62,10 +62,10 @@ function AreaPlot(props) {
62
62
  const xData = xAxis[xAxisKey].data;
63
63
  if (process.env.NODE_ENV !== 'production') {
64
64
  if (xData === undefined) {
65
- 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
+ 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.`);
66
66
  }
67
67
  if (xData.length < stackedData.length) {
68
- 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
+ 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).`);
69
69
  }
70
70
  }
71
71
  const areaPath = d3Area().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => d.y && yScale(d.y[0])).y1(d => d.y && yScale(d.y[1]));
@@ -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
  /**
@@ -70,7 +70,7 @@ function LineHighlightPlot(props) {
70
70
  const yScale = yAxis[yAxisKey].scale;
71
71
  const xData = xAxis[xAxisKey].data;
72
72
  if (xData === undefined) {
73
- 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.`);
73
+ 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.`);
74
74
  }
75
75
  const x = xScale(xData[highlightedIndex]);
76
76
  const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
@@ -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];
@@ -27,7 +27,7 @@ const formatter = (params, dataset) => {
27
27
  }
28
28
  });
29
29
  } 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'));
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'));
31
31
  }
32
32
  });
33
33
  const completedSeries = {};
@@ -54,7 +54,7 @@ const formatter = (params, dataset) => {
54
54
  warnedOnce = true;
55
55
  console.error([`MUI-X charts: your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
56
56
  }
57
- return 0;
57
+ return null;
58
58
  }
59
59
  return value;
60
60
  }) : series[id].data,
@@ -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", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
3
+ const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "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';
@@ -41,7 +41,7 @@ const PieArcLabelRoot = styled(animated.text, {
41
41
  * Helper to compute label position.
42
42
  * It's not an inline function because we need it in inerpolation.
43
43
  */
44
- const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle, innerRadius, outerRadius, cornerRadius) => {
44
+ const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle, arcLabelRadius, cornerRadius) => {
45
45
  if (!formattedArcLabel) {
46
46
  return 0;
47
47
  }
@@ -49,8 +49,8 @@ const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle,
49
49
  padAngle,
50
50
  startAngle,
51
51
  endAngle,
52
- innerRadius,
53
- outerRadius
52
+ innerRadius: arcLabelRadius,
53
+ outerRadius: arcLabelRadius
54
54
  });
55
55
  if (variable === 'x') {
56
56
  return x;
@@ -65,8 +65,7 @@ function PieArcLabel(props) {
65
65
  startAngle,
66
66
  endAngle,
67
67
  paddingAngle,
68
- innerRadius,
69
- outerRadius,
68
+ arcLabelRadius,
70
69
  cornerRadius,
71
70
  formattedArcLabel,
72
71
  isHighlighted,
@@ -86,8 +85,8 @@ function PieArcLabel(props) {
86
85
  className: classes.root
87
86
  }, other, {
88
87
  style: _extends({
89
- x: to([startAngle, endAngle, paddingAngle, innerRadius, outerRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
90
- y: to([startAngle, endAngle, paddingAngle, innerRadius, outerRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
88
+ x: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
89
+ y: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
91
90
  }, style),
92
91
  children: formattedArcLabel
93
92
  }));
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
- const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
4
- _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
3
+ const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
4
+ _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { useTransition } from '@react-spring/web';
@@ -27,8 +27,9 @@ function PieArcLabelPlot(props) {
27
27
  const {
28
28
  slots,
29
29
  slotProps,
30
- innerRadius = 0,
30
+ innerRadius,
31
31
  outerRadius,
32
+ arcLabelRadius,
32
33
  cornerRadius = 0,
33
34
  paddingAngle = 0,
34
35
  id,
@@ -46,6 +47,7 @@ function PieArcLabelPlot(props) {
46
47
  const transformedData = useTransformData({
47
48
  innerRadius,
48
49
  outerRadius,
50
+ arcLabelRadius,
49
51
  cornerRadius,
50
52
  paddingAngle,
51
53
  id,
@@ -69,6 +71,7 @@ function PieArcLabelPlot(props) {
69
71
  paddingAngle: pA,
70
72
  innerRadius: iR,
71
73
  outerRadius: oR,
74
+ arcLabelRadius: aLR,
72
75
  cornerRadius: cR
73
76
  } = _ref,
74
77
  style = _objectWithoutPropertiesLoose(_ref, _excluded2);
@@ -78,6 +81,7 @@ function PieArcLabelPlot(props) {
78
81
  paddingAngle: pA,
79
82
  innerRadius: iR,
80
83
  outerRadius: oR,
84
+ arcLabelRadius: aLR,
81
85
  cornerRadius: cR,
82
86
  style: style,
83
87
  id: id,
@@ -100,8 +104,14 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
100
104
  arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
101
105
  /**
102
106
  * The minimal angle required to display the arc label.
107
+ * @default 0
103
108
  */
104
109
  arcLabelMinAngle: PropTypes.number,
110
+ /**
111
+ * The radius between circle center and the arc label in px.
112
+ * @default (innerRadius - outerRadius) / 2
113
+ */
114
+ arcLabelRadius: PropTypes.number,
105
115
  /**
106
116
  * The radius applied to arc corners (similar to border radius).
107
117
  * @default 0
@@ -120,9 +130,11 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
120
130
  })).isRequired,
121
131
  /**
122
132
  * Override the arc attibutes when it is faded.
133
+ * @default { additionalRadius: -5 }
123
134
  */
124
135
  faded: PropTypes.shape({
125
136
  additionalRadius: PropTypes.number,
137
+ arcLabelRadius: PropTypes.number,
126
138
  color: PropTypes.string,
127
139
  cornerRadius: PropTypes.number,
128
140
  innerRadius: PropTypes.number,
@@ -134,6 +146,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
134
146
  */
135
147
  highlighted: PropTypes.shape({
136
148
  additionalRadius: PropTypes.number,
149
+ arcLabelRadius: PropTypes.number,
137
150
  color: PropTypes.string,
138
151
  cornerRadius: PropTypes.number,
139
152
  innerRadius: PropTypes.number,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
3
3
  const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onClick", "skipAnimation"],
4
- _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
4
+ _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { useTransition } from '@react-spring/web';
@@ -87,6 +87,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
87
87
  // | These PropTypes are generated from the TypeScript type definitions |
88
88
  // | To update them edit the TypeScript types and run "yarn proptypes" |
89
89
  // ----------------------------------------------------------------------
90
+ /**
91
+ * The radius between circle center and the arc label in px.
92
+ * @default (innerRadius - outerRadius) / 2
93
+ */
94
+ arcLabelRadius: PropTypes.number,
90
95
  /**
91
96
  * The radius applied to arc corners (similar to border radius).
92
97
  * @default 0
@@ -105,9 +110,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
105
110
  })).isRequired,
106
111
  /**
107
112
  * Override the arc attibutes when it is faded.
113
+ * @default { additionalRadius: -5 }
108
114
  */
109
115
  faded: PropTypes.shape({
110
116
  additionalRadius: PropTypes.number,
117
+ arcLabelRadius: PropTypes.number,
111
118
  color: PropTypes.string,
112
119
  cornerRadius: PropTypes.number,
113
120
  innerRadius: PropTypes.number,
@@ -119,6 +126,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
119
126
  */
120
127
  highlighted: PropTypes.shape({
121
128
  additionalRadius: PropTypes.number,
129
+ arcLabelRadius: PropTypes.number,
122
130
  color: PropTypes.string,
123
131
  cornerRadius: PropTypes.number,
124
132
  innerRadius: 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,
@@ -238,6 +239,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
238
239
  series: PropTypes.arrayOf(PropTypes.shape({
239
240
  arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
240
241
  arcLabelMinAngle: PropTypes.number,
242
+ arcLabelRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
241
243
  color: PropTypes.string,
242
244
  cornerRadius: PropTypes.number,
243
245
  cx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -251,6 +253,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
251
253
  endAngle: PropTypes.number,
252
254
  faded: PropTypes.shape({
253
255
  additionalRadius: PropTypes.number,
256
+ arcLabelRadius: PropTypes.number,
254
257
  color: PropTypes.string,
255
258
  cornerRadius: PropTypes.number,
256
259
  innerRadius: PropTypes.number,
@@ -259,6 +262,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
259
262
  }),
260
263
  highlighted: PropTypes.shape({
261
264
  additionalRadius: PropTypes.number,
265
+ arcLabelRadius: PropTypes.number,
262
266
  color: PropTypes.string,
263
267
  cornerRadius: PropTypes.number,
264
268
  innerRadius: PropTypes.number,
@@ -79,6 +79,7 @@ function PiePlot(props) {
79
79
  const {
80
80
  innerRadius: innerRadiusParam,
81
81
  outerRadius: outerRadiusParam,
82
+ arcLabelRadius: arcLabelRadiusParam,
82
83
  cornerRadius,
83
84
  paddingAngle,
84
85
  arcLabel,
@@ -90,6 +91,7 @@ function PiePlot(props) {
90
91
  } = series[seriesId];
91
92
  const outerRadius = getPercentageValue(outerRadiusParam ?? availableRadius, availableRadius);
92
93
  const innerRadius = getPercentageValue(innerRadiusParam ?? 0, availableRadius);
94
+ const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : getPercentageValue(arcLabelRadiusParam, availableRadius);
93
95
  const cx = getPercentageValue(cxParam ?? '50%', width);
94
96
  const cy = getPercentageValue(cyParam ?? '50%', height);
95
97
  return /*#__PURE__*/_jsx("g", {
@@ -97,6 +99,7 @@ function PiePlot(props) {
97
99
  children: /*#__PURE__*/_jsx(PieArcLabelPlot, {
98
100
  innerRadius: innerRadius,
99
101
  outerRadius: outerRadius ?? availableRadius,
102
+ arcLabelRadius: arcLabelRadius,
100
103
  cornerRadius: cornerRadius,
101
104
  paddingAngle: paddingAngle,
102
105
  id: seriesId,
@@ -70,6 +70,7 @@ export const defaultLabelTransitionConfig = {
70
70
  from: ({
71
71
  innerRadius,
72
72
  outerRadius,
73
+ arcLabelRadius,
73
74
  cornerRadius,
74
75
  startAngle,
75
76
  endAngle,
@@ -78,6 +79,7 @@ export const defaultLabelTransitionConfig = {
78
79
  innerRadius,
79
80
  outerRadius: (innerRadius + outerRadius) / 2,
80
81
  cornerRadius,
82
+ arcLabelRadius,
81
83
  startAngle: (startAngle + endAngle) / 2,
82
84
  endAngle: (startAngle + endAngle) / 2,
83
85
  paddingAngle,
@@ -90,6 +92,7 @@ export const defaultLabelTransitionConfig = {
90
92
  }) => ({
91
93
  innerRadius,
92
94
  outerRadius: innerRadius,
95
+ arcLabelRadius: innerRadius,
93
96
  startAngle: (startAngle + endAngle) / 2,
94
97
  endAngle: (startAngle + endAngle) / 2,
95
98
  opacity: 0
@@ -98,12 +101,14 @@ export const defaultLabelTransitionConfig = {
98
101
  innerRadius,
99
102
  outerRadius,
100
103
  startAngle,
101
- endAngle
104
+ endAngle,
105
+ arcLabelRadius
102
106
  }) => ({
103
107
  innerRadius,
104
108
  outerRadius,
105
109
  startAngle,
106
110
  endAngle,
111
+ arcLabelRadius,
107
112
  opacity: 1
108
113
  }),
109
114
  update: ({
@@ -112,7 +117,8 @@ export const defaultLabelTransitionConfig = {
112
117
  cornerRadius,
113
118
  startAngle,
114
119
  endAngle,
115
- paddingAngle
120
+ paddingAngle,
121
+ arcLabelRadius
116
122
  }) => ({
117
123
  innerRadius,
118
124
  outerRadius,
@@ -120,6 +126,7 @@ export const defaultLabelTransitionConfig = {
120
126
  startAngle,
121
127
  endAngle,
122
128
  paddingAngle,
129
+ arcLabelRadius,
123
130
  opacity: 1
124
131
  }),
125
132
  config: {
@@ -11,6 +11,7 @@ export function useTransformData(series) {
11
11
  highlighted,
12
12
  paddingAngle: basePaddingAngle = 0,
13
13
  innerRadius: baseInnerRadius = 0,
14
+ arcLabelRadius: baseArcLabelRadius,
14
15
  outerRadius: baseOuterRadius,
15
16
  cornerRadius: baseCornerRadius = 0
16
17
  } = series;
@@ -38,21 +39,23 @@ export function useTransformData(series) {
38
39
  isHighlighted,
39
40
  isFaded
40
41
  } = getHighlightStatus(itemIndex);
41
- const attibuesOverride = _extends({
42
+ const attributesOverride = _extends({
42
43
  additionalRadius: 0
43
44
  }, isFaded && faded || isHighlighted && highlighted || {});
44
- const paddingAngle = Math.max(0, Math.PI * (attibuesOverride.paddingAngle ?? basePaddingAngle) / 180);
45
- const innerRadius = Math.max(0, attibuesOverride.innerRadius ?? baseInnerRadius);
46
- const outerRadius = Math.max(0, attibuesOverride.outerRadius ?? baseOuterRadius + attibuesOverride.additionalRadius);
47
- const cornerRadius = attibuesOverride.cornerRadius ?? baseCornerRadius;
48
- return _extends({}, item, attibuesOverride, {
45
+ const paddingAngle = Math.max(0, Math.PI * (attributesOverride.paddingAngle ?? basePaddingAngle) / 180);
46
+ const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
47
+ const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
48
+ const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
49
+ const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
50
+ return _extends({}, item, attributesOverride, {
49
51
  isFaded,
50
52
  isHighlighted,
51
53
  paddingAngle,
52
54
  innerRadius,
53
55
  outerRadius,
54
- cornerRadius
56
+ cornerRadius,
57
+ arcLabelRadius
55
58
  });
56
- }), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, data, faded, getHighlightStatus, highlighted]);
59
+ }), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, getHighlightStatus, highlighted]);
57
60
  return dataWithHighlight;
58
61
  }
@@ -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
  /**