@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
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
- var _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
4
+ var _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
7
7
  import { animated, to } from '@react-spring/web';
@@ -44,7 +44,7 @@ var PieArcLabelRoot = styled(animated.text, {
44
44
  * It's not an inline function because we need it in inerpolation.
45
45
  */
46
46
  var getLabelPosition = function getLabelPosition(formattedArcLabel, variable) {
47
- return function (startAngle, endAngle, padAngle, innerRadius, outerRadius, cornerRadius) {
47
+ return function (startAngle, endAngle, padAngle, arcLabelRadius, cornerRadius) {
48
48
  if (!formattedArcLabel) {
49
49
  return 0;
50
50
  }
@@ -52,8 +52,8 @@ var getLabelPosition = function getLabelPosition(formattedArcLabel, variable) {
52
52
  padAngle: padAngle,
53
53
  startAngle: startAngle,
54
54
  endAngle: endAngle,
55
- innerRadius: innerRadius,
56
- outerRadius: outerRadius
55
+ innerRadius: arcLabelRadius,
56
+ outerRadius: arcLabelRadius
57
57
  }),
58
58
  _ref3 = _slicedToArray(_ref2, 2),
59
59
  x = _ref3[0],
@@ -71,8 +71,7 @@ function PieArcLabel(props) {
71
71
  startAngle = props.startAngle,
72
72
  endAngle = props.endAngle,
73
73
  paddingAngle = props.paddingAngle,
74
- innerRadius = props.innerRadius,
75
- outerRadius = props.outerRadius,
74
+ arcLabelRadius = props.arcLabelRadius,
76
75
  cornerRadius = props.cornerRadius,
77
76
  formattedArcLabel = props.formattedArcLabel,
78
77
  isHighlighted = props.isHighlighted,
@@ -91,8 +90,8 @@ function PieArcLabel(props) {
91
90
  className: classes.root
92
91
  }, other, {
93
92
  style: _extends({
94
- x: to([startAngle, endAngle, paddingAngle, innerRadius, outerRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
95
- y: to([startAngle, endAngle, paddingAngle, innerRadius, outerRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
93
+ x: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
94
+ y: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
96
95
  }, style),
97
96
  children: formattedArcLabel
98
97
  }));
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
4
- _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
3
+ var _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';
@@ -28,9 +28,9 @@ function PieArcLabelPlot(props) {
28
28
  var _slots$pieArcLabel;
29
29
  var slots = props.slots,
30
30
  slotProps = props.slotProps,
31
- _props$innerRadius = props.innerRadius,
32
- innerRadius = _props$innerRadius === void 0 ? 0 : _props$innerRadius,
31
+ innerRadius = props.innerRadius,
33
32
  outerRadius = props.outerRadius,
33
+ arcLabelRadius = props.arcLabelRadius,
34
34
  _props$cornerRadius = props.cornerRadius,
35
35
  cornerRadius = _props$cornerRadius === void 0 ? 0 : _props$cornerRadius,
36
36
  _props$paddingAngle = props.paddingAngle,
@@ -51,6 +51,7 @@ function PieArcLabelPlot(props) {
51
51
  var transformedData = useTransformData({
52
52
  innerRadius: innerRadius,
53
53
  outerRadius: outerRadius,
54
+ arcLabelRadius: arcLabelRadius,
54
55
  cornerRadius: cornerRadius,
55
56
  paddingAngle: paddingAngle,
56
57
  id: id,
@@ -73,6 +74,7 @@ function PieArcLabelPlot(props) {
73
74
  pA = _ref.paddingAngle,
74
75
  iR = _ref.innerRadius,
75
76
  oR = _ref.outerRadius,
77
+ aLR = _ref.arcLabelRadius,
76
78
  cR = _ref.cornerRadius,
77
79
  style = _objectWithoutProperties(_ref, _excluded2);
78
80
  return /*#__PURE__*/_jsx(ArcLabel, _extends({
@@ -81,6 +83,7 @@ function PieArcLabelPlot(props) {
81
83
  paddingAngle: pA,
82
84
  innerRadius: iR,
83
85
  outerRadius: oR,
86
+ arcLabelRadius: aLR,
84
87
  cornerRadius: cR,
85
88
  style: style,
86
89
  id: id,
@@ -103,8 +106,14 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
103
106
  arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
104
107
  /**
105
108
  * The minimal angle required to display the arc label.
109
+ * @default 0
106
110
  */
107
111
  arcLabelMinAngle: PropTypes.number,
112
+ /**
113
+ * The radius between circle center and the arc label in px.
114
+ * @default (innerRadius - outerRadius) / 2
115
+ */
116
+ arcLabelRadius: PropTypes.number,
108
117
  /**
109
118
  * The radius applied to arc corners (similar to border radius).
110
119
  * @default 0
@@ -123,9 +132,11 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
123
132
  })).isRequired,
124
133
  /**
125
134
  * Override the arc attibutes when it is faded.
135
+ * @default { additionalRadius: -5 }
126
136
  */
127
137
  faded: PropTypes.shape({
128
138
  additionalRadius: PropTypes.number,
139
+ arcLabelRadius: PropTypes.number,
129
140
  color: PropTypes.string,
130
141
  cornerRadius: PropTypes.number,
131
142
  innerRadius: PropTypes.number,
@@ -137,6 +148,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
137
148
  */
138
149
  highlighted: PropTypes.shape({
139
150
  additionalRadius: PropTypes.number,
151
+ arcLabelRadius: PropTypes.number,
140
152
  color: PropTypes.string,
141
153
  cornerRadius: PropTypes.number,
142
154
  innerRadius: PropTypes.number,
@@ -1,7 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  var _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';
@@ -55,6 +55,7 @@ function PieArcPlot(props) {
55
55
  endAngle = _ref.endAngle,
56
56
  pA = _ref.paddingAngle,
57
57
  iR = _ref.innerRadius,
58
+ arcLabelRadius = _ref.arcLabelRadius,
58
59
  oR = _ref.outerRadius,
59
60
  cR = _ref.cornerRadius,
60
61
  style = _objectWithoutProperties(_ref, _excluded2);
@@ -88,6 +89,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
88
89
  // | These PropTypes are generated from the TypeScript type definitions |
89
90
  // | To update them edit the TypeScript types and run "yarn proptypes" |
90
91
  // ----------------------------------------------------------------------
92
+ /**
93
+ * The radius between circle center and the arc label in px.
94
+ * @default (innerRadius - outerRadius) / 2
95
+ */
96
+ arcLabelRadius: PropTypes.number,
91
97
  /**
92
98
  * The radius applied to arc corners (similar to border radius).
93
99
  * @default 0
@@ -106,9 +112,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
106
112
  })).isRequired,
107
113
  /**
108
114
  * Override the arc attibutes when it is faded.
115
+ * @default { additionalRadius: -5 }
109
116
  */
110
117
  faded: PropTypes.shape({
111
118
  additionalRadius: PropTypes.number,
119
+ arcLabelRadius: PropTypes.number,
112
120
  color: PropTypes.string,
113
121
  cornerRadius: PropTypes.number,
114
122
  innerRadius: PropTypes.number,
@@ -120,6 +128,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
120
128
  */
121
129
  highlighted: PropTypes.shape({
122
130
  additionalRadius: PropTypes.number,
131
+ arcLabelRadius: PropTypes.number,
123
132
  color: PropTypes.string,
124
133
  cornerRadius: PropTypes.number,
125
134
  innerRadius: PropTypes.number,
@@ -120,7 +120,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
120
120
  /**
121
121
  * Indicate which axis to display the bottom of the charts.
122
122
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
123
- * @default xAxisIds[0] The id of the first provided axis
123
+ * @default null
124
124
  */
125
125
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
126
126
  axisId: PropTypes.string,
@@ -148,6 +148,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
148
148
  className: PropTypes.string,
149
149
  /**
150
150
  * Color palette used to colorize multiple series.
151
+ * @default blueberryTwilightPalette
151
152
  */
152
153
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
153
154
  /**
@@ -169,7 +170,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
169
170
  /**
170
171
  * Indicate which axis to display the left of the charts.
171
172
  * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
172
- * @default yAxisIds[0] The id of the first provided axis
173
+ * @default null
173
174
  */
174
175
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
175
176
  axisId: PropTypes.string,
@@ -250,6 +251,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
250
251
  series: PropTypes.arrayOf(PropTypes.shape({
251
252
  arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
252
253
  arcLabelMinAngle: PropTypes.number,
254
+ arcLabelRadius: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
253
255
  color: PropTypes.string,
254
256
  cornerRadius: PropTypes.number,
255
257
  cx: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
@@ -263,6 +265,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
263
265
  endAngle: PropTypes.number,
264
266
  faded: PropTypes.shape({
265
267
  additionalRadius: PropTypes.number,
268
+ arcLabelRadius: PropTypes.number,
266
269
  color: PropTypes.string,
267
270
  cornerRadius: PropTypes.number,
268
271
  innerRadius: PropTypes.number,
@@ -271,6 +274,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
271
274
  }),
272
275
  highlighted: PropTypes.shape({
273
276
  additionalRadius: PropTypes.number,
277
+ arcLabelRadius: PropTypes.number,
274
278
  color: PropTypes.string,
275
279
  cornerRadius: PropTypes.number,
276
280
  innerRadius: PropTypes.number,
@@ -73,6 +73,7 @@ function PiePlot(props) {
73
73
  var _series$seriesId2 = series[seriesId],
74
74
  innerRadiusParam = _series$seriesId2.innerRadius,
75
75
  outerRadiusParam = _series$seriesId2.outerRadius,
76
+ arcLabelRadiusParam = _series$seriesId2.arcLabelRadius,
76
77
  cornerRadius = _series$seriesId2.cornerRadius,
77
78
  paddingAngle = _series$seriesId2.paddingAngle,
78
79
  arcLabel = _series$seriesId2.arcLabel,
@@ -83,6 +84,7 @@ function PiePlot(props) {
83
84
  highlightScope = _series$seriesId2.highlightScope;
84
85
  var outerRadius = getPercentageValue(outerRadiusParam != null ? outerRadiusParam : availableRadius, availableRadius);
85
86
  var innerRadius = getPercentageValue(innerRadiusParam != null ? innerRadiusParam : 0, availableRadius);
87
+ var arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : getPercentageValue(arcLabelRadiusParam, availableRadius);
86
88
  var cx = getPercentageValue(cxParam != null ? cxParam : '50%', width);
87
89
  var cy = getPercentageValue(cyParam != null ? cyParam : '50%', height);
88
90
  return /*#__PURE__*/_jsx("g", {
@@ -90,6 +92,7 @@ function PiePlot(props) {
90
92
  children: /*#__PURE__*/_jsx(PieArcLabelPlot, {
91
93
  innerRadius: innerRadius,
92
94
  outerRadius: outerRadius != null ? outerRadius : availableRadius,
95
+ arcLabelRadius: arcLabelRadius,
93
96
  cornerRadius: cornerRadius,
94
97
  paddingAngle: paddingAngle,
95
98
  id: seriesId,
@@ -78,6 +78,7 @@ export var defaultLabelTransitionConfig = {
78
78
  from: function from(_ref5) {
79
79
  var innerRadius = _ref5.innerRadius,
80
80
  outerRadius = _ref5.outerRadius,
81
+ arcLabelRadius = _ref5.arcLabelRadius,
81
82
  cornerRadius = _ref5.cornerRadius,
82
83
  startAngle = _ref5.startAngle,
83
84
  endAngle = _ref5.endAngle,
@@ -86,6 +87,7 @@ export var defaultLabelTransitionConfig = {
86
87
  innerRadius: innerRadius,
87
88
  outerRadius: (innerRadius + outerRadius) / 2,
88
89
  cornerRadius: cornerRadius,
90
+ arcLabelRadius: arcLabelRadius,
89
91
  startAngle: (startAngle + endAngle) / 2,
90
92
  endAngle: (startAngle + endAngle) / 2,
91
93
  paddingAngle: paddingAngle,
@@ -99,6 +101,7 @@ export var defaultLabelTransitionConfig = {
99
101
  return {
100
102
  innerRadius: innerRadius,
101
103
  outerRadius: innerRadius,
104
+ arcLabelRadius: innerRadius,
102
105
  startAngle: (startAngle + endAngle) / 2,
103
106
  endAngle: (startAngle + endAngle) / 2,
104
107
  opacity: 0
@@ -108,12 +111,14 @@ export var defaultLabelTransitionConfig = {
108
111
  var innerRadius = _ref7.innerRadius,
109
112
  outerRadius = _ref7.outerRadius,
110
113
  startAngle = _ref7.startAngle,
111
- endAngle = _ref7.endAngle;
114
+ endAngle = _ref7.endAngle,
115
+ arcLabelRadius = _ref7.arcLabelRadius;
112
116
  return {
113
117
  innerRadius: innerRadius,
114
118
  outerRadius: outerRadius,
115
119
  startAngle: startAngle,
116
120
  endAngle: endAngle,
121
+ arcLabelRadius: arcLabelRadius,
117
122
  opacity: 1
118
123
  };
119
124
  },
@@ -123,7 +128,8 @@ export var defaultLabelTransitionConfig = {
123
128
  cornerRadius = _ref8.cornerRadius,
124
129
  startAngle = _ref8.startAngle,
125
130
  endAngle = _ref8.endAngle,
126
- paddingAngle = _ref8.paddingAngle;
131
+ paddingAngle = _ref8.paddingAngle,
132
+ arcLabelRadius = _ref8.arcLabelRadius;
127
133
  return {
128
134
  innerRadius: innerRadius,
129
135
  outerRadius: outerRadius,
@@ -131,6 +137,7 @@ export var defaultLabelTransitionConfig = {
131
137
  startAngle: startAngle,
132
138
  endAngle: endAngle,
133
139
  paddingAngle: paddingAngle,
140
+ arcLabelRadius: arcLabelRadius,
134
141
  opacity: 1
135
142
  };
136
143
  },
@@ -12,6 +12,7 @@ export function useTransformData(series) {
12
12
  basePaddingAngle = _series$paddingAngle === void 0 ? 0 : _series$paddingAngle,
13
13
  _series$innerRadius = series.innerRadius,
14
14
  baseInnerRadius = _series$innerRadius === void 0 ? 0 : _series$innerRadius,
15
+ baseArcLabelRadius = series.arcLabelRadius,
15
16
  baseOuterRadius = series.outerRadius,
16
17
  _series$cornerRadius = series.cornerRadius,
17
18
  baseCornerRadius = _series$cornerRadius === void 0 ? 0 : _series$cornerRadius;
@@ -35,26 +36,28 @@ export function useTransformData(series) {
35
36
  }, [highlightScope, highlightedItem, seriesId]);
36
37
  var dataWithHighlight = React.useMemo(function () {
37
38
  return data.map(function (item, itemIndex) {
38
- var _attibuesOverride$pad, _attibuesOverride$inn, _attibuesOverride$out, _attibuesOverride$cor;
39
+ var _attributesOverride$p, _attributesOverride$i, _attributesOverride$o, _attributesOverride$c, _ref, _attributesOverride$a;
39
40
  var _getHighlightStatus = getHighlightStatus(itemIndex),
40
41
  isHighlighted = _getHighlightStatus.isHighlighted,
41
42
  isFaded = _getHighlightStatus.isFaded;
42
- var attibuesOverride = _extends({
43
+ var attributesOverride = _extends({
43
44
  additionalRadius: 0
44
45
  }, isFaded && faded || isHighlighted && highlighted || {});
45
- var paddingAngle = Math.max(0, Math.PI * ((_attibuesOverride$pad = attibuesOverride.paddingAngle) != null ? _attibuesOverride$pad : basePaddingAngle) / 180);
46
- var innerRadius = Math.max(0, (_attibuesOverride$inn = attibuesOverride.innerRadius) != null ? _attibuesOverride$inn : baseInnerRadius);
47
- var outerRadius = Math.max(0, (_attibuesOverride$out = attibuesOverride.outerRadius) != null ? _attibuesOverride$out : baseOuterRadius + attibuesOverride.additionalRadius);
48
- var cornerRadius = (_attibuesOverride$cor = attibuesOverride.cornerRadius) != null ? _attibuesOverride$cor : baseCornerRadius;
49
- return _extends({}, item, attibuesOverride, {
46
+ var paddingAngle = Math.max(0, Math.PI * ((_attributesOverride$p = attributesOverride.paddingAngle) != null ? _attributesOverride$p : basePaddingAngle) / 180);
47
+ var innerRadius = Math.max(0, (_attributesOverride$i = attributesOverride.innerRadius) != null ? _attributesOverride$i : baseInnerRadius);
48
+ var outerRadius = Math.max(0, (_attributesOverride$o = attributesOverride.outerRadius) != null ? _attributesOverride$o : baseOuterRadius + attributesOverride.additionalRadius);
49
+ var cornerRadius = (_attributesOverride$c = attributesOverride.cornerRadius) != null ? _attributesOverride$c : baseCornerRadius;
50
+ var arcLabelRadius = (_ref = (_attributesOverride$a = attributesOverride.arcLabelRadius) != null ? _attributesOverride$a : baseArcLabelRadius) != null ? _ref : (innerRadius + outerRadius) / 2;
51
+ return _extends({}, item, attributesOverride, {
50
52
  isFaded: isFaded,
51
53
  isHighlighted: isHighlighted,
52
54
  paddingAngle: paddingAngle,
53
55
  innerRadius: innerRadius,
54
56
  outerRadius: outerRadius,
55
- cornerRadius: cornerRadius
57
+ cornerRadius: cornerRadius,
58
+ arcLabelRadius: arcLabelRadius
56
59
  });
57
60
  });
58
- }, [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, data, faded, getHighlightStatus, highlighted]);
61
+ }, [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, getHighlightStatus, highlighted]);
59
62
  return dataWithHighlight;
60
63
  }
@@ -67,11 +67,11 @@ var useChartDimensions = function useChartDimensions(inWidth, inHeight) {
67
67
  }, [computeSize, inHeight, inWidth]);
68
68
  if (process.env.NODE_ENV !== 'production') {
69
69
  if (displayError.current && inWidth === undefined && width === 0) {
70
- console.error("MUI-X-Charts: ChartContainer does not have `width` prop, and its container has no `width` defined.");
70
+ console.error("MUI X Charts: ChartContainer does not have `width` prop, and its container has no `width` defined.");
71
71
  displayError.current = false;
72
72
  }
73
73
  if (displayError.current && inHeight === undefined && height === 0) {
74
- console.error("MUI-X-Charts: ChartContainer does not have `height` prop, and its container has no `height` defined.");
74
+ console.error("MUI X Charts: ChartContainer does not have `height` prop, and its container has no `height` defined.");
75
75
  displayError.current = false;
76
76
  }
77
77
  }
@@ -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
  /**
@@ -126,6 +126,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
126
126
  className: PropTypes.string,
127
127
  /**
128
128
  * Color palette used to colorize multiple series.
129
+ * @default blueberryTwilightPalette
129
130
  */
130
131
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
131
132
  /**
@@ -156,7 +157,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
156
157
  * The margin between the SVG and the drawing area.
157
158
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
158
159
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
159
- * @default object Depends on the charts type.
160
+ * @default {
161
+ * top: 5,
162
+ * bottom: 5,
163
+ * left: 5,
164
+ * right: 5,
165
+ * }
160
166
  */
161
167
  margin: PropTypes.shape({
162
168
  bottom: PropTypes.number,
@@ -205,6 +211,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
205
211
  * Formatter used by the tooltip.
206
212
  * @param {number} value The value to format.
207
213
  * @returns {string} the formatted value.
214
+ * @default (v: number) => v.toString()
208
215
  */
209
216
  valueFormatter: PropTypes.func,
210
217
  viewBox: PropTypes.shape({
@@ -40,11 +40,11 @@ export var CartesianContext = /*#__PURE__*/React.createContext({
40
40
  *
41
41
  * - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
42
42
  */
43
- function CartesianContextProvider(_ref) {
44
- var inXAxis = _ref.xAxis,
45
- inYAxis = _ref.yAxis,
46
- dataset = _ref.dataset,
47
- children = _ref.children;
43
+ function CartesianContextProvider(props) {
44
+ var inXAxis = props.xAxis,
45
+ inYAxis = props.yAxis,
46
+ dataset = props.dataset,
47
+ children = props.children;
48
48
  var formattedSeries = React.useContext(SeriesContext);
49
49
  var drawingArea = React.useContext(DrawingContext);
50
50
  var xAxis = React.useMemo(function () {
@@ -54,7 +54,7 @@ function CartesianContextProvider(_ref) {
54
54
  return axisConfig;
55
55
  }
56
56
  if (dataset === undefined) {
57
- throw Error('MUI-X-Charts: x-axis uses `dataKey` but no `dataset` is provided.');
57
+ throw Error('MUI X Charts: x-axis uses `dataKey` but no `dataset` is provided.');
58
58
  }
59
59
  return _extends({}, axisConfig, {
60
60
  data: dataset.map(function (d) {
@@ -70,7 +70,7 @@ function CartesianContextProvider(_ref) {
70
70
  return axisConfig;
71
71
  }
72
72
  if (dataset === undefined) {
73
- throw Error('MUI-X-Charts: y-axis uses `dataKey` but no `dataset` is provided.');
73
+ throw Error('MUI X Charts: y-axis uses `dataKey` but no `dataset` is provided.');
74
74
  }
75
75
  return _extends({}, axisConfig, {
76
76
  data: dataset.map(function (d) {
@@ -82,9 +82,9 @@ function CartesianContextProvider(_ref) {
82
82
  var value = React.useMemo(function () {
83
83
  var _xAxis$map, _yAxis$map;
84
84
  var axisExtremumCallback = function axisExtremumCallback(acc, chartType, axis, getters, isDefaultAxis) {
85
- var _ref2, _formattedSeries$char;
85
+ var _ref, _formattedSeries$char;
86
86
  var getter = getters[chartType];
87
- var series = (_ref2 = (_formattedSeries$char = formattedSeries[chartType]) == null ? void 0 : _formattedSeries$char.series) != null ? _ref2 : {};
87
+ var series = (_ref = (_formattedSeries$char = formattedSeries[chartType]) == null ? void 0 : _formattedSeries$char.series) != null ? _ref : {};
88
88
  var _getter = getter({
89
89
  series: series,
90
90
  axis: axis,
@@ -114,8 +114,8 @@ function CartesianContextProvider(_ref) {
114
114
  return _extends({
115
115
  id: "deaultized-x-axis-".concat(index)
116
116
  }, axis);
117
- })) != null ? _xAxis$map : []), _toConsumableArray(xAxis === undefined || xAxis.findIndex(function (_ref3) {
118
- var id = _ref3.id;
117
+ })) != null ? _xAxis$map : []), _toConsumableArray(xAxis === undefined || xAxis.findIndex(function (_ref2) {
118
+ var id = _ref2.id;
119
119
  return id === DEFAULT_X_AXIS_KEY;
120
120
  }) === -1 ? [{
121
121
  id: DEFAULT_X_AXIS_KEY,
@@ -171,8 +171,8 @@ function CartesianContextProvider(_ref) {
171
171
  return _extends({
172
172
  id: "deaultized-y-axis-".concat(index)
173
173
  }, axis);
174
- })) != null ? _yAxis$map : []), _toConsumableArray(yAxis === undefined || yAxis.findIndex(function (_ref4) {
175
- var id = _ref4.id;
174
+ })) != null ? _yAxis$map : []), _toConsumableArray(yAxis === undefined || yAxis.findIndex(function (_ref3) {
175
+ var id = _ref3.id;
176
176
  return id === DEFAULT_Y_AXIS_KEY;
177
177
  }) === -1 ? [{
178
178
  id: DEFAULT_Y_AXIS_KEY,
@@ -226,12 +226,12 @@ function CartesianContextProvider(_ref) {
226
226
  return {
227
227
  xAxis: completedXAxis,
228
228
  yAxis: completedYAxis,
229
- xAxisIds: allXAxis.map(function (_ref5) {
230
- var id = _ref5.id;
229
+ xAxisIds: allXAxis.map(function (_ref4) {
230
+ var id = _ref4.id;
231
231
  return id;
232
232
  }),
233
- yAxisIds: allYAxis.map(function (_ref6) {
234
- var id = _ref6.id;
233
+ yAxisIds: allYAxis.map(function (_ref5) {
234
+ var id = _ref5.id;
235
235
  return id;
236
236
  })
237
237
  };
@@ -23,12 +23,12 @@ export var SVGContext = /*#__PURE__*/React.createContext({
23
23
  *
24
24
  * - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
25
25
  */
26
- function DrawingProvider(_ref) {
27
- var width = _ref.width,
28
- height = _ref.height,
29
- margin = _ref.margin,
30
- svgRef = _ref.svgRef,
31
- children = _ref.children;
26
+ function DrawingProvider(props) {
27
+ var width = props.width,
28
+ height = props.height,
29
+ margin = props.margin,
30
+ svgRef = props.svgRef,
31
+ children = props.children;
32
32
  var drawingArea = useChartDimensions(width, height, margin);
33
33
  return /*#__PURE__*/_jsx(SVGContext.Provider, {
34
34
  value: svgRef,
@@ -34,8 +34,8 @@ var dataReducer = function dataReducer(prevState, action) {
34
34
  return prevState;
35
35
  }
36
36
  };
37
- export function HighlightProvider(_ref) {
38
- var children = _ref.children;
37
+ function HighlightProvider(props) {
38
+ var children = props.children;
39
39
  var _React$useReducer = React.useReducer(dataReducer, {
40
40
  item: null,
41
41
  scope: defaultScope
@@ -52,4 +52,5 @@ export function HighlightProvider(_ref) {
52
52
  value: value,
53
53
  children: children
54
54
  });
55
- }
55
+ }
56
+ export { HighlightProvider };
@@ -55,8 +55,8 @@ var dataReducer = function dataReducer(prevState, action) {
55
55
  return prevState;
56
56
  }
57
57
  };
58
- export function InteractionProvider(_ref) {
59
- var children = _ref.children;
58
+ function InteractionProvider(props) {
59
+ var children = props.children;
60
60
  var _React$useReducer = React.useReducer(dataReducer, {
61
61
  item: null,
62
62
  axis: {
@@ -77,4 +77,5 @@ export function InteractionProvider(_ref) {
77
77
  value: value,
78
78
  children: children
79
79
  });
80
- }
80
+ }
81
+ export { InteractionProvider };
@@ -39,7 +39,7 @@ var formatSeries = function formatSeries(series, colors, dataset) {
39
39
  };
40
40
  }
41
41
  if (((_seriesGroups$type = seriesGroups[type]) == null ? void 0 : _seriesGroups$type.series[id]) !== undefined) {
42
- throw new Error("MUI-X-Charts: series' id \"".concat(id, "\" is not unique"));
42
+ throw new Error("MUI X Charts: series' id \"".concat(id, "\" is not unique."));
43
43
  }
44
44
  seriesGroups[type].series[id] = _extends({
45
45
  id: id
@@ -56,12 +56,12 @@ var formatSeries = function formatSeries(series, colors, dataset) {
56
56
  });
57
57
  return formattedSeries;
58
58
  };
59
- export function SeriesContextProvider(_ref) {
60
- var series = _ref.series,
61
- dataset = _ref.dataset,
62
- _ref$colors = _ref.colors,
63
- colors = _ref$colors === void 0 ? blueberryTwilightPalette : _ref$colors,
64
- children = _ref.children;
59
+ function SeriesContextProvider(props) {
60
+ var series = props.series,
61
+ dataset = props.dataset,
62
+ _props$colors = props.colors,
63
+ colors = _props$colors === void 0 ? blueberryTwilightPalette : _props$colors,
64
+ children = props.children;
65
65
  var theme = useTheme();
66
66
  var formattedSeries = React.useMemo(function () {
67
67
  return formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset);
@@ -70,4 +70,5 @@ export function SeriesContextProvider(_ref) {
70
70
  value: formattedSeries,
71
71
  children: children
72
72
  });
73
- }
73
+ }
74
+ export { SeriesContextProvider };
package/legacy/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v7.0.0-alpha.5
2
+ * @mui/x-charts v7.0.0-alpha.8
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -26,4 +26,5 @@ export * from './PieChart';
26
26
  export * from './ScatterChart';
27
27
  export * from './SparkLineChart';
28
28
  export * from './ChartContainer';
29
+ export * from './ChartsSurface';
29
30
  export * from './ResponsiveChartContainer';
@@ -3,9 +3,9 @@ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
3
  // DOM utils taken from
4
4
  // https://github.com/recharts/recharts/blob/master/src/util/DOMUtils.ts
5
5
 
6
- var isSsr = function isSsr() {
7
- return !(typeof window !== 'undefined' && window.document && window.setTimeout);
8
- };
6
+ function isSsr() {
7
+ return typeof window === 'undefined';
8
+ }
9
9
  var stringCache = {
10
10
  widthCache: {},
11
11
  cacheCount: 0