@mui/x-charts 6.18.7 → 6.19.3

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 (151) hide show
  1. package/BarChart/BarChart.js +1 -0
  2. package/BarChart/BarElement.d.ts +37 -20
  3. package/CHANGELOG.md +155 -0
  4. package/ChartsLegend/ChartsLegend.d.ts +5 -2
  5. package/ChartsLegend/ChartsLegend.js +137 -1
  6. package/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
  7. package/ChartsSurface.d.ts +2 -2
  8. package/ChartsSurface.js +33 -1
  9. package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  10. package/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  11. package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
  12. package/ChartsTooltip/ChartsTooltipTable.js +2 -0
  13. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  14. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
  15. package/LineChart/LineChart.d.ts +1 -0
  16. package/LineChart/LineChart.js +2 -0
  17. package/LineChart/formatter.js +5 -1
  18. package/PieChart/PieArcLabel.d.ts +1 -0
  19. package/PieChart/PieArcLabel.js +7 -8
  20. package/PieChart/PieArcLabelPlot.d.ts +5 -0
  21. package/PieChart/PieArcLabelPlot.js +16 -3
  22. package/PieChart/PieArcPlot.d.ts +5 -0
  23. package/PieChart/PieArcPlot.js +9 -1
  24. package/PieChart/PieChart.d.ts +14 -2
  25. package/PieChart/PieChart.js +6 -2
  26. package/PieChart/PiePlot.js +3 -0
  27. package/PieChart/dataTransform/transition.js +9 -2
  28. package/PieChart/dataTransform/useTransformData.d.ts +1 -0
  29. package/PieChart/dataTransform/useTransformData.js +11 -8
  30. package/ScatterChart/ScatterChart.js +1 -0
  31. package/SparkLineChart/SparkLineChart.d.ts +15 -1
  32. package/SparkLineChart/SparkLineChart.js +8 -1
  33. package/context/CartesianContextProvider.d.ts +1 -1
  34. package/context/CartesianContextProvider.js +7 -6
  35. package/context/DrawingProvider.d.ts +1 -1
  36. package/context/DrawingProvider.js +8 -7
  37. package/context/HighlightProvider.d.ts +2 -2
  38. package/context/HighlightProvider.js +4 -3
  39. package/context/InteractionProvider.d.ts +2 -2
  40. package/context/InteractionProvider.js +4 -3
  41. package/context/SeriesContextProvider.d.ts +3 -1
  42. package/context/SeriesContextProvider.js +7 -6
  43. package/esm/BarChart/BarChart.js +1 -0
  44. package/esm/ChartsLegend/ChartsLegend.js +139 -2
  45. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
  46. package/esm/ChartsSurface.js +35 -2
  47. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  48. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  49. package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
  50. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  51. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
  52. package/esm/LineChart/LineChart.js +2 -0
  53. package/esm/LineChart/formatter.js +5 -1
  54. package/esm/PieChart/PieArcLabel.js +7 -8
  55. package/esm/PieChart/PieArcLabelPlot.js +16 -3
  56. package/esm/PieChart/PieArcPlot.js +9 -1
  57. package/esm/PieChart/PieChart.js +6 -2
  58. package/esm/PieChart/PiePlot.js +3 -0
  59. package/esm/PieChart/dataTransform/transition.js +9 -2
  60. package/esm/PieChart/dataTransform/useTransformData.js +12 -9
  61. package/esm/ScatterChart/ScatterChart.js +1 -0
  62. package/esm/SparkLineChart/SparkLineChart.js +8 -1
  63. package/esm/context/CartesianContextProvider.js +7 -6
  64. package/esm/context/DrawingProvider.js +8 -7
  65. package/esm/context/HighlightProvider.js +6 -4
  66. package/esm/context/InteractionProvider.js +6 -4
  67. package/esm/context/SeriesContextProvider.js +9 -7
  68. package/esm/hooks/useDrawingArea.js +7 -3
  69. package/esm/index.js +2 -0
  70. package/esm/internals/stackSeries.js +5 -3
  71. package/esm/models/index.js +1 -0
  72. package/esm/models/stacking.js +1 -0
  73. package/hooks/useDrawingArea.d.ts +2 -0
  74. package/hooks/useDrawingArea.js +7 -3
  75. package/index.d.ts +2 -0
  76. package/index.js +23 -1
  77. package/internals/defaultizeColor.d.ts +7 -4
  78. package/internals/stackSeries.d.ts +8 -3
  79. package/internals/stackSeries.js +4 -3
  80. package/legacy/BarChart/BarChart.js +1 -0
  81. package/legacy/ChartsLegend/ChartsLegend.js +139 -2
  82. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +5 -3
  83. package/legacy/ChartsReferenceLine/common.js +3 -4
  84. package/legacy/ChartsSurface.js +35 -2
  85. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  86. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  87. package/legacy/ChartsTooltip/ChartsTooltipTable.js +8 -7
  88. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  89. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
  90. package/legacy/LineChart/LineChart.js +2 -0
  91. package/legacy/LineChart/formatter.js +6 -2
  92. package/legacy/PieChart/PieArcLabel.js +7 -6
  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/ScatterChart/ScatterChart.js +1 -0
  100. package/legacy/SparkLineChart/SparkLineChart.js +8 -1
  101. package/legacy/context/CartesianContextProvider.js +15 -15
  102. package/legacy/context/DrawingProvider.js +6 -6
  103. package/legacy/context/HighlightProvider.js +4 -3
  104. package/legacy/context/InteractionProvider.js +4 -3
  105. package/legacy/context/SeriesContextProvider.js +8 -7
  106. package/legacy/hooks/useDrawingArea.js +7 -3
  107. package/legacy/index.js +3 -1
  108. package/legacy/internals/components/AxisSharedComponents.js +5 -6
  109. package/legacy/internals/stackSeries.js +5 -3
  110. package/legacy/models/index.js +1 -0
  111. package/legacy/models/stacking.js +1 -0
  112. package/models/index.d.ts +1 -0
  113. package/models/index.js +11 -0
  114. package/models/seriesType/bar.d.ts +6 -0
  115. package/models/seriesType/common.d.ts +2 -3
  116. package/models/seriesType/index.d.ts +0 -1
  117. package/models/seriesType/line.d.ts +6 -0
  118. package/models/seriesType/pie.d.ts +15 -0
  119. package/models/stacking.d.ts +2 -0
  120. package/models/stacking.js +5 -0
  121. package/modern/BarChart/BarChart.js +1 -0
  122. package/modern/ChartsLegend/ChartsLegend.js +139 -2
  123. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
  124. package/modern/ChartsSurface.js +35 -2
  125. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
  126. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
  127. package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
  128. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
  129. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
  130. package/modern/LineChart/LineChart.js +2 -0
  131. package/modern/LineChart/formatter.js +5 -1
  132. package/modern/PieChart/PieArcLabel.js +7 -8
  133. package/modern/PieChart/PieArcLabelPlot.js +16 -3
  134. package/modern/PieChart/PieArcPlot.js +9 -1
  135. package/modern/PieChart/PieChart.js +6 -2
  136. package/modern/PieChart/PiePlot.js +3 -0
  137. package/modern/PieChart/dataTransform/transition.js +9 -2
  138. package/modern/PieChart/dataTransform/useTransformData.js +11 -8
  139. package/modern/ScatterChart/ScatterChart.js +1 -0
  140. package/modern/SparkLineChart/SparkLineChart.js +8 -1
  141. package/modern/context/CartesianContextProvider.js +7 -6
  142. package/modern/context/DrawingProvider.js +8 -7
  143. package/modern/context/HighlightProvider.js +6 -4
  144. package/modern/context/InteractionProvider.js +6 -4
  145. package/modern/context/SeriesContextProvider.js +9 -7
  146. package/modern/hooks/useDrawingArea.js +7 -3
  147. package/modern/index.js +3 -1
  148. package/modern/internals/stackSeries.js +4 -3
  149. package/modern/models/index.js +1 -0
  150. package/modern/models/stacking.js +1 -0
  151. package/package.json +1 -1
