@mui/x-charts 6.0.0-alpha.6 → 6.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 (142) hide show
  1. package/BarChart/BarChart.d.ts +19 -2
  2. package/BarChart/BarChart.js +84 -22
  3. package/BarChart/BarElement.d.ts +22 -0
  4. package/BarChart/BarElement.js +21 -10
  5. package/BarChart/BarPlot.d.ts +14 -1
  6. package/BarChart/BarPlot.js +48 -19
  7. package/BarChart/extremums.js +19 -3
  8. package/BarChart/formatter.js +3 -1
  9. package/CHANGELOG.md +213 -28
  10. package/ChartsAxis/ChartsAxis.d.ts +11 -1
  11. package/ChartsAxis/ChartsAxis.js +51 -6
  12. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +3 -2
  13. package/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  14. package/ChartsLegend/ChartsLegend.d.ts +25 -2
  15. package/ChartsLegend/ChartsLegend.js +49 -17
  16. package/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  17. package/ChartsTooltip/ChartsTooltipTable.d.ts +2 -9
  18. package/ChartsXAxis/ChartsXAxis.js +44 -9
  19. package/ChartsYAxis/ChartsYAxis.js +44 -9
  20. package/LineChart/AreaElement.d.ts +22 -0
  21. package/LineChart/AreaElement.js +31 -11
  22. package/LineChart/AreaPlot.d.ts +14 -1
  23. package/LineChart/AreaPlot.js +29 -3
  24. package/LineChart/LineChart.d.ts +20 -2
  25. package/LineChart/LineChart.js +63 -11
  26. package/LineChart/LineElement.d.ts +22 -0
  27. package/LineChart/LineElement.js +31 -10
  28. package/LineChart/LinePlot.d.ts +14 -1
  29. package/LineChart/LinePlot.js +35 -4
  30. package/LineChart/MarkPlot.d.ts +24 -1
  31. package/LineChart/MarkPlot.js +29 -4
  32. package/PieChart/PieArcLabel.js +0 -1
  33. package/PieChart/PieChart.d.ts +14 -2
  34. package/PieChart/PieChart.js +52 -10
  35. package/PieChart/PiePlot.d.ts +27 -1
  36. package/PieChart/PiePlot.js +29 -6
  37. package/ScatterChart/ScatterChart.d.ts +18 -2
  38. package/ScatterChart/ScatterChart.js +56 -10
  39. package/ScatterChart/ScatterPlot.d.ts +24 -1
  40. package/ScatterChart/ScatterPlot.js +28 -4
  41. package/SparkLineChart/SparkLineChart.d.ts +18 -0
  42. package/SparkLineChart/SparkLineChart.js +29 -6
  43. package/colorPalettes/colorPalettes.js +2 -2
  44. package/context/CartesianContextProvider.js +18 -12
  45. package/esm/BarChart/BarChart.js +88 -26
  46. package/esm/BarChart/BarElement.js +21 -11
  47. package/esm/BarChart/BarPlot.js +49 -20
  48. package/esm/BarChart/extremums.js +18 -2
  49. package/esm/BarChart/formatter.js +3 -1
  50. package/esm/ChartsAxis/ChartsAxis.js +51 -6
  51. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  52. package/esm/ChartsLegend/ChartsLegend.js +47 -14
  53. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  54. package/esm/ChartsXAxis/ChartsXAxis.js +45 -9
  55. package/esm/ChartsYAxis/ChartsYAxis.js +45 -9
  56. package/esm/LineChart/AreaElement.js +31 -11
  57. package/esm/LineChart/AreaPlot.js +31 -4
  58. package/esm/LineChart/LineChart.js +63 -11
  59. package/esm/LineChart/LineElement.js +31 -11
  60. package/esm/LineChart/LinePlot.js +43 -8
  61. package/esm/LineChart/MarkPlot.js +32 -5
  62. package/esm/PieChart/PieArcLabel.js +0 -1
  63. package/esm/PieChart/PieChart.js +52 -10
  64. package/esm/PieChart/PiePlot.js +31 -6
  65. package/esm/ScatterChart/ScatterChart.js +56 -10
  66. package/esm/ScatterChart/ScatterPlot.js +29 -4
  67. package/esm/SparkLineChart/SparkLineChart.js +29 -6
  68. package/esm/colorPalettes/colorPalettes.js +2 -2
  69. package/esm/context/CartesianContextProvider.js +18 -12
  70. package/esm/hooks/useAxisEvents.js +21 -38
  71. package/esm/hooks/useTicks.js +11 -8
  72. package/esm/internals/components/AxisSharedComponents.js +10 -10
  73. package/hooks/useAxisEvents.js +21 -38
  74. package/hooks/useTicks.d.ts +20 -5
  75. package/hooks/useTicks.js +11 -8
  76. package/index.js +1 -1
  77. package/internals/components/AxisSharedComponents.d.ts +4 -4
  78. package/internals/components/AxisSharedComponents.js +15 -15
  79. package/internals/defaultizeColor.d.ts +1 -0
  80. package/legacy/BarChart/BarChart.js +93 -29
  81. package/legacy/BarChart/BarElement.js +20 -10
  82. package/legacy/BarChart/BarPlot.js +49 -20
  83. package/legacy/BarChart/extremums.js +22 -2
  84. package/legacy/BarChart/formatter.js +3 -1
  85. package/legacy/ChartsAxis/ChartsAxis.js +51 -6
  86. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  87. package/legacy/ChartsLegend/ChartsLegend.js +46 -15
  88. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  89. package/legacy/ChartsXAxis/ChartsXAxis.js +45 -9
  90. package/legacy/ChartsYAxis/ChartsYAxis.js +45 -9
  91. package/legacy/LineChart/AreaElement.js +30 -10
  92. package/legacy/LineChart/AreaPlot.js +29 -4
  93. package/legacy/LineChart/LineChart.js +63 -11
  94. package/legacy/LineChart/LineElement.js +30 -10
  95. package/legacy/LineChart/LinePlot.js +36 -5
  96. package/legacy/LineChart/MarkPlot.js +30 -5
  97. package/legacy/PieChart/PieArcLabel.js +0 -1
  98. package/legacy/PieChart/PieChart.js +52 -10
  99. package/legacy/PieChart/PiePlot.js +29 -6
  100. package/legacy/ScatterChart/ScatterChart.js +56 -10
  101. package/legacy/ScatterChart/ScatterPlot.js +27 -4
  102. package/legacy/SparkLineChart/SparkLineChart.js +29 -6
  103. package/legacy/colorPalettes/colorPalettes.js +2 -2
  104. package/legacy/context/CartesianContextProvider.js +18 -12
  105. package/legacy/hooks/useAxisEvents.js +21 -37
  106. package/legacy/hooks/useTicks.js +11 -11
  107. package/legacy/index.js +1 -1
  108. package/legacy/internals/components/AxisSharedComponents.js +10 -10
  109. package/models/axis.d.ts +24 -1
  110. package/models/seriesType/bar.d.ts +6 -1
  111. package/modern/BarChart/BarChart.js +85 -23
  112. package/modern/BarChart/BarElement.js +20 -11
  113. package/modern/BarChart/BarPlot.js +48 -19
  114. package/modern/BarChart/extremums.js +18 -2
  115. package/modern/BarChart/formatter.js +3 -1
  116. package/modern/ChartsAxis/ChartsAxis.js +51 -6
  117. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
  118. package/modern/ChartsLegend/ChartsLegend.js +46 -14
  119. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
  120. package/modern/ChartsXAxis/ChartsXAxis.js +44 -9
  121. package/modern/ChartsYAxis/ChartsYAxis.js +44 -9
  122. package/modern/LineChart/AreaElement.js +30 -11
  123. package/modern/LineChart/AreaPlot.js +31 -4
  124. package/modern/LineChart/LineChart.js +63 -11
  125. package/modern/LineChart/LineElement.js +30 -11
  126. package/modern/LineChart/LinePlot.js +37 -5
  127. package/modern/LineChart/MarkPlot.js +31 -5
  128. package/modern/PieChart/PieArcLabel.js +0 -1
  129. package/modern/PieChart/PieChart.js +52 -10
  130. package/modern/PieChart/PiePlot.js +30 -6
  131. package/modern/ScatterChart/ScatterChart.js +56 -10
  132. package/modern/ScatterChart/ScatterPlot.js +28 -4
  133. package/modern/SparkLineChart/SparkLineChart.js +29 -6
  134. package/modern/colorPalettes/colorPalettes.js +2 -2
  135. package/modern/context/CartesianContextProvider.js +18 -12
  136. package/modern/hooks/useAxisEvents.js +21 -38
  137. package/modern/hooks/useTicks.js +11 -8
  138. package/modern/index.js +1 -1
  139. package/modern/internals/components/AxisSharedComponents.js +10 -10
  140. package/package.json +5 -5
  141. package/themeAugmentation/components.d.ts +0 -10
  142. package/themeAugmentation/overrides.d.ts +0 -2
