@mui/x-charts 6.0.0-alpha.9 → 6.18.0

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 (281) hide show
  1. package/BarChart/BarChart.d.ts +19 -5
  2. package/BarChart/BarChart.js +52 -13
  3. package/BarChart/BarElement.d.ts +1319 -4
  4. package/BarChart/BarElement.js +10 -10
  5. package/BarChart/BarPlot.d.ts +17 -1
  6. package/BarChart/BarPlot.js +152 -66
  7. package/BarChart/formatter.js +2 -3
  8. package/BarChart/legend.js +1 -2
  9. package/CHANGELOG.md +735 -55
  10. package/ChartContainer/index.js +7 -5
  11. package/ChartsAxis/ChartsAxis.d.ts +9 -0
  12. package/ChartsAxis/ChartsAxis.js +28 -2
  13. package/ChartsAxis/axisClasses.d.ts +1 -1
  14. package/ChartsAxis/axisClasses.js +1 -2
  15. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +21 -0
  16. package/ChartsAxisHighlight/ChartsAxisHighlight.js +61 -22
  17. package/ChartsClipPath/ChartsClipPath.d.ts +5 -0
  18. package/ChartsClipPath/ChartsClipPath.js +7 -2
  19. package/ChartsLegend/ChartsLegend.d.ts +44 -24
  20. package/ChartsLegend/ChartsLegend.js +192 -150
  21. package/ChartsLegend/chartsLegendClasses.js +1 -2
  22. package/ChartsLegend/utils.d.ts +1 -6
  23. package/ChartsSurface.d.ts +1 -1
  24. package/ChartsSurface.js +9 -18
  25. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -0
  26. package/ChartsTooltip/ChartsAxisTooltipContent.js +46 -32
  27. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +3 -2
  28. package/ChartsTooltip/ChartsItemTooltipContent.js +18 -9
  29. package/ChartsTooltip/ChartsTooltip.d.ts +32 -0
  30. package/ChartsTooltip/ChartsTooltip.js +62 -18
  31. package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -10
  32. package/ChartsTooltip/ChartsTooltipTable.js +22 -20
  33. package/ChartsTooltip/tooltipClasses.js +1 -2
  34. package/ChartsTooltip/utils.js +2 -2
  35. package/ChartsXAxis/ChartsXAxis.d.ts +9 -0
  36. package/ChartsXAxis/ChartsXAxis.js +161 -40
  37. package/ChartsYAxis/ChartsYAxis.d.ts +9 -0
  38. package/ChartsYAxis/ChartsYAxis.js +86 -33
  39. package/LineChart/AreaElement.d.ts +11 -1
  40. package/LineChart/AreaElement.js +14 -6
  41. package/LineChart/AreaPlot.d.ts +11 -0
  42. package/LineChart/AreaPlot.js +27 -8
  43. package/LineChart/LineChart.d.ts +16 -3
  44. package/LineChart/LineChart.js +48 -13
  45. package/LineChart/LineElement.d.ts +11 -1
  46. package/LineChart/LineElement.js +14 -6
  47. package/LineChart/LineHighlightElement.d.ts +10 -0
  48. package/LineChart/LineHighlightElement.js +13 -4
  49. package/LineChart/LineHighlightPlot.d.ts +10 -0
  50. package/LineChart/LineHighlightPlot.js +14 -3
  51. package/LineChart/LinePlot.d.ts +10 -0
  52. package/LineChart/LinePlot.js +25 -12
  53. package/LineChart/MarkElement.d.ts +10 -0
  54. package/LineChart/MarkElement.js +14 -5
  55. package/LineChart/MarkPlot.d.ts +10 -0
  56. package/LineChart/MarkPlot.js +40 -9
  57. package/LineChart/formatter.js +5 -5
  58. package/LineChart/legend.js +1 -2
  59. package/PieChart/PieArc.d.ts +11 -13
  60. package/PieChart/PieArc.js +28 -60
  61. package/PieChart/PieArcLabel.d.ts +8 -9
  62. package/PieChart/PieArcLabel.js +46 -38
  63. package/PieChart/PieArcLabelPlot.d.ts +28 -0
  64. package/PieChart/PieArcLabelPlot.js +99 -0
  65. package/PieChart/PieArcPlot.d.ts +35 -0
  66. package/PieChart/PieArcPlot.js +92 -0
  67. package/PieChart/PieChart.d.ts +19 -5
  68. package/PieChart/PieChart.js +61 -14
  69. package/PieChart/PiePlot.d.ts +15 -9
  70. package/PieChart/PiePlot.js +77 -55
  71. package/PieChart/dataTransform/transition.d.ts +4 -0
  72. package/PieChart/dataTransform/transition.js +136 -0
  73. package/PieChart/dataTransform/useTransformData.d.ts +15 -0
  74. package/PieChart/dataTransform/useTransformData.js +67 -0
  75. package/PieChart/formatter.js +1 -2
  76. package/PieChart/legend.js +1 -2
  77. package/README.md +8 -14
  78. package/ResponsiveChartContainer/index.js +7 -8
  79. package/ScatterChart/Scatter.d.ts +10 -0
  80. package/ScatterChart/Scatter.js +12 -2
  81. package/ScatterChart/ScatterChart.d.ts +16 -3
  82. package/ScatterChart/ScatterChart.js +43 -12
  83. package/ScatterChart/ScatterPlot.d.ts +10 -0
  84. package/ScatterChart/ScatterPlot.js +12 -2
  85. package/ScatterChart/formatter.js +1 -2
  86. package/ScatterChart/legend.js +1 -2
  87. package/SparkLineChart/SparkLineChart.d.ts +12 -3
  88. package/SparkLineChart/SparkLineChart.js +28 -7
  89. package/colorPalettes/colorPalettes.js +6 -12
  90. package/constants.js +5 -8
  91. package/context/CartesianContextProvider.d.ts +5 -0
  92. package/context/CartesianContextProvider.js +31 -16
  93. package/context/DrawingProvider.d.ts +7 -0
  94. package/context/DrawingProvider.js +12 -6
  95. package/context/HighlightProvider.js +3 -4
  96. package/context/InteractionProvider.js +3 -4
  97. package/context/SeriesContextProvider.js +3 -4
  98. package/esm/BarChart/BarChart.js +49 -9
  99. package/esm/BarChart/BarElement.js +7 -4
  100. package/esm/BarChart/BarPlot.js +152 -67
  101. package/esm/BarChart/formatter.js +1 -1
  102. package/esm/ChartContainer/index.js +3 -0
  103. package/esm/ChartsAxis/ChartsAxis.js +26 -0
  104. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
  105. package/esm/ChartsClipPath/ChartsClipPath.js +5 -0
  106. package/esm/ChartsLegend/ChartsLegend.js +188 -142
  107. package/esm/ChartsSurface.js +4 -12
  108. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +44 -30
  109. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
  110. package/esm/ChartsTooltip/ChartsTooltip.js +59 -14
  111. package/esm/ChartsTooltip/ChartsTooltipTable.js +17 -10
  112. package/esm/ChartsXAxis/ChartsXAxis.js +158 -37
  113. package/esm/ChartsYAxis/ChartsYAxis.js +83 -30
  114. package/esm/LineChart/AreaElement.js +10 -0
  115. package/esm/LineChart/AreaPlot.js +26 -6
  116. package/esm/LineChart/LineChart.js +45 -9
  117. package/esm/LineChart/LineElement.js +10 -0
  118. package/esm/LineChart/LineHighlightElement.js +10 -0
  119. package/esm/LineChart/LineHighlightPlot.js +12 -1
  120. package/esm/LineChart/LinePlot.js +25 -14
  121. package/esm/LineChart/MarkElement.js +11 -1
  122. package/esm/LineChart/MarkPlot.js +38 -7
  123. package/esm/LineChart/formatter.js +7 -3
  124. package/esm/PieChart/PieArc.js +26 -58
  125. package/esm/PieChart/PieArcLabel.js +43 -34
  126. package/esm/PieChart/PieArcLabelPlot.js +92 -0
  127. package/esm/PieChart/PieArcPlot.js +84 -0
  128. package/esm/PieChart/PieChart.js +59 -12
  129. package/esm/PieChart/PiePlot.js +76 -57
  130. package/esm/PieChart/dataTransform/transition.js +130 -0
  131. package/esm/PieChart/dataTransform/useTransformData.js +59 -0
  132. package/esm/ResponsiveChartContainer/index.js +3 -3
  133. package/esm/ScatterChart/Scatter.js +10 -0
  134. package/esm/ScatterChart/ScatterChart.js +40 -8
  135. package/esm/ScatterChart/ScatterPlot.js +10 -0
  136. package/esm/SparkLineChart/SparkLineChart.js +25 -3
  137. package/esm/constants.js +1 -1
  138. package/esm/context/CartesianContextProvider.js +30 -14
  139. package/esm/context/DrawingProvider.js +8 -0
  140. package/esm/hooks/useChartDimensions.js +2 -0
  141. package/esm/hooks/useMounted.js +16 -0
  142. package/esm/hooks/useReducedMotion.js +27 -0
  143. package/esm/hooks/useTicks.js +15 -9
  144. package/esm/internals/components/AxisSharedComponents.js +15 -70
  145. package/esm/internals/components/ChartsText.js +77 -0
  146. package/esm/internals/domUtils.js +113 -0
  147. package/esm/internals/geometry.js +36 -0
  148. package/hooks/useAxisEvents.js +2 -2
  149. package/hooks/useChartDimensions.d.ts +2 -0
  150. package/hooks/useChartDimensions.js +5 -4
  151. package/hooks/useDrawingArea.js +2 -2
  152. package/hooks/useInteractionItemProps.js +2 -2
  153. package/hooks/useMounted.d.ts +1 -0
  154. package/hooks/useMounted.js +25 -0
  155. package/hooks/useReducedMotion.d.ts +8 -0
  156. package/hooks/useReducedMotion.js +33 -0
  157. package/hooks/useScale.d.ts +2 -2
  158. package/hooks/useScale.js +2 -2
  159. package/hooks/useTicks.d.ts +19 -11
  160. package/hooks/useTicks.js +19 -14
  161. package/index.js +1 -1
  162. package/internals/components/AxisSharedComponents.d.ts +0 -4
  163. package/internals/components/AxisSharedComponents.js +18 -78
  164. package/internals/components/ChartsText.d.ts +35 -0
  165. package/internals/components/ChartsText.js +87 -0
  166. package/internals/defaultizeColor.d.ts +7 -2
  167. package/internals/defaultizeValueFormatter.js +1 -2
  168. package/internals/domUtils.d.ts +13 -0
  169. package/internals/domUtils.js +122 -0
  170. package/internals/geometry.d.ts +9 -0
  171. package/internals/geometry.js +42 -0
  172. package/internals/stackSeries.js +2 -4
  173. package/legacy/BarChart/BarChart.js +49 -9
  174. package/legacy/BarChart/BarElement.js +6 -3
  175. package/legacy/BarChart/BarPlot.js +151 -63
  176. package/legacy/BarChart/formatter.js +1 -1
  177. package/legacy/ChartContainer/index.js +3 -0
  178. package/legacy/ChartsAxis/ChartsAxis.js +26 -0
  179. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -20
  180. package/legacy/ChartsClipPath/ChartsClipPath.js +5 -0
  181. package/legacy/ChartsLegend/ChartsLegend.js +203 -140
  182. package/legacy/ChartsSurface.js +3 -12
  183. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +22 -10
  184. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
  185. package/legacy/ChartsTooltip/ChartsTooltip.js +62 -14
  186. package/legacy/ChartsTooltip/ChartsTooltipTable.js +34 -26
  187. package/legacy/ChartsXAxis/ChartsXAxis.js +162 -39
  188. package/legacy/ChartsYAxis/ChartsYAxis.js +83 -30
  189. package/legacy/LineChart/AreaElement.js +10 -0
  190. package/legacy/LineChart/AreaPlot.js +31 -7
  191. package/legacy/LineChart/LineChart.js +45 -9
  192. package/legacy/LineChart/LineElement.js +10 -0
  193. package/legacy/LineChart/LineHighlightElement.js +10 -0
  194. package/legacy/LineChart/LineHighlightPlot.js +12 -1
  195. package/legacy/LineChart/LinePlot.js +29 -12
  196. package/legacy/LineChart/MarkElement.js +11 -1
  197. package/legacy/LineChart/MarkPlot.js +37 -7
  198. package/legacy/LineChart/formatter.js +7 -3
  199. package/legacy/PieChart/PieArc.js +30 -62
  200. package/legacy/PieChart/PieArcLabel.js +48 -34
  201. package/legacy/PieChart/PieArcLabelPlot.js +93 -0
  202. package/legacy/PieChart/PieArcPlot.js +84 -0
  203. package/legacy/PieChart/PieChart.js +59 -12
  204. package/legacy/PieChart/PiePlot.js +76 -59
  205. package/legacy/PieChart/dataTransform/transition.js +142 -0
  206. package/legacy/PieChart/dataTransform/useTransformData.js +60 -0
  207. package/legacy/ResponsiveChartContainer/index.js +3 -3
  208. package/legacy/ScatterChart/Scatter.js +10 -0
  209. package/legacy/ScatterChart/ScatterChart.js +40 -8
  210. package/legacy/ScatterChart/ScatterPlot.js +10 -0
  211. package/legacy/SparkLineChart/SparkLineChart.js +25 -3
  212. package/legacy/constants.js +1 -1
  213. package/legacy/context/CartesianContextProvider.js +30 -14
  214. package/legacy/context/DrawingProvider.js +8 -0
  215. package/legacy/hooks/useChartDimensions.js +2 -0
  216. package/legacy/hooks/useMounted.js +21 -0
  217. package/legacy/hooks/useReducedMotion.js +27 -0
  218. package/legacy/hooks/useTicks.js +16 -9
  219. package/legacy/index.js +1 -1
  220. package/legacy/internals/components/AxisSharedComponents.js +11 -65
  221. package/legacy/internals/components/ChartsText.js +79 -0
  222. package/legacy/internals/domUtils.js +121 -0
  223. package/legacy/internals/geometry.js +37 -0
  224. package/models/axis.d.ts +27 -9
  225. package/models/layout.d.ts +7 -6
  226. package/models/seriesType/line.d.ts +8 -3
  227. package/models/seriesType/pie.d.ts +5 -1
  228. package/modern/BarChart/BarChart.js +49 -9
  229. package/modern/BarChart/BarElement.js +7 -4
  230. package/modern/BarChart/BarPlot.js +149 -65
  231. package/modern/BarChart/formatter.js +1 -1
  232. package/modern/ChartContainer/index.js +3 -0
  233. package/modern/ChartsAxis/ChartsAxis.js +26 -0
  234. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
  235. package/modern/ChartsClipPath/ChartsClipPath.js +5 -0
  236. package/modern/ChartsLegend/ChartsLegend.js +188 -142
  237. package/modern/ChartsSurface.js +4 -12
  238. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +44 -30
  239. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
  240. package/modern/ChartsTooltip/ChartsTooltip.js +58 -14
  241. package/modern/ChartsTooltip/ChartsTooltipTable.js +17 -10
  242. package/modern/ChartsXAxis/ChartsXAxis.js +158 -37
  243. package/modern/ChartsYAxis/ChartsYAxis.js +83 -30
  244. package/modern/LineChart/AreaElement.js +10 -0
  245. package/modern/LineChart/AreaPlot.js +25 -6
  246. package/modern/LineChart/LineChart.js +45 -9
  247. package/modern/LineChart/LineElement.js +10 -0
  248. package/modern/LineChart/LineHighlightElement.js +10 -0
  249. package/modern/LineChart/LineHighlightPlot.js +12 -1
  250. package/modern/LineChart/LinePlot.js +23 -10
  251. package/modern/LineChart/MarkElement.js +11 -1
  252. package/modern/LineChart/MarkPlot.js +38 -7
  253. package/modern/LineChart/formatter.js +4 -3
  254. package/modern/PieChart/PieArc.js +26 -57
  255. package/modern/PieChart/PieArcLabel.js +43 -34
  256. package/modern/PieChart/PieArcLabelPlot.js +90 -0
  257. package/modern/PieChart/PieArcPlot.js +83 -0
  258. package/modern/PieChart/PieChart.js +59 -12
  259. package/modern/PieChart/PiePlot.js +76 -55
  260. package/modern/PieChart/dataTransform/transition.js +130 -0
  261. package/modern/PieChart/dataTransform/useTransformData.js +58 -0
  262. package/modern/ResponsiveChartContainer/index.js +3 -3
  263. package/modern/ScatterChart/Scatter.js +10 -0
  264. package/modern/ScatterChart/ScatterChart.js +40 -8
  265. package/modern/ScatterChart/ScatterPlot.js +10 -0
  266. package/modern/SparkLineChart/SparkLineChart.js +25 -3
  267. package/modern/constants.js +1 -1
  268. package/modern/context/CartesianContextProvider.js +29 -13
  269. package/modern/context/DrawingProvider.js +8 -0
  270. package/modern/hooks/useChartDimensions.js +2 -0
  271. package/modern/hooks/useMounted.js +16 -0
  272. package/modern/hooks/useReducedMotion.js +27 -0
  273. package/modern/hooks/useTicks.js +15 -9
  274. package/modern/index.js +1 -1
  275. package/modern/internals/components/AxisSharedComponents.js +15 -70
  276. package/modern/internals/components/ChartsText.js +77 -0
  277. package/modern/internals/domUtils.js +113 -0
  278. package/modern/internals/geometry.js +36 -0
  279. package/package.json +9 -6
  280. package/themeAugmentation/components.d.ts +1 -0
  281. package/themeAugmentation/overrides.d.ts +2 -0
