@mui/x-charts 6.0.0-alpha.14 → 6.0.0-alpha.16

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 (199) hide show
  1. package/BarChart/BarChart.d.ts +16 -2
  2. package/BarChart/BarChart.js +49 -11
  3. package/BarChart/BarElement.d.ts +1318 -3
  4. package/BarChart/BarElement.js +10 -8
  5. package/BarChart/BarPlot.d.ts +17 -1
  6. package/BarChart/BarPlot.js +152 -66
  7. package/CHANGELOG.md +169 -0
  8. package/ChartContainer/index.js +5 -2
  9. package/ChartsAxis/ChartsAxis.js +18 -2
  10. package/ChartsAxis/axisClasses.d.ts +1 -1
  11. package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
  12. package/ChartsClipPath/ChartsClipPath.js +2 -2
  13. package/ChartsLegend/ChartsLegend.d.ts +44 -24
  14. package/ChartsLegend/ChartsLegend.js +191 -145
  15. package/ChartsLegend/utils.d.ts +1 -6
  16. package/ChartsSurface.js +5 -13
  17. package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
  18. package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  19. package/ChartsTooltip/ChartsTooltip.js +2 -2
  20. package/ChartsTooltip/utils.js +2 -2
  21. package/ChartsXAxis/ChartsXAxis.js +151 -40
  22. package/ChartsYAxis/ChartsYAxis.js +76 -33
  23. package/LineChart/AreaElement.d.ts +10 -0
  24. package/LineChart/AreaElement.js +12 -2
  25. package/LineChart/AreaPlot.d.ts +11 -0
  26. package/LineChart/AreaPlot.js +13 -2
  27. package/LineChart/LineChart.d.ts +13 -0
  28. package/LineChart/LineChart.js +40 -10
  29. package/LineChart/LineElement.d.ts +10 -0
  30. package/LineChart/LineElement.js +12 -2
  31. package/LineChart/LineHighlightElement.d.ts +10 -0
  32. package/LineChart/LineHighlightElement.js +12 -2
  33. package/LineChart/LineHighlightPlot.d.ts +10 -0
  34. package/LineChart/LineHighlightPlot.js +12 -2
  35. package/LineChart/LinePlot.d.ts +10 -0
  36. package/LineChart/LinePlot.js +12 -2
  37. package/LineChart/MarkElement.d.ts +10 -0
  38. package/LineChart/MarkElement.js +12 -2
  39. package/LineChart/MarkPlot.d.ts +10 -0
  40. package/LineChart/MarkPlot.js +12 -2
  41. package/PieChart/PieArc.js +2 -2
  42. package/PieChart/PieArcLabel.js +2 -2
  43. package/PieChart/PieChart.d.ts +13 -0
  44. package/PieChart/PieChart.js +41 -10
  45. package/PieChart/PiePlot.d.ts +10 -0
  46. package/PieChart/PiePlot.js +12 -2
  47. package/ResponsiveChartContainer/index.js +4 -4
  48. package/ScatterChart/Scatter.d.ts +10 -0
  49. package/ScatterChart/Scatter.js +12 -2
  50. package/ScatterChart/ScatterChart.d.ts +13 -0
  51. package/ScatterChart/ScatterChart.js +40 -10
  52. package/ScatterChart/ScatterPlot.d.ts +10 -0
  53. package/ScatterChart/ScatterPlot.js +12 -2
  54. package/SparkLineChart/SparkLineChart.d.ts +9 -0
  55. package/SparkLineChart/SparkLineChart.js +16 -2
  56. package/constants.js +1 -1
  57. package/context/CartesianContextProvider.js +20 -12
  58. package/context/DrawingProvider.d.ts +2 -0
  59. package/context/DrawingProvider.js +4 -2
  60. package/context/HighlightProvider.js +2 -2
  61. package/context/InteractionProvider.js +2 -2
  62. package/context/SeriesContextProvider.js +2 -2
  63. package/esm/BarChart/BarChart.js +47 -9
  64. package/esm/BarChart/BarElement.js +7 -4
  65. package/esm/BarChart/BarPlot.js +152 -67
  66. package/esm/ChartContainer/index.js +3 -0
  67. package/esm/ChartsAxis/ChartsAxis.js +16 -0
  68. package/esm/ChartsLegend/ChartsLegend.js +188 -142
  69. package/esm/ChartsSurface.js +3 -11
  70. package/esm/ChartsXAxis/ChartsXAxis.js +148 -37
  71. package/esm/ChartsYAxis/ChartsYAxis.js +73 -30
  72. package/esm/LineChart/AreaElement.js +10 -0
  73. package/esm/LineChart/AreaPlot.js +11 -0
  74. package/esm/LineChart/LineChart.js +38 -8
  75. package/esm/LineChart/LineElement.js +10 -0
  76. package/esm/LineChart/LineHighlightElement.js +10 -0
  77. package/esm/LineChart/LineHighlightPlot.js +10 -0
  78. package/esm/LineChart/LinePlot.js +10 -0
  79. package/esm/LineChart/MarkElement.js +10 -0
  80. package/esm/LineChart/MarkPlot.js +10 -0
  81. package/esm/PieChart/PieChart.js +39 -8
  82. package/esm/PieChart/PiePlot.js +10 -0
  83. package/esm/ResponsiveChartContainer/index.js +2 -2
  84. package/esm/ScatterChart/Scatter.js +10 -0
  85. package/esm/ScatterChart/ScatterChart.js +38 -8
  86. package/esm/ScatterChart/ScatterPlot.js +10 -0
  87. package/esm/SparkLineChart/SparkLineChart.js +14 -0
  88. package/esm/constants.js +1 -1
  89. package/esm/context/CartesianContextProvider.js +19 -11
  90. package/esm/context/DrawingProvider.js +2 -0
  91. package/esm/hooks/useChartDimensions.js +2 -0
  92. package/esm/hooks/useMounted.js +16 -0
  93. package/esm/hooks/useReducedMotion.js +27 -0
  94. package/esm/hooks/useTicks.js +15 -9
  95. package/esm/internals/components/AxisSharedComponents.js +15 -70
  96. package/esm/internals/components/ChartsText.js +75 -0
  97. package/esm/internals/domUtils.js +113 -0
  98. package/esm/internals/geometry.js +36 -0
  99. package/hooks/useAxisEvents.js +2 -2
  100. package/hooks/useChartDimensions.d.ts +2 -0
  101. package/hooks/useChartDimensions.js +4 -2
  102. package/hooks/useDrawingArea.js +2 -2
  103. package/hooks/useInteractionItemProps.js +2 -2
  104. package/hooks/useMounted.d.ts +1 -0
  105. package/hooks/useMounted.js +25 -0
  106. package/hooks/useReducedMotion.d.ts +8 -0
  107. package/hooks/useReducedMotion.js +33 -0
  108. package/hooks/useScale.d.ts +2 -2
  109. package/hooks/useScale.js +2 -2
  110. package/hooks/useTicks.d.ts +19 -11
  111. package/hooks/useTicks.js +18 -12
  112. package/index.js +1 -1
  113. package/internals/components/AxisSharedComponents.d.ts +0 -4
  114. package/internals/components/AxisSharedComponents.js +16 -71
  115. package/internals/components/ChartsText.d.ts +35 -0
  116. package/internals/components/ChartsText.js +85 -0
  117. package/internals/defaultizeColor.d.ts +1 -1
  118. package/internals/domUtils.d.ts +13 -0
  119. package/internals/domUtils.js +122 -0
  120. package/internals/geometry.d.ts +9 -0
  121. package/internals/geometry.js +42 -0
  122. package/legacy/BarChart/BarChart.js +47 -9
  123. package/legacy/BarChart/BarElement.js +6 -3
  124. package/legacy/BarChart/BarPlot.js +151 -63
  125. package/legacy/ChartContainer/index.js +3 -0
  126. package/legacy/ChartsAxis/ChartsAxis.js +16 -0
  127. package/legacy/ChartsLegend/ChartsLegend.js +203 -140
  128. package/legacy/ChartsSurface.js +2 -11
  129. package/legacy/ChartsXAxis/ChartsXAxis.js +152 -39
  130. package/legacy/ChartsYAxis/ChartsYAxis.js +73 -30
  131. package/legacy/LineChart/AreaElement.js +10 -0
  132. package/legacy/LineChart/AreaPlot.js +11 -0
  133. package/legacy/LineChart/LineChart.js +38 -8
  134. package/legacy/LineChart/LineElement.js +10 -0
  135. package/legacy/LineChart/LineHighlightElement.js +10 -0
  136. package/legacy/LineChart/LineHighlightPlot.js +10 -0
  137. package/legacy/LineChart/LinePlot.js +10 -0
  138. package/legacy/LineChart/MarkElement.js +10 -0
  139. package/legacy/LineChart/MarkPlot.js +10 -0
  140. package/legacy/PieChart/PieChart.js +39 -8
  141. package/legacy/PieChart/PiePlot.js +10 -0
  142. package/legacy/ResponsiveChartContainer/index.js +2 -2
  143. package/legacy/ScatterChart/Scatter.js +10 -0
  144. package/legacy/ScatterChart/ScatterChart.js +38 -8
  145. package/legacy/ScatterChart/ScatterPlot.js +10 -0
  146. package/legacy/SparkLineChart/SparkLineChart.js +14 -0
  147. package/legacy/constants.js +1 -1
  148. package/legacy/context/CartesianContextProvider.js +19 -11
  149. package/legacy/context/DrawingProvider.js +2 -0
  150. package/legacy/hooks/useChartDimensions.js +2 -0
  151. package/legacy/hooks/useMounted.js +21 -0
  152. package/legacy/hooks/useReducedMotion.js +27 -0
  153. package/legacy/hooks/useTicks.js +16 -9
  154. package/legacy/index.js +1 -1
  155. package/legacy/internals/components/AxisSharedComponents.js +9 -63
  156. package/legacy/internals/components/ChartsText.js +77 -0
  157. package/legacy/internals/domUtils.js +121 -0
  158. package/legacy/internals/geometry.js +37 -0
  159. package/models/axis.d.ts +25 -7
  160. package/models/layout.d.ts +7 -6
  161. package/models/seriesType/line.d.ts +2 -2
  162. package/modern/BarChart/BarChart.js +47 -9
  163. package/modern/BarChart/BarElement.js +7 -4
  164. package/modern/BarChart/BarPlot.js +149 -65
  165. package/modern/ChartContainer/index.js +3 -0
  166. package/modern/ChartsAxis/ChartsAxis.js +16 -0
  167. package/modern/ChartsLegend/ChartsLegend.js +188 -142
  168. package/modern/ChartsSurface.js +3 -11
  169. package/modern/ChartsXAxis/ChartsXAxis.js +148 -37
  170. package/modern/ChartsYAxis/ChartsYAxis.js +73 -30
  171. package/modern/LineChart/AreaElement.js +10 -0
  172. package/modern/LineChart/AreaPlot.js +11 -0
  173. package/modern/LineChart/LineChart.js +38 -8
  174. package/modern/LineChart/LineElement.js +10 -0
  175. package/modern/LineChart/LineHighlightElement.js +10 -0
  176. package/modern/LineChart/LineHighlightPlot.js +10 -0
  177. package/modern/LineChart/LinePlot.js +10 -0
  178. package/modern/LineChart/MarkElement.js +10 -0
  179. package/modern/LineChart/MarkPlot.js +10 -0
  180. package/modern/PieChart/PieChart.js +39 -8
  181. package/modern/PieChart/PiePlot.js +10 -0
  182. package/modern/ResponsiveChartContainer/index.js +2 -2
  183. package/modern/ScatterChart/Scatter.js +10 -0
  184. package/modern/ScatterChart/ScatterChart.js +38 -8
  185. package/modern/ScatterChart/ScatterPlot.js +10 -0
  186. package/modern/SparkLineChart/SparkLineChart.js +14 -0
  187. package/modern/constants.js +1 -1
  188. package/modern/context/CartesianContextProvider.js +19 -11
  189. package/modern/context/DrawingProvider.js +2 -0
  190. package/modern/hooks/useChartDimensions.js +2 -0
  191. package/modern/hooks/useMounted.js +16 -0
  192. package/modern/hooks/useReducedMotion.js +27 -0
  193. package/modern/hooks/useTicks.js +15 -9
  194. package/modern/index.js +1 -1
  195. package/modern/internals/components/AxisSharedComponents.js +15 -70
  196. package/modern/internals/components/ChartsText.js +75 -0
  197. package/modern/internals/domUtils.js +113 -0
  198. package/modern/internals/geometry.js +36 -0
  199. package/package.json +5 -3