@@ -44,7 +44,9 @@ function PieChart(props) {
44
44
  leftAxis = null,
45
45
  rightAxis = null,
46
46
  bottomAxis = null,
47
- children
47
+ children,
48
+ slots,
49
+ slotProps
48
50
  } = props;
49
51
  const margin = _extends({}, defaultMargin, marginProps);
50
52
  return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
@@ -67,8 +69,16 @@ function PieChart(props) {
67
69
  topAxis: topAxis,
68
70
  leftAxis: leftAxis,
69
71
  rightAxis: rightAxis,
70
- bottomAxis: bottomAxis
71
- }), /*#__PURE__*/_jsx(PiePlot, {}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), children]
72
+ bottomAxis: bottomAxis,
73
+ slots: slots,
74
+ slotProps: slotProps
75
+ }), /*#__PURE__*/_jsx(PiePlot, {
76
+ slots: slots,
77
+ slotProps: slotProps
78
+ }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
79
+ slots: slots,
80
+ slotProps: slotProps
81
+ })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), children]
72
82
  });
73
83
  }
74
84
  process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
@@ -78,7 +88,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
78
88
  // ----------------------------------------------------------------------
79
89
  axisHighlight: PropTypes.shape({
80
90
  x: PropTypes.oneOf(['band', 'line', 'none']),
81
- y: PropTypes.oneOf(['line', 'none'])
91
+ y: PropTypes.oneOf(['band', 'line', 'none'])
82
92
  }),
