@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
@@ -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";
@@ -35,6 +37,16 @@ const defaultProps = {
35
37
  labelFontSize: 14,
36
38
  tickSize: 6
37
39
  };
40
+
41
+ /**
42
+ * Demos:
43
+ *
44
+ * - [Axis](https://mui.com/x/react-charts/axis/)
45
+ *
46
+ * API:
47
+ *
48
+ * - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
49
+ */
38
50
  function ChartsYAxis(inProps) {
39
51
  var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
40
52
  const props = useThemeProps({
@@ -47,7 +59,7 @@ function ChartsYAxis(inProps) {
47
59
  yAxis: {
48
60
  [_props$axisId]: {
49
61
  scale: yScale,
50
- ticksNumber
62
+ tickNumber
51
63
  }
52
64
  }
53
65
  } = _React$useContext,
@@ -78,18 +90,44 @@ function ChartsYAxis(inProps) {
78
90
  const tickSize = disableTicks ? 4 : tickSizeProp;
79
91
  const yTicks = useTicks({
80
92
  scale: yScale,
81
- ticksNumber,
93
+ tickNumber,
82
94
  valueFormatter
83
95
  });
84
- const positionSigne = position === 'right' ? 1 : -1;
96
+ const positionSign = position === 'right' ? 1 : -1;
85
97
  const labelRefPoint = {
86
- x: positionSigne * (tickFontSize + tickSize + 10),
98
+ x: positionSign * (tickFontSize + tickSize + 10),
87
99
  y: top + height / 2
88
100
  };
89
- const Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
90
- const Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
91
- const TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
92
- const Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
101
+ const Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : 'line';
102
+ const Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : 'line';
103
+ const TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsText;
104
+ const Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsText;
105
+ const axisTickLabelProps = useSlotProps({
106
+ elementType: TickLabel,
107
+ externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
108
+ additionalProps: {
109
+ style: {
110
+ fontSize: tickFontSize,
111
+ textAnchor: position === 'right' ? 'start' : 'end',
112
+ dominantBaseline: 'central'
113
+ },
114
+ className: classes.tickLabel
115
+ },
116
+ ownerState: {}
117
+ });
118
+ const axisLabelProps = useSlotProps({
119
+ elementType: Label,
120
+ externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
121
+ additionalProps: {
122
+ style: {
123
+ fontSize: labelFontSize,
124
+ angle: positionSign * 90,
125
+ textAnchor: 'middle',
126
+ dominantBaseline: 'auto'
127
+ }
128
+ },
129
+ ownerState: {}
130
+ });
93
131
  return /*#__PURE__*/_jsxs(AxisRoot, {
94
132
  transform: `translate(${position === 'right' ? left + width : left}, 0)`,
95
133
  className: classes.root,
@@ -102,36 +140,26 @@ function ChartsYAxis(inProps) {
102
140
  offset,
103
141
  labelOffset
104
142
  }, index) => {
105
- const xTickLabel = positionSigne * (tickSize + 2);
143
+ const xTickLabel = positionSign * (tickSize + 2);
106
144
  const yTickLabel = labelOffset;
107
145
  return /*#__PURE__*/_jsxs("g", {
108
146
  transform: `translate(0, ${offset})`,
109
147
  className: classes.tickContainer,
110
148
  children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
111
- x2: positionSigne * tickSize,
149
+ x2: positionSign * tickSize,
112
150
  className: classes.tick
113
151
  }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
114
152
  x: xTickLabel,
115
153
  y: yTickLabel,
116
- "transform-origin": `${xTickLabel}px ${yTickLabel}px`,
117
- sx: {
118
- fontSize: tickFontSize
119
- },
120
- className: classes.tickLabel
121
- }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
122
- children: formattedValue.toLocaleString()
123
- }))]
154
+ text: formattedValue.toString()
155
+ }, axisTickLabelProps))]
124
156
  }, index);