@@ -1,14 +1,16 @@
1
1
  import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- const _excluded = ["scale", "ticksNumber"];
3
+ const _excluded = ["scale", "tickNumber"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { useSlotProps } from '@mui/base/utils';
6
7
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
7
8
  import { useThemeProps, useTheme } from '@mui/material/styles';
8
9
  import { CartesianContext } from '../context/CartesianContextProvider';
9
10
  import { DrawingContext } from '../context/DrawingProvider';
10
11
  import useTicks from '../hooks/useTicks';
11
- import { ChartsLine, ChartsTick, ChartsTickLabel, ChartsLabel, AxisRoot } from '../internals/components/AxisSharedComponents';
12
+ import { AxisRoot } from '../internals/components/AxisSharedComponents';
13
+ import { ChartsText } from '../internals/components/ChartsText';
12
14
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
13
15
  import { jsx as _jsx } from "react/jsx-runtime";
14
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -46,7 +48,7 @@ function ChartsYAxis(inProps) {
46
48
  yAxis: {
47
49
  [_props$axisId]: {
48
50
  scale: yScale,
49
- ticksNumber
51
+ tickNumber
50
52
  }
51
53
  }
52
54
  } = _React$useContext,
@@ -77,18 +79,44 @@ function ChartsYAxis(inProps) {
77
79
  const tickSize = disableTicks ? 4 : tickSizeProp;
78
80
  const yTicks = useTicks({
79
81
  scale: yScale,
80
- ticksNumber,
82
+ tickNumber,
81
83
  valueFormatter
82
84
  });
83
- const positionSigne = position === 'right' ? 1 : -1;
85
+ const positionSign = position === 'right' ? 1 : -1;
84
86
  const labelRefPoint = {
85
- x: positionSigne * (tickFontSize + tickSize + 10),
87
+ x: positionSign * (tickFontSize + tickSize + 10),
86
88
  y: top + height / 2
87
89
  };
88
- const Line = slots?.axisLine ?? ChartsLine;
89
- const Tick = slots?.axisTick ?? ChartsTick;
90
- const TickLabel = slots?.axisTickLabel ?? ChartsTickLabel;
91
- const Label = slots?.axisLabel ?? ChartsLabel;
90
+ const Line = slots?.axisLine ?? 'line';
91
+ const Tick = slots?.axisTick ?? 'line';
92
+ const TickLabel = slots?.axisTickLabel ?? ChartsText;
93
+ const Label = slots?.axisLabel ?? ChartsText;
94
+ const axisTickLabelProps = useSlotProps({
95
+ elementType: TickLabel,
96
+ externalSlotProps: slotProps?.axisTickLabel,
97
+ additionalProps: {
98
+ style: {
99
+ fontSize: tickFontSize,
100
+ textAnchor: position === 'right' ? 'start' : 'end',
101
+ dominantBaseline: 'central'
102
+ },
103
+ className: classes.tickLabel
104
+ },
105
+ ownerState: {}
106
+ });
107
+ const axisLabelProps = useSlotProps({
108
+ elementType: Label,
109
+ externalSlotProps: slotProps?.axisLabel,
110
+ additionalProps: {
111
+ style: {
112
+ fontSize: labelFontSize,
113
+ angle: positionSign * 90,
114
+ textAnchor: 'middle',
115
+ dominantBaseline: 'auto'
116
+ }
117
+ },
118
+ ownerState: {}
119
+ });
92
120
  return /*#__PURE__*/_jsxs(AxisRoot, {
93
121
  transform: `translate(${position === 'right' ? left + width : left}, 0)`,
94
122
  className: classes.root,
@@ -101,36 +129,26 @@ function ChartsYAxis(inProps) {
101
129
  offset,
102
130
  labelOffset
103
131
  }, index) => {
104
- const xTickLabel = positionSigne * (tickSize + 2);
132
+ const xTickLabel = positionSign * (tickSize + 2);
105
133
  const yTickLabel = labelOffset;
106
134
  return /*#__PURE__*/_jsxs("g", {
107
135
  transform: `translate(0, ${offset})`,
108
136
  className: classes.tickContainer,
109
137
  children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
110
- x2: positionSigne * tickSize,
138
+ x2: positionSign * tickSize,
111
139
  className: classes.tick
112
140
  }, slotProps?.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
113
141
  x: xTickLabel,
114
142
  y: yTickLabel,
115
- "transform-origin": `${xTickLabel}px ${yTickLabel}px`,
116
- sx: {
117
- fontSize: tickFontSize
118
- },
119
- className: classes.tickLabel
120
- }, slotProps?.axisTickLabel, {
121
- children: formattedValue.toLocaleString()
122
- }))]
143
+ text: formattedValue.toString()
144
+ }, axisTickLabelProps))]
123
145
  }, index);