83
93
  /**
84
94
  * Indicate which axis to display the bottom of the charts.
@@ -94,8 +104,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
94
104
  label: PropTypes.string,
95
105
  labelFontSize: PropTypes.number,
96
106
  position: PropTypes.oneOf(['bottom', 'top']),
107
+ slotProps: PropTypes.object,
108
+ slots: PropTypes.object,
97
109
  stroke: PropTypes.string,
98
110
  tickFontSize: PropTypes.number,
111
+ tickMaxStep: PropTypes.number,
112
+ tickMinStep: PropTypes.number,
113
+ tickNumber: PropTypes.number,
99
114
  tickSize: PropTypes.number
100
115
  }), PropTypes.string]),
101
116
  children: PropTypes.node,
@@ -122,8 +137,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
122
137
  label: PropTypes.string,
123
138
  labelFontSize: PropTypes.number,
124
139
  position: PropTypes.oneOf(['left', 'right']),
140
+ slotProps: PropTypes.object,
141
+ slots: PropTypes.object,
125
142
  stroke: PropTypes.string,
126
143
  tickFontSize: PropTypes.number,
144
+ tickMaxStep: PropTypes.number,
145
+ tickMinStep: PropTypes.number,
146
+ tickNumber: PropTypes.number,
127
147
  tickSize: PropTypes.number
128
148
  }), PropTypes.string]),
129
149
  legend: PropTypes.shape({
@@ -140,6 +160,8 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
140
160
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
141
161
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
142
162
  }),
163
+ slotProps: PropTypes.object,
164
+ slots: PropTypes.object,
143
165
  spacing: PropTypes.number
144
166
  }),
145
167
  margin: PropTypes.shape({
@@ -162,8 +184,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
162
184
  label: PropTypes.string,
163
185
  labelFontSize: PropTypes.number,
164
186
  position: PropTypes.oneOf(['left', 'right']),
187
+ slotProps: PropTypes.object,
188
+ slots: PropTypes.object,
165
189
  stroke: PropTypes.string,
166
190
  tickFontSize: PropTypes.number,
191
+ tickMaxStep: PropTypes.number,
192
+ tickMinStep: PropTypes.number,
193
+ tickNumber: PropTypes.number,
167
194
  tickSize: PropTypes.number
168
195
  }), PropTypes.string]),
169
196
  series: PropTypes.arrayOf(PropTypes.shape({
@@ -205,6 +232,12 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
205
232
  type: PropTypes.oneOf(['pie']),
206
233
  valueFormatter: PropTypes.func
207
234
  })).isRequired,
235
+ /**
236
+ * The props used for each component slot.
237
+ * @default {}
238
+ */
239
+ slotProps: PropTypes.object,
240
+ slots: PropTypes.object,
208
241
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
209
242
  title: PropTypes.string,
210
243
  tooltip: PropTypes.shape({
@@ -227,8 +260,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
227
260
  label: PropTypes.string,
228
261
  labelFontSize: PropTypes.number,
229
262
  position: PropTypes.oneOf(['bottom', 'top']),
263
+ slotProps: PropTypes.object,
264
+ slots: PropTypes.object,
230
265
  stroke: PropTypes.string,
231
266
  tickFontSize: PropTypes.number,
267
+ tickMaxStep: PropTypes.number,
268
+ tickMinStep: PropTypes.number,
269
+ tickNumber: PropTypes.number,
232
270
  tickSize: PropTypes.number
233
271
  }), PropTypes.string]),