125
- }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
126
- sx: {
127
- fontSize: labelFontSize,
128
- transform: `rotate(${positionSigne * 90}deg)`,
129
- transformOrigin: `${labelRefPoint.x}px ${labelRefPoint.y}px`
130
- },
131
- className: classes.label
132
- }, slotProps == null ? void 0 : slotProps.axisLabel, {
133
- children: label
134
- }))]
157
+ }), label && /*#__PURE__*/_jsx("g", {
158
+ className: classes.label,
159
+ children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
160
+ text: label
161
+ }))
162
+ })]
135
163
  });
136
164
  }
137
165
  process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
@@ -169,8 +197,13 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
169
197
  /**
170
198
  * The font size of the axis label.
171
199
  * @default 14
200
+ * @deprecated Consider using `labelStyle.fontSize` instead.
172
201
  */
173
202
  labelFontSize: PropTypes.number,
203
+ /**
204
+ * The style applied to the axis label.
205
+ */
206
+ labelStyle: PropTypes.object,
174
207
  /**
175
208
  * Position of the axis.
176
209
  */
@@ -193,8 +226,28 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
193
226
  /**
194
227
  * The font size of the axis ticks text.
195
228
  * @default 12
229
+ * @deprecated Consider using `tickLabelStyle.fontSize` instead.
196
230
  */
197
231
  tickFontSize: PropTypes.number,
232
+ /**
233
+ * Defines which ticks are displayed. Its value can be:
234
+ * - 'auto' In such case the ticks are computed based on axis scale and other parameters.
235
+ * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
236
+ * - an array containing the values where ticks should be displayed.
237
+ * @default 'auto'
238
+ */
239
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
240
+ /**
241
+ * Defines which ticks get its label displayed. Its value can be:
242
+ * - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
243
+ * - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
244
+ * @default 'auto'
245
+ */
246
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
247
+ /**
248
+ * The style applied to ticks text.
249
+ */
250
+ tickLabelStyle: PropTypes.object,
198
251
  /**
199
252
  * Maximal step between two ticks.
200
253
  * 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
  var _slots$area;
60
70
  const {
@@ -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,
@@ -38,23 +49,32 @@ function AreaPlot(props) {
38
49
  ids: groupIds
39
50
  }) => {
40
51
  return groupIds.flatMap(seriesId => {
52
+ var _xData$map;
41
53
  const {
42
54
  xAxisKey = defaultXAxisId,
43
55
  yAxisKey = defaultYAxisId,
44
- stackedData
56
+ stackedData,
57
+ data,
58
+ connectNulls
45
59
  } = series[seriesId];
46
60
  const xScale = getValueToPositionMapper(xAxis[xAxisKey].scale);
47
61
  const yScale = yAxis[yAxisKey].scale;
48
62
  const xData = xAxis[xAxisKey].data;
49
- if (xData === undefined) {
50
- throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
63
+ if (process.env.NODE_ENV !== 'production') {
64
+ if (xData === undefined) {
65
+ throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot.`);
66
+ }
67
+ if (xData.length < stackedData.length) {
68
+ throw new Error(`MUI: data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
69
+ }
51
70
  }
52
- const areaPath = d3Area().x(d => xScale(d.x)).y0(d => yScale(d.y[0])).y1(d => yScale(d.y[1]));
71
+ const areaPath = d3Area().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]));
53
72
  const curve = getCurveFactory(series[seriesId].curve);
54
- const d3Data = xData == null ? void 0 : xData.map((x, index) => ({
73
+ const formattedData = (_xData$map = xData == null ? void 0 : xData.map((x, index) => ({
55
74
  x,
56
75
  y: stackedData[index]
57
- }));
76
+ }))) != null ? _xData$map : [];
77
+ const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
58
78
  return !!series[seriesId].area && /*#__PURE__*/_jsx(AreaElement, {
59
79
  id: seriesId,
60
80
  d: areaPath.curve(curve)(d3Data) || undefined,
@@ -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,
@@ -91,7 +101,10 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
91
101
  }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
92
102
  slots: slots,
93
103
  slotProps: slotProps
94
- })), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
104
+ })), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
105
+ slots: slots,
106
+ slotProps: slotProps
107
+ })), /*#__PURE__*/_jsx(ChartsClipPath, {
95
108
  id: clipPathId
96
109
  }), children]
