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