234
272
  viewBox: PropTypes.shape({
@@ -251,15 +289,17 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
251
289
  label: PropTypes.string,
252
290
  labelFontSize: PropTypes.number,
253
291
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
254
- maxTicks: PropTypes.number,
255
292
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
256
- minTicks: PropTypes.number,
257
293
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
258
294
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
295
+ slotProps: PropTypes.object,
296
+ slots: PropTypes.object,
259
297
  stroke: PropTypes.string,
260
298
  tickFontSize: PropTypes.number,
299
+ tickMaxStep: PropTypes.number,
300
+ tickMinStep: PropTypes.number,
301
+ tickNumber: PropTypes.number,
261
302
  tickSize: PropTypes.number,
262
- tickSpacing: PropTypes.number,
263
303
  valueFormatter: PropTypes.func
264
304
  })),
265
305
  yAxis: PropTypes.arrayOf(PropTypes.shape({
@@ -275,15 +315,17 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
275
315
  label: PropTypes.string,
276
316
  labelFontSize: PropTypes.number,
277
317
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
278
- maxTicks: PropTypes.number,
279
318
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
280
- minTicks: PropTypes.number,
281
319
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
282
320
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
321
+ slotProps: PropTypes.object,
322
+ slots: PropTypes.object,
283
323
  stroke: PropTypes.string,
284
324
  tickFontSize: PropTypes.number,
325
+ tickMaxStep: PropTypes.number,
326
+ tickMinStep: PropTypes.number,
327
+ tickNumber: PropTypes.number,
285
328
  tickSize: PropTypes.number,
286
- tickSpacing: PropTypes.number,
287
329
  valueFormatter: PropTypes.func
288
330
  }))
289
331
  } : void 0;
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
3
4
  import { SeriesContext } from '../context/SeriesContextProvider';
4
5
  import PieArc from './PieArc';
5
6
  import PieArcLabel from './PieArcLabel';
@@ -21,7 +22,11 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
21
22
  }
22
23
  return arcLabel(item);
23
24
  }