97
110
  });
@@ -118,11 +131,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
118
131
  fill: PropTypes.string,
119
132
  label: PropTypes.string,
120
133
  labelFontSize: PropTypes.number,
134
+ labelStyle: PropTypes.object,
121
135
  position: PropTypes.oneOf(['bottom', 'top']),
122
136
  slotProps: PropTypes.object,
123
137
  slots: PropTypes.object,
124
138
  stroke: PropTypes.string,
125
139
  tickFontSize: PropTypes.number,
140
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
141
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
142
+ tickLabelStyle: PropTypes.object,
126
143
  tickMaxStep: PropTypes.number,
127
144
  tickMinStep: PropTypes.number,
128
145
  tickNumber: PropTypes.number,
@@ -155,33 +172,33 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
155
172
  fill: PropTypes.string,
156
173
  label: PropTypes.string,
157
174
  labelFontSize: PropTypes.number,
175
+ labelStyle: PropTypes.object,
158
176
  position: PropTypes.oneOf(['left', 'right']),
159
177
  slotProps: PropTypes.object,
160
178
  slots: PropTypes.object,
161
179
  stroke: PropTypes.string,
162
180
  tickFontSize: PropTypes.number,
181
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
182
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
183
+ tickLabelStyle: PropTypes.object,
163
184
  tickMaxStep: PropTypes.number,
164
185
  tickMinStep: PropTypes.number,
165
186
  tickNumber: PropTypes.number,
166
187
  tickSize: PropTypes.number
167
188
  }), PropTypes.string]),
189
+ /**
190
+ * @deprecated Consider using `slotProps.legend` instead.
191
+ */
168
192
  legend: PropTypes.shape({
169
193
  classes: PropTypes.object,
170
194
  direction: PropTypes.oneOf(['column', 'row']),
171
195
  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
196
  position: PropTypes.shape({
179
197
  horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
180
198
  vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
181
199
  }),
182
200
  slotProps: PropTypes.object,
183
- slots: PropTypes.object,
184
- spacing: PropTypes.number
201
+ slots: PropTypes.object
185
202
  }),