@@ -80,37 +80,7 @@ process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propType
80
80
  /**
81
81
  * The properties of the triggered axis.
82
82
  */
83
- axis: PropTypes.shape({
84
- axisId: PropTypes.string,
85
- classes: PropTypes.object,
86
- data: PropTypes.array,
87
- dataKey: PropTypes.string,
88
- disableLine: PropTypes.bool,
89
- disableTicks: PropTypes.bool,
90
- fill: PropTypes.string,
91
- hideTooltip: PropTypes.bool,
92
- id: PropTypes.string.isRequired,
93
- label: PropTypes.string,
94
- labelFontSize: PropTypes.number,
95
- labelStyle: PropTypes.object,
96
- max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
97
- min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
98
- position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
99
- scale: PropTypes.func.isRequired,
100
- scaleType: PropTypes.oneOf(['time']).isRequired,
101
- slotProps: PropTypes.object,
102
- slots: PropTypes.object,
103
- stroke: PropTypes.string,
104
- tickFontSize: PropTypes.number,
105
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
106
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
107
- tickLabelStyle: PropTypes.object,
108
- tickMaxStep: PropTypes.number,
109
- tickMinStep: PropTypes.number,
110
- tickNumber: PropTypes.number.isRequired,
111
- tickSize: PropTypes.number,
112
- valueFormatter: PropTypes.func
113
- }).isRequired,
83
+ axis: PropTypes.object.isRequired,
114
84
  /**
115
85
  * Data identifying the triggered axis.
116
86
  */