24
- export function PiePlot() {
25
+ function PiePlot(props) {
26
+ const {
27
+ slots,
28
+ slotProps
29
+ } = props;
25
30
  const seriesData = React.useContext(SeriesContext).pie;
26
31
  const {
27
32
  left,
@@ -41,6 +46,8 @@ export function PiePlot() {
41
46
  series,
42
47
  seriesOrder
43
48
  } = seriesData;
49
+ const Arc = slots?.pieArc ?? PieArc;
50
+ const ArcLabel = slots?.pieArcLabel ?? PieArcLabel;
44
51
  return /*#__PURE__*/_jsx("g", {
45
52
  children: seriesOrder.map(seriesId => {
46
53
  const {
@@ -59,7 +66,7 @@ export function PiePlot() {
59
66
  transform: `translate(${cx === undefined ? center.x : left + cx}, ${cy === undefined ? center.y : top + cy})`,
60
67
  children: /*#__PURE__*/_jsxs("g", {
61
68
  children: [data.map((item, index) => {
62
- return /*#__PURE__*/_createElement(PieArc, _extends({}, item, {
69
+ return /*#__PURE__*/_createElement(Arc, _extends({}, item, {
63
70
  key: item.id,
64
71
  innerRadius: innerRadius,
65
72
  outerRadius: outerRadius ?? availableRadius,
@@ -70,9 +77,9 @@ export function PiePlot() {
70
77
  highlightScope: series[seriesId].highlightScope,
71
78
  highlighted: highlighted,
72
79
  faded: faded
73
- }));
80
+ }, slotProps?.pieArc));
74
81
  }), data.map((item, index) => {
75
- return /*#__PURE__*/_createElement(PieArcLabel, _extends({}, item, {
82
+ return /*#__PURE__*/_createElement(ArcLabel, _extends({}, item, {
76
83
  key: item.id,
77
84
  innerRadius: innerRadius,
78
85
  outerRadius: outerRadius ?? availableRadius,
@@ -82,10 +89,27 @@ export function PiePlot() {
82
89
  dataIndex: index,
83
90
  highlightScope: series[seriesId].highlightScope,
84
91
  formattedArcLabel: getItemLabel(arcLabel, arcLabelMinAngle, item)
85
- }));
92
+ }, slotProps?.pieArcLabel));
86
93
  })]
87
94
  })
88
95
  }, seriesId);
89
96
  })
90
97
  });
91
- }
98
+ }
99
+ process.env.NODE_ENV !== "production" ? PiePlot.propTypes = {
100
+ // ----------------------------- Warning --------------------------------
101
+ // | These PropTypes are generated from the TypeScript type definitions |
102
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
103
+ // ----------------------------------------------------------------------
104
+ /**
105
+ * The props used for each component slot.
106
+ * @default {}
107
+ */
108
+ slotProps: PropTypes.object,
109
+ /**
110
+ * Overridable component slots.
111
+ * @default {}
112
+ */
113
+ slots: PropTypes.object
114
+ } : void 0;
115
+ export { PiePlot };
@@ -26,7 +26,9 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props,
26
26
  leftAxis,
27
27
  rightAxis,
28
28
  bottomAxis,
29
- children
29
+ children,
30
+ slots,
31
+ slotProps
30
32
  } = props;
31
33
  return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
32
34
  ref: ref,
@@ -44,8 +46,16 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props,
44
46
  topAxis: topAxis,
45
47
  leftAxis: leftAxis,
46
48
  rightAxis: rightAxis,
47
- bottomAxis: bottomAxis
48
- }), /*#__PURE__*/_jsx(ScatterPlot, {}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({
49
+ bottomAxis: bottomAxis,
50
+ slots: slots,
51
+ slotProps: slotProps
52
+ }), /*#__PURE__*/_jsx(ScatterPlot, {
53
+ slots: slots,
54
+ slotProps: slotProps
55
+ }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
56
+ slots: slots,
57
+ slotProps: slotProps
58
+ })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({
49
59
  x: "none",
50
60
  y: "none"
51
61
  }, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({
@@ -60,7 +70,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
60
70
  // ----------------------------------------------------------------------
61
71
  axisHighlight: PropTypes.shape({
62
72
  x: PropTypes.oneOf(['band', 'line', 'none']),
63
- y: PropTypes.oneOf(['line', 'none'])
73
+ y: PropTypes.oneOf(['band', 'line', 'none'])
64
74
  }),
65
75
  /**
66
76
  * Indicate which axis to display the bottom of the charts.
@@ -76,8 +86,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
76
86
  label: PropTypes.string,
77
87
  labelFontSize: PropTypes.number,
78
88
  position: PropTypes.oneOf(['bottom', 'top']),
89
+ slotProps: PropTypes.object,
90
+ slots: PropTypes.object,
79
91
  stroke: PropTypes.string,
80
92
  tickFontSize: PropTypes.number,
93
+ tickMaxStep: PropTypes.number,
94
+ tickMinStep: PropTypes.number,
95
+ tickNumber: PropTypes.number,
81
96
  tickSize: PropTypes.number
82
97
  }), PropTypes.string]),
83
98
  children: PropTypes.node,
@@ -104,8 +119,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
104
119
  label: PropTypes.string,
105
120
  labelFontSize: PropTypes.number,
106
121
  position: PropTypes.oneOf(['left', 'right']),
122
+ slotProps: PropTypes.object,
123
+ slots: PropTypes.object,
107
124
  stroke: PropTypes.string,
108
125
  tickFontSize: PropTypes.number,
126
+ tickMaxStep: PropTypes.number,
127
+ tickMinStep: PropTypes.number,
128
+ tickNumber: PropTypes.number,
109
129
  tickSize: PropTypes.number
110
130
  }), PropTypes.string]),
111
131
  legend: PropTypes.shape({
@@ -122,6 +142,8 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
122
142
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
123
143
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
124
144
  }),
145
+ slotProps: PropTypes.object,
146
+ slots: PropTypes.object,
125
147
  spacing: PropTypes.number
126
148
  }),
127
149
  margin: PropTypes.shape({
@@ -144,8 +166,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
144
166
  label: PropTypes.string,
145
167
  labelFontSize: PropTypes.number,
146
168
  position: PropTypes.oneOf(['left', 'right']),
169
+ slotProps: PropTypes.object,
170
+ slots: PropTypes.object,
147
171
  stroke: PropTypes.string,
148
172
  tickFontSize: PropTypes.number,
173
+ tickMaxStep: PropTypes.number,
174
+ tickMinStep: PropTypes.number,
175
+ tickNumber: PropTypes.number,
149
176
  tickSize: PropTypes.number
150
177
  }), PropTypes.string]),
151
178
  series: PropTypes.arrayOf(PropTypes.shape({
@@ -167,6 +194,16 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
167
194
  xAxisKey: PropTypes.string,
168
195
  yAxisKey: PropTypes.string
169
196
  })).isRequired,
197
+ /**
198
+ * The props used for each component slot.
199
+ * @default {}
200
+ */
201
+ slotProps: PropTypes.object,
202
+ /**
203
+ * Overridable component slots.
204
+ * @default {}
205
+ */
206
+ slots: PropTypes.object,
170
207
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
171
208
  title: PropTypes.string,
172
209
  tooltip: PropTypes.shape({
@@ -189,8 +226,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
189
226
  label: PropTypes.string,
190
227
  labelFontSize: PropTypes.number,
191
228
  position: PropTypes.oneOf(['bottom', 'top']),
229
+ slotProps: PropTypes.object,
230
+ slots: PropTypes.object,
192
231
  stroke: PropTypes.string,
193
232
  tickFontSize: PropTypes.number,
233
+ tickMaxStep: PropTypes.number,
234
+ tickMinStep: PropTypes.number,
235
+ tickNumber: PropTypes.number,
194
236
  tickSize: PropTypes.number
195
237
  }), PropTypes.string]),
196
238
  viewBox: PropTypes.shape({
@@ -213,15 +255,17 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
213
255
  label: PropTypes.string,
214
256
  labelFontSize: PropTypes.number,
215
257
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
216
- maxTicks: PropTypes.number,
217
258
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
218
- minTicks: PropTypes.number,
219
259
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
220
260
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
261
+ slotProps: PropTypes.object,
262
+ slots: PropTypes.object,
221
263
  stroke: PropTypes.string,
222
264
  tickFontSize: PropTypes.number,
265
+ tickMaxStep: PropTypes.number,
266
+ tickMinStep: PropTypes.number,
267
+ tickNumber: PropTypes.number,
223
268
  tickSize: PropTypes.number,
224
- tickSpacing: PropTypes.number,
225
269
  valueFormatter: PropTypes.func
226
270
  })),