186
203
  margin: PropTypes.shape({
187
204
  bottom: PropTypes.number,
@@ -202,11 +219,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
202
219
  fill: PropTypes.string,
203
220
  label: PropTypes.string,
204
221
  labelFontSize: PropTypes.number,
222
+ labelStyle: PropTypes.object,
205
223
  position: PropTypes.oneOf(['left', 'right']),
206
224
  slotProps: PropTypes.object,
207
225
  slots: PropTypes.object,
208
226
  stroke: PropTypes.string,
209
227
  tickFontSize: PropTypes.number,
228
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
229
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
230
+ tickLabelStyle: PropTypes.object,
210
231
  tickMaxStep: PropTypes.number,
211
232
  tickMinStep: PropTypes.number,
212
233
  tickNumber: PropTypes.number,
@@ -215,6 +236,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
215
236
  series: PropTypes.arrayOf(PropTypes.shape({
216
237
  area: PropTypes.bool,
217
238
  color: PropTypes.string,
239
+ connectNulls: PropTypes.bool,
218
240
  curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
219
241
  data: PropTypes.arrayOf(PropTypes.number),
220
242
  dataKey: PropTypes.string,
@@ -250,6 +272,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
250
272
  axisContent: PropTypes.elementType,
251
273
  classes: PropTypes.object,
252
274
  itemContent: PropTypes.elementType,
275
+ slotProps: PropTypes.object,
276
+ slots: PropTypes.object,
253
277
  trigger: PropTypes.oneOf(['axis', 'item', 'none'])
254
278
  }),
255
279
  /**
@@ -265,11 +289,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
265
289
  fill: PropTypes.string,
266
290
  label: PropTypes.string,
267
291
  labelFontSize: PropTypes.number,
292
+ labelStyle: PropTypes.object,
268
293
  position: PropTypes.oneOf(['bottom', 'top']),
269
294
  slotProps: PropTypes.object,
270
295
  slots: PropTypes.object,
271
296
  stroke: PropTypes.string,
272
297
  tickFontSize: PropTypes.number,
298
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
299
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
300
+ tickLabelStyle: PropTypes.object,
273
301
  tickMaxStep: PropTypes.number,
274
302
  tickMinStep: PropTypes.number,
275
303
  tickNumber: PropTypes.number,
@@ -294,6 +322,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
294
322
  id: PropTypes.string,
295
323
  label: PropTypes.string,
296
324
  labelFontSize: PropTypes.number,
325
+ labelStyle: PropTypes.object,
297
326
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
298
327
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
299
328
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
@@ -302,6 +331,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
302
331
  slots: PropTypes.object,
303
332
  stroke: PropTypes.string,
304
333
  tickFontSize: PropTypes.number,
334
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
335
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
336
+ tickLabelStyle: PropTypes.object,
305
337
  tickMaxStep: PropTypes.number,
306
338
  tickMinStep: PropTypes.number,
307
339
  tickNumber: PropTypes.number,
@@ -320,6 +352,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
320
352
  id: PropTypes.string,
321
353
  label: PropTypes.string,
322
354
  labelFontSize: PropTypes.number,
355
+ labelStyle: PropTypes.object,
323
356
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
324
357
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
325
358
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
@@ -328,6 +361,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
328
361
  slots: PropTypes.object,
329
362
  stroke: PropTypes.string,
330
363
  tickFontSize: PropTypes.number,
364
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
365
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
366
+ tickLabelStyle: PropTypes.object,
331
367
  tickMaxStep: PropTypes.number,
332
368
  tickMinStep: PropTypes.number,
333
369
  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
  var _slots$line;
62
72
  const {
@@ -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
  var _axis$x, _slots$lineHighlight;
14
24
  const {
@@ -50,9 +60,10 @@ function LineHighlightPlot(props) {
50
60
  xAxisKey = defaultXAxisId,
51
61
  yAxisKey = defaultYAxisId,
52
62
  stackedData,
63
+ data,
53
64
  disableHighlight
54
65
  } = series[seriesId];
55
- if (disableHighlight) {
66
+ if (disableHighlight || data[highlightedIndex] == null) {
56
67
  return null;
57
68
  }
58
69
  const xScale = getValueToPositionMapper(xAxis[xAxisKey].scale);
@@ -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,
@@ -38,31 +48,32 @@ function LinePlot(props) {
38
48
  ids: groupIds
39
49
  }) => {
40
50
  return groupIds.flatMap(seriesId => {
51
+ var _xData$map;
41
52
  const {
42
53
  xAxisKey = defaultXAxisId,
43
54
  yAxisKey = defaultYAxisId,
44
- stackedData
55
+ stackedData,
56
+ data,
57
+ connectNulls
45
58
  } = series[seriesId];
46
59
  const xScale = getValueToPositionMapper(xAxis[xAxisKey].scale);
47
60
  const yScale = yAxis[yAxisKey].scale;
48
61
  const xData = xAxis[xAxisKey].data;
49
- if (xData === undefined) {
50
- throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
51
- }
52
- const linePath = d3Line().x(d => xScale(d.x)).y(d => yScale(d.y[1]));
53
62
  if (process.env.NODE_ENV !== 'production') {
54
- if (xData.length !== stackedData.length) {
55
- throw new Error(`MUI: data length of the x axis (${xData.length} items) does not match length of series (${stackedData.length} items)`);
63
+ if (xData === undefined) {
64
+ throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
65
+ }
66
+ if (xData.length < stackedData.length) {
67
+ throw new Error(`MUI: data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items)`);
56
68
  }
57
69
  }
70
+ const linePath = d3Line().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
58
71
  const curve = getCurveFactory(series[seriesId].curve);
59
- const d3Data = xData == null ? void 0 : xData.map((x, index) => {
60
- var _stackedData$index;
61
- return {
62
- x,
63
- y: (_stackedData$index = stackedData[index]) != null ? _stackedData$index : [0, 0]
64
- };
65
- });
72
+ const formattedData = (_xData$map = xData == null ? void 0 : xData.map((x, index) => ({
73
+ x,
74
+ y: stackedData[index]
75
+ }))) != null ? _xData$map : [];
76
+ const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
66
77
  return /*#__PURE__*/_jsx(LineElement, {
67
78
  id: seriesId,
68
79
  d: linePath.curve(curve)(d3Data) || undefined,
@@ -38,7 +38,7 @@ const MarkElementPath = styled('path', {
38
38
  }) => ({
39
39
  transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
40
40
  transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
41
- fill: theme.palette.background.paper,
41
+ fill: (theme.vars || theme).palette.background.paper,
42
42
  stroke: ownerState.color,
43
43
  strokeWidth: 2
44
44
  }));
@@ -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
  var _axis$x;
64
74
  const {
@@ -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
  var _slots$mark;
13
23
  const {
@@ -42,6 +52,7 @@ function MarkPlot(props) {
42
52
  xAxisKey = defaultXAxisId,
43
53
  yAxisKey = defaultYAxisId,
44
54
  stackedData,
55
+ data,
45
56
  showMark = true
46
57
  } = series[seriesId];
47
58
  if (showMark === false) {
@@ -68,28 +79,48 @@ function MarkPlot(props) {
68
79
  throw new Error(`Axis of id "${xAxisKey}" should have data property to be able to display a line plot`);
69
80
  }
70
81
  return xData == null ? void 0 : xData.map((x, index) => {
71
- const y = stackedData[index][1];
82
+ const value = data[index] == null ? null : stackedData[index][1];
72
83
  return {
73
84
  x: xScale(x),
74
- y: yScale(y),
85
+ y: value === null ? null : yScale(value),
75
86
  position: x,
76
- value: y,
87
+ value,
77
88
  index
78
89
  };
79
- }).filter(isInRange).map(({
90
+ }).filter(({
80
91
  x,
81
92
  y,
82
93
  index,
83
94
  position,
84
95
  value
85
96
  }) => {
86
- return showMark === true || showMark({
97
+ if (value === null || y === null) {
98
+ // Remove missing data point
99
+ return false;
100
+ }
101
+ if (!isInRange({
102
+ x,
103
+ y
104
+ })) {
105
+ // Remove out of range
106
+ return false;
107
+ }
108
+ if (showMark === true) {
109
+ return true;
110
+ }
111
+ return showMark({
87
112
  x,
88
113
  y,
89
114
  index,
90
115
  position,
91
116
  value
92
- }) ? /*#__PURE__*/_jsx(Mark, _extends({
117
+ });
118
+ }).map(({
119
+ x,
120
+ y,
121
+ index
122
+ }) => {
123
+ return /*#__PURE__*/_jsx(Mark, _extends({
93
124
  id: seriesId,
94
125
  dataIndex: index,
95
126
  shape: "circle",
@@ -97,7 +128,7 @@ function MarkPlot(props) {
97
128
  x: x,
98
129
  y: y,
99
130
  highlightScope: series[seriesId].highlightScope
100
- }, slotProps == null ? void 0 : slotProps.mark), `${seriesId}-${index}`) : null;
131
+ }, slotProps == null ? void 0 : slotProps.mark), `${seriesId}-${index}`);
101
132
  });
102
133
  });
103
134
  })