@@ -139,29 +109,7 @@ process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propType
139
109
  /**
140
110
  * The series linked to the triggered axis.
141
111
  */
142
- series: PropTypes.arrayOf(PropTypes.shape({
143
- area: PropTypes.bool,
144
- color: PropTypes.string.isRequired,
145
- connectNulls: PropTypes.bool,
146
- curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
147
- data: PropTypes.arrayOf(PropTypes.number).isRequired,
148
- dataKey: PropTypes.string,
149
- disableHighlight: PropTypes.bool,
150
- highlightScope: PropTypes.shape({
151
- faded: PropTypes.oneOf(['global', 'none', 'series']),
152
- highlighted: PropTypes.oneOf(['item', 'none', 'series'])
153
- }),
154
- id: PropTypes.string.isRequired,
155
- label: PropTypes.string,
156
- showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
157
- stack: PropTypes.string,
158
- stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
159
- stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
160
- type: PropTypes.oneOf(['line']).isRequired,
161
- valueFormatter: PropTypes.func.isRequired,
162
- xAxisKey: PropTypes.string,
163
- yAxisKey: PropTypes.string
164
- })).isRequired,
112
+ series: PropTypes.arrayOf(PropTypes.object).isRequired,
165
113
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
166
114
  } : void 0;
167
115
  export { DefaultChartsAxisTooltipContent };
@@ -75,7 +75,21 @@ process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propType
75
75
  */