227
271
  yAxis: PropTypes.arrayOf(PropTypes.shape({
@@ -237,15 +281,17 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
237
281
  label: PropTypes.string,
238
282
  labelFontSize: PropTypes.number,
239
283
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
240
- maxTicks: PropTypes.number,
241
284
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
242
- minTicks: PropTypes.number,
243
285
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
244
286
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
287
+ slotProps: PropTypes.object,
288
+ slots: PropTypes.object,
245
289
  stroke: PropTypes.string,
246
290
  tickFontSize: PropTypes.number,
291
+ tickMaxStep: PropTypes.number,
292
+ tickMinStep: PropTypes.number,
293
+ tickNumber: PropTypes.number,
247
294
  tickSize: PropTypes.number,
248
- tickSpacing: PropTypes.number,
249
295
  valueFormatter: PropTypes.func
250
296
  }))
251
297
  } : void 0;
@@ -1,9 +1,15 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
1
2
  import * as React from 'react';
3
+ import PropTypes from 'prop-types';
2
4
  import { Scatter } from './Scatter';
3
5
  import { SeriesContext } from '../context/SeriesContextProvider';
4
6
  import { CartesianContext } from '../context/CartesianContextProvider';
5
7
  import { jsx as _jsx } from "react/jsx-runtime";