124
- }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
125
- sx: {
126
- fontSize: labelFontSize,
127
- transform: `rotate(${positionSigne * 90}deg)`,
128
- transformOrigin: `${labelRefPoint.x}px ${labelRefPoint.y}px`
129
- },
130
- className: classes.label
131
- }, slotProps?.axisLabel, {
132
- children: label
133
- }))]
146
+ }), label && /*#__PURE__*/_jsx("g", {
147
+ className: classes.label,
148
+ children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
149
+ text: label
150
+ }))
151
+ })]
134
152
  });
135
153
  }
136
154
  process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
@@ -168,8 +186,13 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
168
186
  /**
169
187
  * The font size of the axis label.
170
188
  * @default 14
189
+ * @deprecated Consider using `labelStyle.fontSize` instead.
171
190
  */
172
191
  labelFontSize: PropTypes.number,
192
+ /**
193
+ * The style applied to the axis label.
194
+ */
195
+ labelStyle: PropTypes.object,
173
196
  /**
174
197
  * Position of the axis.
175
198
  */
@@ -192,8 +215,28 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
192
215
  /**
193
216
  * The font size of the axis ticks text.
194
217
  * @default 12
218
+ * @deprecated Consider using `tickLabelStyle.fontSize` instead.
195
219
  */
196
220
  tickFontSize: PropTypes.number,