76
76
  series: PropTypes.shape({
77
77
  color: PropTypes.string,
78
- data: PropTypes.arrayOf(PropTypes.number).isRequired,
78
+ data: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.shape({
79
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
80
+ x: PropTypes.number.isRequired,
81
+ y: PropTypes.number.isRequired
82
+ })), PropTypes.arrayOf(PropTypes.shape({
83
+ color: PropTypes.string.isRequired,
84
+ endAngle: PropTypes.number.isRequired,
85
+ formattedValue: PropTypes.string.isRequired,
86
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
87
+ index: PropTypes.number.isRequired,
88
+ label: PropTypes.string,
89
+ padAngle: PropTypes.number.isRequired,
90
+ startAngle: PropTypes.number.isRequired,
91
+ value: PropTypes.number.isRequired
92
+ }))]).isRequired,
79
93
  highlightScope: PropTypes.shape({
80
94
  faded: PropTypes.oneOf(['global', 'none', 'series']),
81
95
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
@@ -124,6 +124,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
124
124
  * - 'none': display nothing.
125
125
  * - 'line': display a line at the current mouse position.
126
126
  * - 'band': display a band at the current mouse position. Only available with band scale.
127
+ * @default { x: 'line' }
127
128
  */
128
129
  axisHighlight: PropTypes.shape({
129
130
  x: PropTypes.oneOf(['band', 'line', 'none']),
@@ -160,6 +161,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
160
161
  className: PropTypes.string,
161
162
  /**
162
163
  * Color palette used to colorize multiple series.
164
+ * @default blueberryTwilightPalette
163
165
  */
164
166
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
165
167
  /**
@@ -1,6 +1,6 @@
1
1
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
- import _extends from "@babel/runtime/helpers/esm/extends";
3
2
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
3
+ import _extends from "@babel/runtime/helpers/esm/extends";
4
4
  import { stack as d3Stack } from 'd3-shape';
5
5
  import { getStackingGroups } from '../internals/stackSeries';
6
6
  import defaultizeValueFormatter from '../internals/defaultizeValueFormatter';
@@ -11,7 +11,11 @@ var formatter = function formatter(params, dataset) {
11
11
  var _ref;
12
12
  var seriesOrder = params.seriesOrder,
13
13
  series = params.series;
14
- var stackingGroups = getStackingGroups(params);
14
+ var stackingGroups = getStackingGroups(_extends({}, params, {
15
+ defaultStrategy: {
16
+ stackOffset: 'none'
17
+ }
18
+ }));
15
19
 
16
20
  // Create a data set with format adapted to d3
17
21
  var d3Dataset = (_ref = dataset) != null ? _ref : [];
@@ -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", "innerRadius", "outerRadius", "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,6 +71,7 @@ function PieArcLabel(props) {
71
71
  startAngle = props.startAngle,
72
72
  endAngle = props.endAngle,
73
73
  paddingAngle = props.paddingAngle,
74
+ arcLabelRadius = props.arcLabelRadius,
74
75
  innerRadius = props.innerRadius,
75
76
  outerRadius = props.outerRadius,
76
77
  cornerRadius = props.cornerRadius,
@@ -91,8 +92,8 @@ function PieArcLabel(props) {
91
92
  className: classes.root
92
93
  }, other, {
93
94
  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'))
95
+ x: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
96
+ y: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
96
97
  }, style),
97
98
  children: formattedArcLabel
98
99
  }));
@@ -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
  }
@@ -113,6 +113,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
113
113
  className: PropTypes.string,
114
114
  /**
115
115
  * Color palette used to colorize multiple series.
116
+ * @default blueberryTwilightPalette
116
117
  */
117
118
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
118
119
  /**
@@ -125,6 +125,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
125
125
  className: PropTypes.string,
126
126
  /**
127
127
  * Color palette used to colorize multiple series.
128
+ * @default blueberryTwilightPalette
128
129
  */
129
130
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
130
131
  /**
@@ -155,7 +156,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
155
156
  * The margin between the SVG and the drawing area.
156
157
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
157
158
  * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
158
- * @default object Depends on the charts type.
159
+ * @default {
160
+ * top: 5,
161
+ * bottom: 5,
162
+ * left: 5,
163
+ * right: 5,
164
+ * }
159
165
  */
160
166
  margin: PropTypes.shape({
161
167
  bottom: PropTypes.number,
@@ -204,6 +210,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
204
210
  * Formatter used by the tooltip.
205
211
  * @param {number} value The value to format.
206
212
  * @returns {string} the formatted value.
213
+ * @default (v: number) => v.toString()
207
214
  */
208
215
  valueFormatter: PropTypes.func,
209
216
  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 () {
@@ -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 };
@@ -36,8 +36,8 @@ var dataReducer = function dataReducer(prevState, action) {
36
36
  return prevState;
37
37
  }
38
38
  };
39
- export function InteractionProvider(_ref) {
40
- var children = _ref.children;
39
+ function InteractionProvider(props) {
40
+ var children = props.children;
41
41
  var _React$useReducer = React.useReducer(dataReducer, {
42
42
  item: null,
43
43
  axis: {
@@ -57,4 +57,5 @@ export function InteractionProvider(_ref) {
57
57
  value: value,
58
58
  children: children
59
59
  });
60
- }
60
+ }
61
+ export { InteractionProvider };