6
- export function ScatterPlot() {
8
+ function ScatterPlot(props) {
9
+ const {
10
+ slots,
11
+ slotProps
12
+ } = props;
7
13
  const seriesData = React.useContext(SeriesContext).scatter;
8
14
  const axisData = React.useContext(CartesianContext);
9
15
  if (seriesData === undefined) {
@@ -21,6 +27,7 @@ export function ScatterPlot() {
21
27
  } = axisData;
22
28
  const defaultXAxisId = xAxisIds[0];
23
29
  const defaultYAxisId = yAxisIds[0];
30
+ const ScatterItems = slots?.scatter ?? Scatter;
24
31
  return /*#__PURE__*/_jsx(React.Fragment, {
25
32
  children: seriesOrder.map(seriesId => {
26
33
  const {
@@ -32,13 +39,30 @@ export function ScatterPlot() {
32
39
  } = series[seriesId];
33
40
  const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
34
41
  const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
35
- return /*#__PURE__*/_jsx(Scatter, {
42
+ return /*#__PURE__*/_jsx(ScatterItems, _extends({
36
43
  xScale: xScale,
37
44
  yScale: yScale,
38
45
  color: color,
39
46
  markerSize: markerSize ?? 4,
40
47
  series: series[seriesId]
41
- }, id);
48
+ }, slotProps?.scatter), id);
42
49
  })
43
50
  });
44
- }
51
+ }
52
+ process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes = {
53
+ // ----------------------------- Warning --------------------------------
54
+ // | These PropTypes are generated from the TypeScript type definitions |
55
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
56
+ // ----------------------------------------------------------------------
57
+ /**
58
+ * The props used for each component slot.
59
+ * @default {}
60
+ */
61
+ slotProps: PropTypes.object,
62
+ /**
63
+ * Overridable component slots.
64
+ * @default {}
65
+ */
66
+ slots: PropTypes.object
67
+ } : void 0;
68
+ export { ScatterPlot };
@@ -37,6 +37,8 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
37
37
  showHighlight,
38
38
  axisHighlight: inAxisHighlight,
39
39
  children,
40
+ slots,
41
+ slotProps,
40
42
  data,
41
43
  plotType = 'line',
42
44
  valueFormatter = v => v.toString(),
@@ -73,8 +75,17 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
73
75
  colors: colors,
74
76
  sx: sx,
75
77
  disableAxisListener: (!showTooltip || tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
76
- children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {}), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
77
- children: [/*#__PURE__*/_jsx(AreaPlot, {}), /*#__PURE__*/_jsx(LinePlot, {}), showHighlight && /*#__PURE__*/_jsx(SparkLineMarkPlot, {})]
78
+ children: [plotType === 'bar' && /*#__PURE__*/_jsx(BarPlot, {
79
+ slots: slots,
80
+ slotProps: slotProps
81
+ }), plotType === 'line' && /*#__PURE__*/_jsxs(React.Fragment, {
82
+ children: [/*#__PURE__*/_jsx(AreaPlot, {
83
+ slots: slots,
84
+ slotProps: slotProps
85
+ }), /*#__PURE__*/_jsx(LinePlot, {
86
+ slots: slots,
87
+ slotProps: slotProps
88
+ }), showHighlight && /*#__PURE__*/_jsx(SparkLineMarkPlot, {})]
78
89
  }), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), showTooltip && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), children]
79
90
  });
80
91
  });
@@ -91,7 +102,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
91
102
  area: PropTypes.bool,
92
103
  axisHighlight: PropTypes.shape({
93
104
  x: PropTypes.oneOf(['band', 'line', 'none']),
94
- y: PropTypes.oneOf(['line', 'none'])
105
+ y: PropTypes.oneOf(['band', 'line', 'none'])
95
106
  }),
96
107
  children: PropTypes.node,
97
108
  className: PropTypes.string,
@@ -134,6 +145,16 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
134
145
  * @default false
135
146
  */
136
147
  showTooltip: PropTypes.bool,
148
+ /**
149
+ * The props used for each component slot.
150
+ * @default {}
151
+ */
152
+ slotProps: PropTypes.object,
153
+ /**
154
+ * Overridable component slots.
155
+ * @default {}
156
+ */
157
+ slots: PropTypes.object,
137
158
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
138
159
  title: PropTypes.string,
139
160
  tooltip: PropTypes.shape({
@@ -172,15 +193,17 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
172
193
  label: PropTypes.string,
173
194
  labelFontSize: PropTypes.number,
174
195
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
175
- maxTicks: PropTypes.number,
176
196
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
177
- minTicks: PropTypes.number,
178
197
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
179
198
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
199
+ slotProps: PropTypes.object,
200
+ slots: PropTypes.object,
180
201
  stroke: PropTypes.string,
181
202
  tickFontSize: PropTypes.number,
203
+ tickMaxStep: PropTypes.number,
204
+ tickMinStep: PropTypes.number,
205
+ tickNumber: PropTypes.number,
182
206
  tickSize: PropTypes.number,
183
- tickSpacing: PropTypes.number,
184
207
  valueFormatter: PropTypes.func
185
208
  })
186
209
  } : void 0;
@@ -4,6 +4,6 @@ export const blueberryTwilightPalette = mode => mode === 'dark' ? blueberryTwili
4
4
  export const mangoFusionPaletteLight = ['#173A5E', '#00A3A0', '#C91B63', '#EF5350', '#FFA726', '#B800D8', '#60009B', '#2E96FF', '#2731C8', '#03008D'];
5
5
  export const mangoFusionPaletteDark = ['#41698F', '#19D0CD', '#DE196B', '#FC5F5C', '#FFD771', '#DA00FF', '#9001CB', '#72CCFF', '#2E96FF', '#3B48E0'];
6
6
  export const mangoFusionPalette = mode => mode === 'dark' ? mangoFusionPaletteDark : mangoFusionPaletteLight;