221
+ /**
222
+ * Defines which ticks are displayed. Its value can be:
223
+ * - 'auto' In such case the ticks are computed based on axis scale and other parameters.
224
+ * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
225
+ * - an array containing the values where ticks should be displayed.
226
+ * @default 'auto'
227
+ */
228
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
229
+ /**
230
+ * Defines which ticks get its label displayed. Its value can be:
231
+ * - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
232
+ * - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
233
+ * @default 'auto'
234
+ */
235
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
236
+ /**
237
+ * The style applied to ticks text.
238
+ */
239
+ tickLabelStyle: PropTypes.object,
197
240
  /**
198
241
  * Maximal step between two ticks.
199
242
  * When using time data, the value is assumed to be in ms.
@@ -55,6 +55,16 @@ AreaElementPath.propTypes = {
55
55
  }).isRequired,
56
56
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
57
57
  };
58
+ /**
59
+ * Demos:
60
+ *
61
+ * - [Lines](https://mui.com/x/react-charts/lines/)
62
+ * - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
63
+ *
64
+ * API:
65
+ *
66
+ * - [AreaElement API](https://mui.com/x/api/charts/area-element/)
67
+ */
58
68
  function AreaElement(props) {
59
69
  const {
60
70
  id,
@@ -10,6 +10,17 @@ import { AreaElement } from './AreaElement';
10
10
  import { getValueToPositionMapper } from '../hooks/useScale';
11
11
  import getCurveFactory from '../internals/getCurve';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ /**
14
+ * Demos:
15
+ *
16
+ * - [Lines](https://mui.com/x/react-charts/lines/)
17
+ * - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
18
+ * - [Stacking](https://mui.com/x/react-charts/stacking/)
19
+ *
20
+ * API:
21
+ *
22
+ * - [AreaPlot API](https://mui.com/x/api/charts/area-plot/)
23
+ */
13
24
  function AreaPlot(props) {
14
25
  const {
15
26
  slots,
@@ -15,6 +15,16 @@ import { ChartsClipPath } from '../ChartsClipPath';
15
15
  import { LineHighlightPlot } from './LineHighlightPlot';
16
16
  import { jsx as _jsx } from "react/jsx-runtime";
17
17
  import { jsxs as _jsxs } from "react/jsx-runtime";
18
+ /**
19
+ * Demos:
20
+ *
21
+ * - [Lines](https://mui.com/x/react-charts/lines/)
22
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
23
+ *
24
+ * API:
25
+ *
26
+ * - [LineChart API](https://mui.com/x/api/charts/line-chart/)
27
+ */
18
28
  const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
19
29
  const {
20
30
  xAxis,
@@ -118,11 +128,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
118
128
  fill: PropTypes.string,
119
129
  label: PropTypes.string,
120
130
  labelFontSize: PropTypes.number,
131
+ labelStyle: PropTypes.object,
121
132
  position: PropTypes.oneOf(['bottom', 'top']),
122
133
  slotProps: PropTypes.object,
123
134
  slots: PropTypes.object,
124
135
  stroke: PropTypes.string,
125
136
  tickFontSize: PropTypes.number,
137
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
138
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
139
+ tickLabelStyle: PropTypes.object,
126
140
  tickMaxStep: PropTypes.number,
127
141
  tickMinStep: PropTypes.number,
128
142
  tickNumber: PropTypes.number,
@@ -155,33 +169,33 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
155
169
  fill: PropTypes.string,
156
170
  label: PropTypes.string,
157
171
  labelFontSize: PropTypes.number,
172
+ labelStyle: PropTypes.object,
158
173
  position: PropTypes.oneOf(['left', 'right']),
159
174
  slotProps: PropTypes.object,
160
175
  slots: PropTypes.object,
161
176
  stroke: PropTypes.string,
162
177
  tickFontSize: PropTypes.number,
178
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
179
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
180
+ tickLabelStyle: PropTypes.object,
163
181
  tickMaxStep: PropTypes.number,
164
182
  tickMinStep: PropTypes.number,
165
183
  tickNumber: PropTypes.number,
166
184
  tickSize: PropTypes.number
167
185
  }), PropTypes.string]),
186
+ /**
187
+ * @deprecated Consider using `slotProps.legend` instead.
188
+ */
168
189
  legend: PropTypes.shape({
169
190
  classes: PropTypes.object,
170
191
  direction: PropTypes.oneOf(['column', 'row']),
171
192
  hidden: PropTypes.bool,
172
- itemWidth: PropTypes.number,
173
- markSize: PropTypes.number,
174
- offset: PropTypes.shape({
175
- x: PropTypes.number,
176
- y: PropTypes.number
177
- }),
178
193
  position: PropTypes.shape({
179
194
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
180
195
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
181
196
  }),
182
197
  slotProps: PropTypes.object,
183
- slots: PropTypes.object,
184
- spacing: PropTypes.number
198
+ slots: PropTypes.object
185
199
  }),
186
200
  margin: PropTypes.shape({
187
201
  bottom: PropTypes.number,
@@ -202,11 +216,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
202
216
  fill: PropTypes.string,
203
217
  label: PropTypes.string,
204
218
  labelFontSize: PropTypes.number,
219
+ labelStyle: PropTypes.object,
205
220
  position: PropTypes.oneOf(['left', 'right']),
206
221
  slotProps: PropTypes.object,
207
222
  slots: PropTypes.object,
208
223
  stroke: PropTypes.string,
209
224
  tickFontSize: PropTypes.number,
225
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
226
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
227
+ tickLabelStyle: PropTypes.object,
210
228
  tickMaxStep: PropTypes.number,
211
229
  tickMinStep: PropTypes.number,
212
230
  tickNumber: PropTypes.number,
@@ -267,11 +285,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
267
285
  fill: PropTypes.string,
268
286
  label: PropTypes.string,
269
287
  labelFontSize: PropTypes.number,
288
+ labelStyle: PropTypes.object,
270
289
  position: PropTypes.oneOf(['bottom', 'top']),
271
290
  slotProps: PropTypes.object,
272
291
  slots: PropTypes.object,
273
292
  stroke: PropTypes.string,
274
293
  tickFontSize: PropTypes.number,
294
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
295
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
296
+ tickLabelStyle: PropTypes.object,
275
297
  tickMaxStep: PropTypes.number,
276
298
  tickMinStep: PropTypes.number,
277
299
  tickNumber: PropTypes.number,
@@ -296,6 +318,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
296
318
  id: PropTypes.string,
297
319
  label: PropTypes.string,
298
320
  labelFontSize: PropTypes.number,
321
+ labelStyle: PropTypes.object,
299
322
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
300
323
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
301
324
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
@@ -304,6 +327,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
304
327
  slots: PropTypes.object,
305
328
  stroke: PropTypes.string,
306
329
  tickFontSize: PropTypes.number,
330
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
331
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
332
+ tickLabelStyle: PropTypes.object,
307
333
  tickMaxStep: PropTypes.number,
308
334
  tickMinStep: PropTypes.number,
309
335
  tickNumber: PropTypes.number,
@@ -322,6 +348,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
322
348
  id: PropTypes.string,
323
349
  label: PropTypes.string,
324
350
  labelFontSize: PropTypes.number,
351
+ labelStyle: PropTypes.object,
325
352
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
326
353
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
327
354
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
@@ -330,6 +357,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
330
357
  slots: PropTypes.object,
331
358
  stroke: PropTypes.string,
332
359
  tickFontSize: PropTypes.number,
360
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
361
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
362
+ tickLabelStyle: PropTypes.object,
333
363
  tickMaxStep: PropTypes.number,
334
364
  tickMinStep: PropTypes.number,
335
365
  tickNumber: PropTypes.number,
@@ -57,6 +57,16 @@ LineElementPath.propTypes = {
57
57
  }).isRequired,
58
58
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
59
59
  };
60
+ /**
61
+ * Demos:
62
+ *
63
+ * - [Lines](https://mui.com/x/react-charts/lines/)
64
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
65
+ *
66
+ * API:
67
+ *
68
+ * - [LineElement API](https://mui.com/x/api/charts/line-element/)
69
+ */
60
70
  function LineElement(props) {
61
71
  const {
62
72
  id,
@@ -33,6 +33,16 @@ const HighlightElement = styled('circle', {
33
33
  transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
34
34
  fill: ownerState.color
35
35
  }));
36
+ /**
37
+ * Demos:
38
+ *
39
+ * - [Lines](https://mui.com/x/react-charts/lines/)
40
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
41
+ *
42
+ * API:
43
+ *
44
+ * - [LineHighlightElement API](https://mui.com/x/api/charts/line-highlight-element/)
45
+ */
36
46
  function LineHighlightElement(props) {
37
47
  const {
38
48
  x,
@@ -9,6 +9,16 @@ import { LineHighlightElement } from './LineHighlightElement';
9
9
  import { getValueToPositionMapper } from '../hooks/useScale';
10
10
  import { InteractionContext } from '../context/InteractionProvider';
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
+ /**
13
+ * Demos:
14
+ *
15
+ * - [Lines](https://mui.com/x/react-charts/lines/)
16
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
17
+ *
18
+ * API:
19
+ *
20
+ * - [LineHighlightPlot API](https://mui.com/x/api/charts/line-highlight-plot/)
21
+ */
12
22
  function LineHighlightPlot(props) {
13
23
  const {
14
24
  slots,
@@ -10,6 +10,16 @@ import { LineElement } from './LineElement';
10
10
  import { getValueToPositionMapper } from '../hooks/useScale';
11
11
  import getCurveFactory from '../internals/getCurve';
12
12
  import { jsx as _jsx } from "react/jsx-runtime";
13
+ /**
14
+ * Demos:
15
+ *
16
+ * - [Lines](https://mui.com/x/react-charts/lines/)
17
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
18
+ *
19
+ * API:
20
+ *
21
+ * - [LinePlot API](https://mui.com/x/api/charts/line-plot/)
22
+ */
13
23
  function LinePlot(props) {
14
24
  const {
15
25
  slots,
@@ -59,6 +59,16 @@ MarkElementPath.propTypes = {
59
59
  }).isRequired,
60
60
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
61
61
  };
62
+ /**
63
+ * Demos:
64
+ *
65
+ * - [Lines](https://mui.com/x/react-charts/lines/)
66
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
67
+ *
68
+ * API:
69
+ *
70
+ * - [MarkElement API](https://mui.com/x/api/charts/mark-element/)
71
+ */
62
72
  function MarkElement(props) {
63
73
  const {
64
74
  x,
@@ -8,6 +8,16 @@ import { CartesianContext } from '../context/CartesianContextProvider';
8
8
  import { MarkElement } from './MarkElement';
9
9
  import { getValueToPositionMapper } from '../hooks/useScale';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
+ /**
12
+ * Demos:
13
+ *
14
+ * - [Lines](https://mui.com/x/react-charts/lines/)
15
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
16
+ *
17
+ * API:
18
+ *
19
+ * - [MarkPlot API](https://mui.com/x/api/charts/mark-plot/)
20
+ */
11
21
  function MarkPlot(props) {
12
22
  const {
13
23
  slots,
@@ -16,6 +16,17 @@ const defaultMargin = {
16
16
  left: 5,
17
17
  right: 100
18
18
  };
19
+
20
+ /**
21
+ * Demos:
22
+ *
23
+ * - [Pie](https://mui.com/x/react-charts/pie/)
24
+ * - [Pie demonstration](https://mui.com/x/react-charts/pie-demo/)
25
+ *
26
+ * API:
27
+ *
28
+ * - [PieChart API](https://mui.com/x/api/charts/pie-chart/)
29
+ */
19
30
  function PieChart(props) {
20
31
  const {
21
32
  xAxis,
@@ -105,11 +116,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
105
116
  fill: PropTypes.string,
106
117
  label: PropTypes.string,
107
118
  labelFontSize: PropTypes.number,
119
+ labelStyle: PropTypes.object,
108
120
  position: PropTypes.oneOf(['bottom', 'top']),
109
121
  slotProps: PropTypes.object,
110
122
  slots: PropTypes.object,
111
123
  stroke: PropTypes.string,
112
124
  tickFontSize: PropTypes.number,
125
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
126
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
127
+ tickLabelStyle: PropTypes.object,
113
128
  tickMaxStep: PropTypes.number,
114
129
  tickMinStep: PropTypes.number,
115
130
  tickNumber: PropTypes.number,
@@ -138,33 +153,33 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
138
153
  fill: PropTypes.string,
139
154
  label: PropTypes.string,
140
155
  labelFontSize: PropTypes.number,
156
+ labelStyle: PropTypes.object,
141
157
  position: PropTypes.oneOf(['left', 'right']),
142
158
  slotProps: PropTypes.object,
143
159
  slots: PropTypes.object,
144
160
  stroke: PropTypes.string,
145
161
  tickFontSize: PropTypes.number,
162
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
163
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
164
+ tickLabelStyle: PropTypes.object,
146
165
  tickMaxStep: PropTypes.number,
147
166
  tickMinStep: PropTypes.number,
148
167
  tickNumber: PropTypes.number,
149
168
  tickSize: PropTypes.number
150
169
  }), PropTypes.string]),
170
+ /**
171
+ * @deprecated Consider using `slotProps.legend` instead.
172
+ */
151
173
  legend: PropTypes.shape({
152
174
  classes: PropTypes.object,
153
175
  direction: PropTypes.oneOf(['column', 'row']),
154
176
  hidden: PropTypes.bool,
155
- itemWidth: PropTypes.number,
156
- markSize: PropTypes.number,
157
- offset: PropTypes.shape({
158
- x: PropTypes.number,
159
- y: PropTypes.number
160
- }),
161
177
  position: PropTypes.shape({
162
178
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
163
179
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
164
180
  }),
165
181
  slotProps: PropTypes.object,
166
- slots: PropTypes.object,
167
- spacing: PropTypes.number
182
+ slots: PropTypes.object
168
183
  }),
169
184
  margin: PropTypes.shape({
170
185
  bottom: PropTypes.number,
@@ -186,11 +201,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
186
201
  fill: PropTypes.string,
187
202
  label: PropTypes.string,
188
203
  labelFontSize: PropTypes.number,
204
+ labelStyle: PropTypes.object,
189
205
  position: PropTypes.oneOf(['left', 'right']),
190
206
  slotProps: PropTypes.object,
191
207
  slots: PropTypes.object,
192
208
  stroke: PropTypes.string,
193
209
  tickFontSize: PropTypes.number,
210
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
211
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
212
+ tickLabelStyle: PropTypes.object,
194
213
  tickMaxStep: PropTypes.number,
195
214
  tickMinStep: PropTypes.number,
196
215
  tickNumber: PropTypes.number,
@@ -264,11 +283,15 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
264
283
  fill: PropTypes.string,
265
284
  label: PropTypes.string,
266
285
  labelFontSize: PropTypes.number,
286
+ labelStyle: PropTypes.object,
267
287
  position: PropTypes.oneOf(['bottom', 'top']),
268
288
  slotProps: PropTypes.object,
269
289
  slots: PropTypes.object,
270
290
  stroke: PropTypes.string,
271
291
  tickFontSize: PropTypes.number,
292
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
293
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
294
+ tickLabelStyle: PropTypes.object,
272
295
  tickMaxStep: PropTypes.number,
273
296
  tickMinStep: PropTypes.number,
274
297
  tickNumber: PropTypes.number,
@@ -293,6 +316,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
293
316
  id: PropTypes.string,
294
317
  label: PropTypes.string,
295
318
  labelFontSize: PropTypes.number,
319
+ labelStyle: PropTypes.object,
296
320
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
297
321
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
298
322
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
@@ -301,6 +325,9 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
301
325
  slots: PropTypes.object,
302
326
  stroke: PropTypes.string,
303
327
  tickFontSize: PropTypes.number,
328
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
329
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
330
+ tickLabelStyle: PropTypes.object,
304
331
  tickMaxStep: PropTypes.number,
305
332
  tickMinStep: PropTypes.number,
306
333
  tickNumber: PropTypes.number,
@@ -319,6 +346,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
319
346
  id: PropTypes.string,
320
347
  label: PropTypes.string,
321
348
  labelFontSize: PropTypes.number,
349
+ labelStyle: PropTypes.object,
322
350
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
323
351
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
324
352
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
@@ -327,6 +355,9 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
327
355
  slots: PropTypes.object,
328
356
  stroke: PropTypes.string,
329
357
  tickFontSize: PropTypes.number,
358
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
359
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
360
+ tickLabelStyle: PropTypes.object,
330
361
  tickMaxStep: PropTypes.number,
331
362
  tickMinStep: PropTypes.number,
332
363
  tickNumber: PropTypes.number,
@@ -22,6 +22,16 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
22
22
  }
23
23
  return arcLabel(item);
24
24
  }
25
+ /**
26
+ * Demos:
27
+ *
28
+ * - [Pie](https://mui.com/x/react-charts/pie/)
29
+ * - [Pie demonstration](https://mui.com/x/react-charts/pie-demo/)
30
+ *
31
+ * API:
32
+ *
33
+ * - [PiePlot API](https://mui.com/x/api/charts/pie-plot/)
34
+ */
25
35
  function PiePlot(props) {
26
36
  const {
27
37
  slots,
@@ -103,10 +103,10 @@ export const ResponsiveChartContainer = /*#__PURE__*/React.forwardRef(function R
103
103
  width: inWidth,
104
104
  height: inHeight
105
105
  },
106
- children: /*#__PURE__*/_jsx(ChartContainer, _extends({}, other, {
106
+ children: width && height ? /*#__PURE__*/_jsx(ChartContainer, _extends({}, other, {
107
107
  width: width,
108
108
  height: height,
109
109
  ref: ref
110
- }))
110
+ })) : null
111
111
  });
112
112
  });
@@ -5,6 +5,16 @@ import { getValueToPositionMapper } from '../hooks/useScale';
5
5
  import { getIsFaded, getIsHighlighted, useInteractionItemProps } from '../hooks/useInteractionItemProps';
6
6
  import { InteractionContext } from '../context/InteractionProvider';
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
+ /**
9
+ * Demos:
10
+ *
11
+ * - [Scatter](https://mui.com/x/react-charts/scatter/)
12
+ * - [Scatter demonstration](https://mui.com/x/react-charts/scatter-demo/)
13
+ *
14
+ * API:
15
+ *
16
+ * - [Scatter API](https://mui.com/x/api/charts/scatter/)
17
+ */
8
18
  function Scatter(props) {
9
19
  const {
10
20
  series,