@@ -17,8 +17,19 @@ var _useScale = require("../hooks/useScale");
17
17
  var _getCurve = _interopRequireDefault(require("../internals/getCurve"));
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
19
  const _excluded = ["slots", "slotProps"];
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
+ /**
23
+ * Demos:
24
+ *
25
+ * - [Lines](https://mui.com/x/react-charts/lines/)
26
+ * - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
27
+ * - [Stacking](https://mui.com/x/react-charts/stacking/)
28
+ *
29
+ * API:
30
+ *
31
+ * - [AreaPlot API](https://mui.com/x/api/charts/area-plot/)
32
+ */
22
33
  function AreaPlot(props) {
23
34
  const {
24
35
  slots,
@@ -50,20 +61,28 @@ function AreaPlot(props) {
50
61
  const {
51
62
  xAxisKey = defaultXAxisId,
52
63
  yAxisKey = defaultYAxisId,
53
- stackedData
64
+ stackedData,
65
+ data,
66
+ connectNulls
54
67
  } = series[seriesId];
55
68
  const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
56
69
  const yScale = yAxis[yAxisKey].scale;
57
70
  const xData = xAxis[xAxisKey].data;
58
- if (xData === undefined) {
59
- throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
71
+ if (process.env.NODE_ENV !== 'production') {
72
+ if (xData === undefined) {
73
+ throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
74
+ }
75
+ if (xData.length < stackedData.length) {
76
+ throw new Error(`MUI: data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
77
+ }
60
78
  }
61
- const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).y0(d => yScale(d.y[0])).y1(d => yScale(d.y[1]));
79
+ const areaPath = (0, _d3Shape.area)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => d.y && yScale(d.y[0])).y1(d => d.y && yScale(d.y[1]));
62
80
  const curve = (0, _getCurve.default)(series[seriesId].curve);
63
- const d3Data = xData?.map((x, index) => ({
81
+ const formattedData = xData?.map((x, index) => ({
64
82
  x,
65
83
  y: stackedData[index]
66
- }));
84
+ })) ?? [];
85
+ const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
67
86
  return !!series[seriesId].area && /*#__PURE__*/(0, _jsxRuntime.jsx)(_AreaElement.AreaElement, {
68
87
  id: seriesId,
69
88
  d: areaPath.curve(curve)(d3Data) || undefined,
@@ -6,19 +6,22 @@ import { MarkPlotSlotComponentProps, MarkPlotSlotsComponent } from './MarkPlot';
6
6
  import { ChartsAxisProps } from '../ChartsAxis/ChartsAxis';
7
7
  import { LineSeriesType } from '../models/seriesType/line';
8
8
  import { MakeOptional } from '../models/helpers';
9
- import { ChartsTooltipProps } from '../ChartsTooltip';
9
+ import { ChartsTooltipProps, ChartsTooltipSlotComponentProps, ChartsTooltipSlotsComponent } from '../ChartsTooltip';
10
10
  import { ChartsLegendProps, ChartsLegendSlotComponentProps, ChartsLegendSlotsComponent } from '../ChartsLegend';
11
11
  import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
12
12
  import { ChartsAxisSlotComponentProps, ChartsAxisSlotsComponent } from '../models/axis';
13
13
  import { LineHighlightPlotSlotsComponent, LineHighlightPlotSlotComponentProps } from './LineHighlightPlot';
14
- export interface LineChartSlotsComponent extends ChartsAxisSlotsComponent, AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, LineHighlightPlotSlotsComponent, ChartsLegendSlotsComponent {
14
+ export interface LineChartSlotsComponent extends ChartsAxisSlotsComponent, AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, LineHighlightPlotSlotsComponent, ChartsLegendSlotsComponent, ChartsTooltipSlotsComponent {
15
15
  }
16
- export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, LineHighlightPlotSlotComponentProps, ChartsLegendSlotComponentProps {
16
+ export interface LineChartSlotComponentProps extends ChartsAxisSlotComponentProps, AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, LineHighlightPlotSlotComponentProps, ChartsLegendSlotComponentProps, ChartsTooltipSlotComponentProps {
17
17
  }
18
18
  export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
19
19
  series: MakeOptional<LineSeriesType, 'type'>[];
20
20
  tooltip?: ChartsTooltipProps;
21
21
  axisHighlight?: ChartsAxisHighlightProps;
22
+ /**
23
+ * @deprecated Consider using `slotProps.legend` instead.
24
+ */
22
25
  legend?: ChartsLegendProps;
23
26
  /**
24
27
  * If `true`, render the line highlight item.
@@ -35,5 +38,15 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
35
38
  */
36
39
  slotProps?: LineChartSlotComponentProps;
37
40
  }
41
+ /**
42
+ * Demos:
43
+ *
44
+ * - [Lines](https://mui.com/x/react-charts/lines/)
45
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
46
+ *
47
+ * API:
48
+ *
49
+ * - [LineChart API](https://mui.com/x/api/charts/line-chart/)
50
+ */
38
51
  declare const LineChart: React.ForwardRefExoticComponent<LineChartProps & React.RefAttributes<unknown>>;
39
52
  export { LineChart };
@@ -21,9 +21,19 @@ var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
21
21
  var _ChartsClipPath = require("../ChartsClipPath");
22
22
  var _LineHighlightPlot = require("./LineHighlightPlot");
23
23
  var _jsxRuntime = require("react/jsx-runtime");
24
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
26
- const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
24
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
25
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
+ /**
27
+ * Demos:
28
+ *
29
+ * - [Lines](https://mui.com/x/react-charts/lines/)
30
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
31
+ *
32
+ * API:
33
+ *
34
+ * - [LineChart API](https://mui.com/x/api/charts/line-chart/)
35
+ */
36
+ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
27
37
  const {
28
38
  xAxis,
29
39
  yAxis,
@@ -96,12 +106,14 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
96
106
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
97
107
  slots: slots,
98
108
  slotProps: slotProps
99
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
109
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip, {
110
+ slots: slots,
111
+ slotProps: slotProps
112
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
100
113
  id: clipPathId
101
114
  }), children]
102
115
  });
103
116
  });
104
- exports.LineChart = LineChart;
105
117
  process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
106
118
  // ----------------------------- Warning --------------------------------
107
119
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -124,11 +136,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
124
136
  fill: _propTypes.default.string,
125
137
  label: _propTypes.default.string,
126
138
  labelFontSize: _propTypes.default.number,
139
+ labelStyle: _propTypes.default.object,
127
140
  position: _propTypes.default.oneOf(['bottom', 'top']),
128
141
  slotProps: _propTypes.default.object,
129
142
  slots: _propTypes.default.object,
130
143
  stroke: _propTypes.default.string,
131
144
  tickFontSize: _propTypes.default.number,
145
+ tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
146
+ tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
147
+ tickLabelStyle: _propTypes.default.object,
132
148
  tickMaxStep: _propTypes.default.number,
133
149
  tickMinStep: _propTypes.default.number,
134
150
  tickNumber: _propTypes.default.number,
@@ -161,33 +177,33 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
161
177
  fill: _propTypes.default.string,
162
178
  label: _propTypes.default.string,
163
179
  labelFontSize: _propTypes.default.number,
180
+ labelStyle: _propTypes.default.object,
164
181
  position: _propTypes.default.oneOf(['left', 'right']),
165
182
  slotProps: _propTypes.default.object,
166
183
  slots: _propTypes.default.object,
167
184
  stroke: _propTypes.default.string,
168
185
  tickFontSize: _propTypes.default.number,
186
+ tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
187
+ tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
188
+ tickLabelStyle: _propTypes.default.object,
169
189
  tickMaxStep: _propTypes.default.number,
170
190
  tickMinStep: _propTypes.default.number,
171
191
  tickNumber: _propTypes.default.number,
172
192
  tickSize: _propTypes.default.number
173
193
  }), _propTypes.default.string]),
194
+ /**
195
+ * @deprecated Consider using `slotProps.legend` instead.
196
+ */
174
197
  legend: _propTypes.default.shape({
175
198
  classes: _propTypes.default.object,
176
199
  direction: _propTypes.default.oneOf(['column', 'row']),
177
200
  hidden: _propTypes.default.bool,
178
- itemWidth: _propTypes.default.number,
179
- markSize: _propTypes.default.number,
180
- offset: _propTypes.default.shape({
181
- x: _propTypes.default.number,
182
- y: _propTypes.default.number
183
- }),
184
201
  position: _propTypes.default.shape({
185
202
  horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
186
203
  vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
187
204
  }),
188
205
  slotProps: _propTypes.default.object,
189
- slots: _propTypes.default.object,
190
- spacing: _propTypes.default.number
206
+ slots: _propTypes.default.object
191
207
  }),
192
208
  margin: _propTypes.default.shape({
193
209
  bottom: _propTypes.default.number,
@@ -208,11 +224,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
208
224
  fill: _propTypes.default.string,
209
225
  label: _propTypes.default.string,
210
226
  labelFontSize: _propTypes.default.number,
227
+ labelStyle: _propTypes.default.object,
211
228
  position: _propTypes.default.oneOf(['left', 'right']),
212
229
  slotProps: _propTypes.default.object,
213
230
  slots: _propTypes.default.object,
214
231
  stroke: _propTypes.default.string,
215
232
  tickFontSize: _propTypes.default.number,
233
+ tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
234
+ tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
235
+ tickLabelStyle: _propTypes.default.object,
216
236
  tickMaxStep: _propTypes.default.number,
217
237
  tickMinStep: _propTypes.default.number,
218
238
  tickNumber: _propTypes.default.number,
@@ -221,6 +241,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
221
241
  series: _propTypes.default.arrayOf(_propTypes.default.shape({
222
242
  area: _propTypes.default.bool,
223
243
  color: _propTypes.default.string,
244
+ connectNulls: _propTypes.default.bool,
224
245
  curve: _propTypes.default.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
225
246
  data: _propTypes.default.arrayOf(_propTypes.default.number),
226
247
  dataKey: _propTypes.default.string,
@@ -256,6 +277,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
256
277
  axisContent: _propTypes.default.elementType,
257
278
  classes: _propTypes.default.object,
258
279
  itemContent: _propTypes.default.elementType,
280
+ slotProps: _propTypes.default.object,
281
+ slots: _propTypes.default.object,
259
282
  trigger: _propTypes.default.oneOf(['axis', 'item', 'none'])
260
283
  }),
261
284
  /**
@@ -271,11 +294,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
271
294
  fill: _propTypes.default.string,
272
295
  label: _propTypes.default.string,
273
296
  labelFontSize: _propTypes.default.number,
297
+ labelStyle: _propTypes.default.object,
274
298
  position: _propTypes.default.oneOf(['bottom', 'top']),
275
299
  slotProps: _propTypes.default.object,
276
300
  slots: _propTypes.default.object,
277
301
  stroke: _propTypes.default.string,
278
302
  tickFontSize: _propTypes.default.number,
303
+ tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
304
+ tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
305
+ tickLabelStyle: _propTypes.default.object,
279
306
  tickMaxStep: _propTypes.default.number,
280
307
  tickMinStep: _propTypes.default.number,
281
308
  tickNumber: _propTypes.default.number,
@@ -300,6 +327,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
300
327
  id: _propTypes.default.string,
301
328
  label: _propTypes.default.string,
302
329
  labelFontSize: _propTypes.default.number,
330
+ labelStyle: _propTypes.default.object,
303
331
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
304
332
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
305
333
  position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
@@ -308,6 +336,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
308
336
  slots: _propTypes.default.object,
309
337
  stroke: _propTypes.default.string,
310
338
  tickFontSize: _propTypes.default.number,
339
+ tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
340
+ tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
341
+ tickLabelStyle: _propTypes.default.object,
311
342
  tickMaxStep: _propTypes.default.number,
312
343
  tickMinStep: _propTypes.default.number,
313
344
  tickNumber: _propTypes.default.number,
@@ -326,6 +357,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
326
357
  id: _propTypes.default.string,
327
358
  label: _propTypes.default.string,
328
359
  labelFontSize: _propTypes.default.number,
360
+ labelStyle: _propTypes.default.object,
329
361
  max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
330
362
  min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
331
363
  position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
@@ -334,6 +366,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
334
366
  slots: _propTypes.default.object,
335
367
  stroke: _propTypes.default.string,
336
368
  tickFontSize: _propTypes.default.number,
369
+ tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
370
+ tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
371
+ tickLabelStyle: _propTypes.default.object,
337
372
  tickMaxStep: _propTypes.default.number,
338
373
  tickMinStep: _propTypes.default.number,
339
374
  tickNumber: _propTypes.default.number,
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import { SlotComponentProps } from '@mui/base';
2
+ import { SlotComponentProps } from '@mui/base/utils';
3
3
  import { HighlightScope } from '../context/HighlightProvider';
4
4
  export interface LineElementClasses {
5
5
  /** Styles applied to the root element. */
@@ -43,6 +43,16 @@ export type LineElementProps = Omit<LineElementOwnerState, 'isFaded' | 'isHighli
43
43
  line?: React.ElementType;
44
44
  };
45
45
  };
46
+ /**
47
+ * Demos:
48
+ *
49
+ * - [Lines](https://mui.com/x/react-charts/lines/)
50
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
51
+ *
52
+ * API:
53
+ *
54
+ * - [LineElement API](https://mui.com/x/api/charts/line-element/)
55
+ */
46
56
  declare function LineElement(props: LineElementProps): React.JSX.Element;
47
57
  declare namespace LineElement {
48
58
  var propTypes: any;
@@ -22,13 +22,12 @@ var _InteractionProvider = require("../context/InteractionProvider");
22
22
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
23
23
  var _jsxRuntime = require("react/jsx-runtime");
24
24
  const _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps"];
25
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
26
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
25
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
26
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
27
27
  function getLineElementUtilityClass(slot) {
28
28
  return (0, _generateUtilityClass.default)('MuiLineElement', slot);
29
29
  }
30
- const lineElementClasses = (0, _generateUtilityClasses.default)('MuiLineElement', ['root', 'highlighted', 'faded']);
31
- exports.lineElementClasses = lineElementClasses;
30
+ const lineElementClasses = exports.lineElementClasses = (0, _generateUtilityClasses.default)('MuiLineElement', ['root', 'highlighted', 'faded']);
32
31
  const useUtilityClasses = ownerState => {
33
32
  const {
34
33
  classes,
@@ -41,7 +40,7 @@ const useUtilityClasses = ownerState => {
41
40
  };
42
41
  return (0, _composeClasses.default)(slots, getLineElementUtilityClass, classes);
43
42
  };
44
- const LineElementPath = (0, _styles.styled)('path', {
43
+ const LineElementPath = exports.LineElementPath = (0, _styles.styled)('path', {
45
44
  name: 'MuiLineElement',
46
45
  slot: 'Root',
47
46
  overridesResolver: (_, styles) => styles.root
@@ -55,7 +54,6 @@ const LineElementPath = (0, _styles.styled)('path', {
55
54
  transition: 'opacity 0.2s ease-in, stroke 0.2s ease-in',
56
55
  opacity: ownerState.isFaded ? 0.3 : 1
57
56
  }));
58
- exports.LineElementPath = LineElementPath;
59
57
  LineElementPath.propTypes = {
60
58
  // ----------------------------- Warning --------------------------------
61
59
  // | These PropTypes are generated from the TypeScript type definitions |
@@ -71,6 +69,16 @@ LineElementPath.propTypes = {
71
69
  }).isRequired,
72
70
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
73
71
  };
72
+ /**
73
+ * Demos:
74
+ *
75
+ * - [Lines](https://mui.com/x/react-charts/lines/)
76
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
77
+ *
78
+ * API:
79
+ *
80
+ * - [LineElement API](https://mui.com/x/api/charts/line-element/)
81
+ */
74
82
  function LineElement(props) {
75
83
  const {
76
84
  id,
@@ -14,6 +14,16 @@ interface LineHighlightElementOwnerState {
14
14
  export declare function getHighlightElementUtilityClass(slot: string): string;
15
15
  export declare const lineHighlightElementClasses: LineHighlightElementClasses;
16
16
  export type LineHighlightElementProps = LineHighlightElementOwnerState & React.ComponentPropsWithoutRef<'circle'> & {};
17
+ /**
18
+ * Demos:
19
+ *
20
+ * - [Lines](https://mui.com/x/react-charts/lines/)
21
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
22
+ *
23
+ * API:
24
+ *
25
+ * - [LineHighlightElement API](https://mui.com/x/api/charts/line-highlight-element/)
26
+ */
17
27
  declare function LineHighlightElement(props: LineHighlightElementProps): React.JSX.Element;
18
28
  declare namespace LineHighlightElement {
19
29
  var propTypes: any;
@@ -17,13 +17,12 @@ var _styles = require("@mui/material/styles");
17
17
  var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
19
  const _excluded = ["x", "y", "id", "classes", "color"];
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
22
  function getHighlightElementUtilityClass(slot) {
23
23
  return (0, _generateUtilityClass.default)('MuiHighlightElement', slot);
24
24
  }
25
- const lineHighlightElementClasses = (0, _generateUtilityClasses.default)('MuiHighlightElement', ['root']);
26
- exports.lineHighlightElementClasses = lineHighlightElementClasses;
25
+ const lineHighlightElementClasses = exports.lineHighlightElementClasses = (0, _generateUtilityClasses.default)('MuiHighlightElement', ['root']);
27
26
  const useUtilityClasses = ownerState => {
28
27
  const {
29
28
  classes,
@@ -45,6 +44,16 @@ const HighlightElement = (0, _styles.styled)('circle', {
45
44
  transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
46
45
  fill: ownerState.color
47
46
  }));
47
+ /**
48
+ * Demos:
49
+ *
50
+ * - [Lines](https://mui.com/x/react-charts/lines/)
51
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
52
+ *
53
+ * API:
54
+ *
55
+ * - [LineHighlightElement API](https://mui.com/x/api/charts/line-highlight-element/)
56
+ */
48
57
  function LineHighlightElement(props) {
49
58
  const {
50
59
  x,
@@ -18,6 +18,16 @@ export interface LineHighlightPlotProps extends React.SVGAttributes<SVGSVGElemen
18
18
  */
19
19
  slotProps?: LineHighlightPlotSlotComponentProps;
20
20
  }
21
+ /**
22
+ * Demos:
23
+ *
24
+ * - [Lines](https://mui.com/x/react-charts/lines/)
25
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
26
+ *
27
+ * API:
28
+ *
29
+ * - [LineHighlightPlot API](https://mui.com/x/api/charts/line-highlight-plot/)
30
+ */
21
31
  declare function LineHighlightPlot(props: LineHighlightPlotProps): React.JSX.Element | null;
22
32
  declare namespace LineHighlightPlot {
23
33
  var propTypes: any;
@@ -16,8 +16,18 @@ var _useScale = require("../hooks/useScale");
16
16
  var _InteractionProvider = require("../context/InteractionProvider");
17
17
  var _jsxRuntime = require("react/jsx-runtime");
18
18
  const _excluded = ["slots", "slotProps"];
19
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
19
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
20
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
21
+ /**
22
+ * Demos:
23
+ *
24
+ * - [Lines](https://mui.com/x/react-charts/lines/)
25
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
26
+ *
27
+ * API:
28
+ *
29
+ * - [LineHighlightPlot API](https://mui.com/x/api/charts/line-highlight-plot/)
30
+ */
21
31
  function LineHighlightPlot(props) {
22
32
  const {
23
33
  slots,
@@ -58,9 +68,10 @@ function LineHighlightPlot(props) {
58
68
  xAxisKey = defaultXAxisId,
59
69
  yAxisKey = defaultYAxisId,
60
70
  stackedData,
71
+ data,
61
72
  disableHighlight
62
73
  } = series[seriesId];
63
- if (disableHighlight) {
74
+ if (disableHighlight || data[highlightedIndex] == null) {
64
75
  return null;
65
76
  }
66
77
  const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
@@ -8,6 +8,16 @@ export interface LinePlotSlotComponentProps {
8
8
  }
9
9
  export interface LinePlotProps extends React.SVGAttributes<SVGSVGElement>, Pick<LineElementProps, 'slots' | 'slotProps'> {
10
10
  }
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
+ * - [LinePlot API](https://mui.com/x/api/charts/line-plot/)
20
+ */
11
21
  declare function LinePlot(props: LinePlotProps): React.JSX.Element | null;
12
22
  declare namespace LinePlot {
13
23
  var propTypes: any;
@@ -17,8 +17,18 @@ var _useScale = require("../hooks/useScale");
17
17
  var _getCurve = _interopRequireDefault(require("../internals/getCurve"));
18
18
  var _jsxRuntime = require("react/jsx-runtime");
19
19
  const _excluded = ["slots", "slotProps"];
20
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
21
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
20
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
22
+ /**
23
+ * Demos:
24
+ *
25
+ * - [Lines](https://mui.com/x/react-charts/lines/)
26
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
27
+ *
28
+ * API:
29
+ *
30
+ * - [LinePlot API](https://mui.com/x/api/charts/line-plot/)
31
+ */
22
32
  function LinePlot(props) {
23
33
  const {
24
34
  slots,
@@ -50,25 +60,28 @@ function LinePlot(props) {
50
60
  const {
51
61
  xAxisKey = defaultXAxisId,
52
62
  yAxisKey = defaultYAxisId,
53
- stackedData
63
+ stackedData,
64
+ data,
65
+ connectNulls
54
66
  } = series[seriesId];
55
67
  const xScale = (0, _useScale.getValueToPositionMapper)(xAxis[xAxisKey].scale);
56
68
  const yScale = yAxis[yAxisKey].scale;
57
69
  const xData = xAxis[xAxisKey].data;
58
- if (xData === undefined) {
59
- throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
60
- }
61
- const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).y(d => yScale(d.y[1]));
62
70
  if (process.env.NODE_ENV !== 'production') {
63
- if (xData.length !== stackedData.length) {
64
- throw new Error(`MUI: data length of the x axis (${xData.length} items) does not match length of series (${stackedData.length} items)`);
71
+ if (xData === undefined) {
72
+ throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
73
+ }
74
+ if (xData.length < stackedData.length) {
75
+ throw new Error(`MUI: data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
65
76
  }
66
77
  }
78
+ const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
67
79
  const curve = (0, _getCurve.default)(series[seriesId].curve);
68
- const d3Data = xData?.map((x, index) => ({
80
+ const formattedData = xData?.map((x, index) => ({
69
81
  x,
70
- y: stackedData[index] ?? [0, 0]
71
- }));
82
+ y: stackedData[index]
83
+ })) ?? [];
84
+ const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
72
85
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineElement.LineElement, {
73
86
  id: seriesId,
74
87
  d: linePath.curve(curve)(d3Data) || undefined,
@@ -31,6 +31,16 @@ export type MarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighli
31
31
  dataIndex: number;
32
32
  highlightScope?: Partial<HighlightScope>;
33
33
  };
34
+ /**
35
+ * Demos:
36
+ *
37
+ * - [Lines](https://mui.com/x/react-charts/lines/)
38
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
39
+ *
40
+ * API:
41
+ *
42
+ * - [MarkElement API](https://mui.com/x/api/charts/mark-element/)
43
+ */
34
44
  declare function MarkElement(props: MarkElementProps): React.JSX.Element;
35
45
  declare namespace MarkElement {
36
46
  var propTypes: any;
@@ -21,13 +21,12 @@ var _InteractionProvider = require("../context/InteractionProvider");
21
21
  var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
22
22
  var _jsxRuntime = require("react/jsx-runtime");
23
23
  const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "highlightScope"];
24
- function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
25
- function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
24
+ function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
25
+ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
26
26
  function getMarkElementUtilityClass(slot) {
27
27
  return (0, _generateUtilityClass.default)('MuiMarkElement', slot);
28
28
  }
29
- const markElementClasses = (0, _generateUtilityClasses.default)('MuiMarkElement', ['root', 'highlighted', 'faded']);
30
- exports.markElementClasses = markElementClasses;
29
+ const markElementClasses = exports.markElementClasses = (0, _generateUtilityClasses.default)('MuiMarkElement', ['root', 'highlighted', 'faded']);
31
30
  const useUtilityClasses = ownerState => {
32
31
  const {
33
32
  classes,
@@ -50,7 +49,7 @@ const MarkElementPath = (0, _styles.styled)('path', {
50
49
  }) => ({
51
50
  transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
52
51
  transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
53
- fill: theme.palette.background.paper,
52
+ fill: (theme.vars || theme).palette.background.paper,
54
53
  stroke: ownerState.color,
55
54
  strokeWidth: 2
56
55
  }));
@@ -71,6 +70,16 @@ MarkElementPath.propTypes = {
71
70
  }).isRequired,
72
71
  sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
73
72
  };
73
+ /**
74
+ * Demos:
75
+ *
76
+ * - [Lines](https://mui.com/x/react-charts/lines/)
77
+ * - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
78
+ *
79
+ * API:
80
+ *
81
+ * - [MarkElement API](https://mui.com/x/api/charts/mark-element/)
82
+ */
74
83
  function MarkElement(props) {
75
84
  const {
76
85
  x,