7
- export const cheerfulFiestaPaletteDark = ['#0072E6', '#66B2FF', '#FFB017', '#1F94AD', '#FF3143', '#FF6C63'];
8
- export const cheerfulFiestaPaletteLight = ['#0059B2', '#2E96FF', '#EA8C00', '#1F94AD', '#C82634', '#FF3143'];
7
+ export const cheerfulFiestaPaletteDark = ['#0059B2', '#2E96FF', '#FFC24C', '#FF9F0E', '#F38200', '#2ABFDE', '#1F94AD', '#BD2C38', '#FF3143', '#FF8282'];
8
+ export const cheerfulFiestaPaletteLight = ['#003A75', '#007FFF', '#FFC24C', '#FF9D09', '#CA6C00', '#127D94', '#1F94AD', '#C82634', '#FF3143', '#FF7E7E'];
9
9
  export const cheerfulFiestaPalette = mode => mode === 'dark' ? cheerfulFiestaPaletteDark : cheerfulFiestaPaletteLight;
@@ -123,7 +123,8 @@ function CartesianContextProvider({
123
123
  const scaleType = axis.scaleType ?? 'linear';
124
124
  const extremums = [axis.min ?? minData, axis.max ?? maxData];
125
125
  const ticksNumber = getTicksNumber(_extends({}, axis, {
126
- range
126
+ range,
127
+ domain: extremums
127
128
  }));
128
129
  const niceScale = getScale(scaleType, extremums, range).nice(ticksNumber);
129
130
  const niceDomain = niceScale.domain();
@@ -149,17 +150,17 @@ function CartesianContextProvider({
149
150
  const range = [drawingArea.top + drawingArea.height, drawingArea.top];
150
151
  if (isBandScaleConfig(axis)) {
151
152
  const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
152
- completedXAxis[axis.id] = _extends({
153
+ completedYAxis[axis.id] = _extends({
153
154
  categoryGapRatio,
154
155
  barGapRatio: 0
155
156
  }, axis, {
156
- scale: scaleBand(axis.data, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
157
+ scale: scaleBand(axis.data, [range[1], range[0]]).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
157
158
  ticksNumber: axis.data.length
158
159
  });
159
160
  }
160
161
  if (isPointScaleConfig(axis)) {
161
- completedXAxis[axis.id] = _extends({}, axis, {
162
- scale: scalePoint(axis.data, range),
162
+ completedYAxis[axis.id] = _extends({}, axis, {
163
+ scale: scalePoint(axis.data, [range[1], range[0]]),
163
164
  ticksNumber: axis.data.length
164
165
  });
165
166
  }
@@ -170,7 +171,8 @@ function CartesianContextProvider({
170
171
  const scaleType = axis.scaleType ?? 'linear';
171
172
  const extremums = [axis.min ?? minData, axis.max ?? maxData];
172
173
  const ticksNumber = getTicksNumber(_extends({}, axis, {
173
- range
174
+ range,
175
+ domain: extremums
174
176
  }));
175
177
  const niceScale = getScale(scaleType, extremums, range).nice(ticksNumber);
176
178
  const niceDomain = niceScale.domain();
@@ -219,15 +221,17 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
219
221
  label: PropTypes.string,
220
222
  labelFontSize: PropTypes.number,
221
223
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
222
- maxTicks: PropTypes.number,
223
224
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
224
- minTicks: PropTypes.number,
225
225
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
226
226
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
227
+ slotProps: PropTypes.object,
228
+ slots: PropTypes.object,
227
229
  stroke: PropTypes.string,
228
230
  tickFontSize: PropTypes.number,
231
+ tickMaxStep: PropTypes.number,
232
+ tickMinStep: PropTypes.number,
233
+ tickNumber: PropTypes.number,
229
234
  tickSize: PropTypes.number,
230
- tickSpacing: PropTypes.number,
231
235
  valueFormatter: PropTypes.func
232
236
  })),
233
237
  yAxis: PropTypes.arrayOf(PropTypes.shape({
@@ -243,15 +247,17 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
243
247
  label: PropTypes.string,
244
248
  labelFontSize: PropTypes.number,
245
249
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
246
- maxTicks: PropTypes.number,
247
250
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
248
- minTicks: PropTypes.number,
249
251
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
250
252
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
253
+ slotProps: PropTypes.object,
254
+ slots: PropTypes.object,
251
255
  stroke: PropTypes.string,
252
256
  tickFontSize: PropTypes.number,
257
+ tickMaxStep: PropTypes.number,
258
+ tickMinStep: PropTypes.number,
259
+ tickNumber: PropTypes.number,
253
260
  tickSize: PropTypes.number,
254
- tickSpacing: PropTypes.number,
255
261
  valueFormatter: PropTypes.func
256
262
  }))
257
263
  } : void 0;