@mui/x-charts 9.0.3 → 9.1.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 (191) hide show
  1. package/BarChart/BarChart.d.mts +1 -2
  2. package/BarChart/BarChart.d.ts +1 -2
  3. package/BarChart/BarChart.js +2 -913
  4. package/BarChart/BarChart.mjs +2 -913
  5. package/BarChart/FocusedBar.js +3 -0
  6. package/BarChart/FocusedBar.mjs +3 -0
  7. package/BarChart/seriesConfig/bar/seriesProcessor.js +2 -0
  8. package/BarChart/seriesConfig/bar/seriesProcessor.mjs +2 -0
  9. package/CHANGELOG.md +220 -0
  10. package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.d.mts +55 -0
  11. package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.d.ts +55 -0
  12. package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.js +94 -0
  13. package/ChartsAxisHighlightValue/ChartsAxisHighlightValue.mjs +88 -0
  14. package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.d.mts +13 -0
  15. package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.d.ts +13 -0
  16. package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.js +86 -0
  17. package/ChartsAxisHighlightValue/ChartsAxisHighlightValueItem.mjs +80 -0
  18. package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.d.mts +18 -0
  19. package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.d.ts +18 -0
  20. package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.js +26 -0
  21. package/ChartsAxisHighlightValue/chartsAxisHighlightValueClasses.mjs +16 -0
  22. package/ChartsAxisHighlightValue/index.d.mts +1 -0
  23. package/ChartsAxisHighlightValue/index.d.ts +1 -0
  24. package/ChartsAxisHighlightValue/index.js +16 -0
  25. package/ChartsAxisHighlightValue/index.mjs +1 -0
  26. package/ChartsAxisHighlightValue/useAxisHighlightValue.d.mts +14 -0
  27. package/ChartsAxisHighlightValue/useAxisHighlightValue.d.ts +14 -0
  28. package/ChartsAxisHighlightValue/useAxisHighlightValue.js +130 -0
  29. package/ChartsAxisHighlightValue/useAxisHighlightValue.mjs +124 -0
  30. package/ChartsContainer/ChartsContainer.js +4 -1431
  31. package/ChartsContainer/ChartsContainer.mjs +4 -1431
  32. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.d.mts +15 -0
  33. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.d.ts +15 -0
  34. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.js +56 -0
  35. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.mjs +50 -0
  36. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.mts +6 -0
  37. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.d.ts +6 -0
  38. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.js +5 -0
  39. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlight.types.mjs +1 -0
  40. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.d.mts +11 -0
  41. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.d.ts +11 -0
  42. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.js +70 -0
  43. package/ChartsRadialAxisHighlight/ChartsRadialAxisHighlightPath.mjs +64 -0
  44. package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.d.mts +9 -0
  45. package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.d.ts +9 -0
  46. package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.js +87 -0
  47. package/ChartsRadialAxisHighlight/ChartsRadiusAxisHighlight.mjs +81 -0
  48. package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.d.mts +9 -0
  49. package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.d.ts +9 -0
  50. package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.js +98 -0
  51. package/ChartsRadialAxisHighlight/ChartsRotationAxisHighlight.mjs +92 -0
  52. package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.d.mts +7 -0
  53. package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.d.ts +7 -0
  54. package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.js +14 -0
  55. package/ChartsRadialAxisHighlight/chartsRadialAxisHighlightClasses.mjs +6 -0
  56. package/ChartsRadialAxisHighlight/index.d.mts +5 -0
  57. package/ChartsRadialAxisHighlight/index.d.ts +5 -0
  58. package/ChartsRadialAxisHighlight/index.js +47 -0
  59. package/ChartsRadialAxisHighlight/index.mjs +4 -0
  60. package/ChartsRadiusAxis/index.d.mts +3 -2
  61. package/ChartsRadiusAxis/index.d.ts +3 -2
  62. package/ChartsRadiusAxis/index.mjs +3 -1
  63. package/ChartsRotationAxis/index.d.mts +3 -2
  64. package/ChartsRotationAxis/index.d.ts +3 -2
  65. package/ChartsRotationAxis/index.mjs +3 -1
  66. package/ChartsTooltip/useAxesTooltip.js +11 -3
  67. package/ChartsTooltip/useAxesTooltip.mjs +11 -3
  68. package/ChartsXAxis/useAxisTicksProps.d.mts +162 -81
  69. package/ChartsXAxis/useAxisTicksProps.d.ts +162 -81
  70. package/ChartsYAxis/useAxisTicksProps.d.mts +162 -81
  71. package/ChartsYAxis/useAxisTicksProps.d.ts +162 -81
  72. package/LICENSE +2 -0
  73. package/LineChart/FocusedLineMark.js +3 -0
  74. package/LineChart/FocusedLineMark.mjs +3 -0
  75. package/LineChart/LineChart.js +2 -913
  76. package/LineChart/LineChart.mjs +2 -913
  77. package/LineChart/seriesConfig/curveEvaluation.d.mts +19 -1
  78. package/LineChart/seriesConfig/curveEvaluation.d.ts +19 -1
  79. package/LineChart/seriesConfig/curveEvaluation.js +132 -0
  80. package/LineChart/seriesConfig/curveEvaluation.mjs +131 -0
  81. package/LineChart/seriesConfig/getItemAtPosition.js +12 -35
  82. package/LineChart/seriesConfig/getItemAtPosition.mjs +10 -33
  83. package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +2 -1
  84. package/LineChart/seriesConfig/getSeriesWithDefaultValues.mjs +2 -1
  85. package/LineChart/seriesConfig/seriesProcessor.js +4 -0
  86. package/LineChart/seriesConfig/seriesProcessor.mjs +4 -0
  87. package/LineChart/useAreaPlotData.js +4 -0
  88. package/LineChart/useAreaPlotData.mjs +4 -0
  89. package/LineChart/useLinePlotData.js +2 -0
  90. package/LineChart/useLinePlotData.mjs +2 -0
  91. package/LineChart/useMarkPlotData.js +2 -0
  92. package/LineChart/useMarkPlotData.mjs +2 -0
  93. package/PieChart/FocusedPieArc.js +3 -0
  94. package/PieChart/FocusedPieArc.mjs +3 -0
  95. package/RadarChart/FocusedRadarMark.js +3 -0
  96. package/RadarChart/FocusedRadarMark.mjs +3 -0
  97. package/ScatterChart/FocusedScatterMark.js +10 -21
  98. package/ScatterChart/FocusedScatterMark.mjs +10 -21
  99. package/ScatterChart/HighlightedScatterMark.d.mts +11 -0
  100. package/ScatterChart/HighlightedScatterMark.d.ts +11 -0
  101. package/ScatterChart/HighlightedScatterMark.js +68 -0
  102. package/ScatterChart/HighlightedScatterMark.mjs +62 -0
  103. package/ScatterChart/ScatterChart.d.mts +1 -2
  104. package/ScatterChart/ScatterChart.d.ts +1 -2
  105. package/ScatterChart/ScatterChart.js +2 -913
  106. package/ScatterChart/ScatterChart.mjs +2 -913
  107. package/ScatterChart/index.d.mts +1 -0
  108. package/ScatterChart/index.d.ts +1 -0
  109. package/ScatterChart/index.js +12 -0
  110. package/ScatterChart/index.mjs +1 -0
  111. package/ScatterChart/scatterClasses.d.mts +3 -1
  112. package/ScatterChart/scatterClasses.d.ts +3 -1
  113. package/ScatterChart/scatterClasses.js +3 -2
  114. package/ScatterChart/scatterClasses.mjs +3 -2
  115. package/ScatterChart/useScatterChartProps.js +3 -1
  116. package/ScatterChart/useScatterChartProps.mjs +3 -1
  117. package/ScatterChart/useScatterItemPosition.d.mts +16 -0
  118. package/ScatterChart/useScatterItemPosition.d.ts +16 -0
  119. package/ScatterChart/useScatterItemPosition.js +47 -0
  120. package/ScatterChart/useScatterItemPosition.mjs +41 -0
  121. package/SparkLineChart/SparkLineChart.js +2 -913
  122. package/SparkLineChart/SparkLineChart.mjs +2 -913
  123. package/hooks/useAxis.d.mts +3 -3
  124. package/hooks/useAxis.d.ts +3 -3
  125. package/hooks/useAxisSystem.d.mts +1 -1
  126. package/hooks/useAxisSystem.d.ts +1 -1
  127. package/hooks/useAxisSystem.js +1 -1
  128. package/hooks/useAxisSystem.mjs +1 -1
  129. package/index.d.mts +2 -0
  130. package/index.d.ts +2 -0
  131. package/index.js +25 -1
  132. package/index.mjs +3 -1
  133. package/internals/commonNextFocusItem.js +62 -8
  134. package/internals/commonNextFocusItem.mjs +62 -8
  135. package/internals/findClosestIndex.d.mts +5 -0
  136. package/internals/findClosestIndex.d.ts +5 -0
  137. package/internals/findClosestIndex.js +27 -0
  138. package/internals/findClosestIndex.mjs +22 -0
  139. package/internals/getAsNumber.d.mts +1 -0
  140. package/internals/getAsNumber.d.ts +1 -0
  141. package/internals/getAsNumber.js +9 -0
  142. package/internals/getAsNumber.mjs +3 -0
  143. package/internals/index.d.mts +6 -0
  144. package/internals/index.d.ts +6 -0
  145. package/internals/index.js +60 -0
  146. package/internals/index.mjs +6 -0
  147. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +4 -2
  148. package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.mjs +4 -2
  149. package/internals/plugins/corePlugins/useChartSeriesConfig/types/polarExtremumGetter.types.d.mts +2 -2
  150. package/internals/plugins/corePlugins/useChartSeriesConfig/types/polarExtremumGetter.types.d.ts +2 -2
  151. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +4 -21
  152. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs +4 -21
  153. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.mts +3 -2
  154. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +3 -2
  155. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.mts +30 -0
  156. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.ts +30 -0
  157. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.js +57 -0
  158. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.mjs +51 -0
  159. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +7 -1
  160. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.mjs +7 -1
  161. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +7 -1
  162. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.mjs +7 -1
  163. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.mts +4 -7
  164. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +4 -7
  165. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +2 -1
  166. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +2 -1
  167. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.d.mts +3 -2
  168. package/internals/plugins/featurePlugins/useChartPolarAxis/defaultizeAxis.d.ts +3 -2
  169. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.mts +2 -2
  170. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisExtremum.d.ts +2 -2
  171. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.mts +2 -2
  172. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.d.ts +2 -2
  173. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +27 -6
  174. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.mjs +27 -5
  175. package/internals/plugins/featurePlugins/useChartPolarAxis/index.d.mts +2 -1
  176. package/internals/plugins/featurePlugins/useChartPolarAxis/index.d.ts +2 -1
  177. package/internals/plugins/featurePlugins/useChartPolarAxis/index.js +12 -0
  178. package/internals/plugins/featurePlugins/useChartPolarAxis/index.mjs +2 -1
  179. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.mts +4 -4
  180. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +4 -4
  181. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.mts +3 -3
  182. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +3 -3
  183. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.mts +1 -1
  184. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +1 -1
  185. package/models/axis.d.mts +28 -28
  186. package/models/axis.d.ts +28 -28
  187. package/models/axis.js +5 -1
  188. package/models/axis.mjs +5 -1
  189. package/models/seriesType/line.d.mts +6 -6
  190. package/models/seriesType/line.d.ts +6 -6
  191. package/package.json +170 -142
@@ -8,4 +8,22 @@ import type { CurveType } from "../../models/curve.mjs";
8
8
  export declare function evaluateCurveY(points: Array<{
9
9
  x: number;
10
10
  y: number;
11
- }>, targetX: number, curveType?: CurveType): number | null;
11
+ }>, targetX: number, curveType?: CurveType): number | null;
12
+ /**
13
+ * Build the curve segments for a set of pixel-coordinate points using d3's curve factory,
14
+ * then evaluate the point on the curve at the given angle.
15
+ *
16
+ * Returns null if no point on the curve matches the target angle.
17
+ */
18
+ export declare function evaluateCurveAtAngle(
19
+ /**
20
+ * The points only uses the x/y coordinate system, because internally curve factory only works with x/y coordinates.
21
+ * So angles/radius are lost during the curve generation.
22
+ */
23
+ points: Array<{
24
+ x: number;
25
+ y: number;
26
+ }>, targetAngle: number, curveType?: CurveType): {
27
+ x: number;
28
+ y: number;
29
+ } | null;
@@ -8,4 +8,22 @@ import type { CurveType } from "../../models/curve.js";
8
8
  export declare function evaluateCurveY(points: Array<{
9
9
  x: number;
10
10
  y: number;
11
- }>, targetX: number, curveType?: CurveType): number | null;
11
+ }>, targetX: number, curveType?: CurveType): number | null;
12
+ /**
13
+ * Build the curve segments for a set of pixel-coordinate points using d3's curve factory,
14
+ * then evaluate the point on the curve at the given angle.
15
+ *
16
+ * Returns null if no point on the curve matches the target angle.
17
+ */
18
+ export declare function evaluateCurveAtAngle(
19
+ /**
20
+ * The points only uses the x/y coordinate system, because internally curve factory only works with x/y coordinates.
21
+ * So angles/radius are lost during the curve generation.
22
+ */
23
+ points: Array<{
24
+ x: number;
25
+ y: number;
26
+ }>, targetAngle: number, curveType?: CurveType): {
27
+ x: number;
28
+ y: number;
29
+ } | null;
@@ -3,8 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ exports.evaluateCurveAtAngle = evaluateCurveAtAngle;
6
7
  exports.evaluateCurveY = evaluateCurveY;
8
+ var _epsilon = require("../../utils/epsilon");
7
9
  var _getCurve = require("../../internals/getCurve");
10
+ var _clampAngle = require("../../internals/clampAngle");
8
11
  var _cubiqSolver = require("../../internals/cubiqSolver");
9
12
  /**
10
13
  * A straight line segment.
@@ -90,6 +93,42 @@ function findTForX(segment, targetX) {
90
93
  return -1;
91
94
  }
92
95
 
96
+ /**
97
+ * Find parameter t such that the segment's x(t) ≈ targetX using cubic roots.
98
+ */
99
+ function findTForAngle(segment, targetAngle) {
100
+ if (!isBezierSegment(segment)) {
101
+ // Linear segment.
102
+ const DeltaY = segment.y1 - segment.y0;
103
+ const DeltaX = segment.x1 - segment.x0;
104
+ const dx = Math.sin(targetAngle);
105
+ const dy = -Math.cos(targetAngle);
106
+ if (Math.abs(dx) < _epsilon.EPSILON) {
107
+ if (Math.abs(DeltaX) < _epsilon.EPSILON) {
108
+ return -1;
109
+ }
110
+ return -segment.x0 / DeltaX;
111
+ }
112
+ if (Math.abs(dy) < _epsilon.EPSILON) {
113
+ if (Math.abs(DeltaY) < _epsilon.EPSILON) {
114
+ return -1;
115
+ }
116
+ return -segment.y0 / DeltaY;
117
+ }
118
+ return (segment.y0 / dy - segment.x0 / dx) / (DeltaX / dx - DeltaY / dy);
119
+ }
120
+ const xBezierCoeffs = cubicBezierCoeffs(segment.x0, segment.cpx1, segment.cpx2, segment.x1);
121
+ const yBezierCoeffs = cubicBezierCoeffs(segment.y0, segment.cpy1, segment.cpy2, segment.y1);
122
+ const targetX = Math.sin(targetAngle);
123
+ const targetY = -Math.cos(targetAngle);
124
+ const polyToSolve = [targetY * xBezierCoeffs[0] - targetX * yBezierCoeffs[0], targetY * xBezierCoeffs[1] - targetX * yBezierCoeffs[1], targetY * xBezierCoeffs[2] - targetX * yBezierCoeffs[2], targetY * xBezierCoeffs[3] - targetX * yBezierCoeffs[3]];
125
+ const roots = (0, _cubiqSolver.cubicRoots)(polyToSolve);
126
+ if (roots.length > 0) {
127
+ return roots[0];
128
+ }
129
+ return -1;
130
+ }
131
+
93
132
  /** Evaluate the segment's y at parameter t. */
94
133
  function evaluateSegmentY(segment, t) {
95
134
  if (!isBezierSegment(segment)) {
@@ -98,6 +137,14 @@ function evaluateSegmentY(segment, t) {
98
137
  return cubicBezier(t, segment.y0, segment.cpy1, segment.cpy2, segment.y1);
99
138
  }
100
139
 
140
+ /** Evaluate the segment's x at parameter t. */
141
+ function evaluateSegmentX(segment, t) {
142
+ if (!isBezierSegment(segment)) {
143
+ return segment.x0 + t * (segment.x1 - segment.x0);
144
+ }
145
+ return cubicBezier(t, segment.x0, segment.cpx1, segment.cpx2, segment.x1);
146
+ }
147
+
101
148
  /**
102
149
  * Build the curve segments for a set of pixel-coordinate points
103
150
  * using d3's curve factory, then evaluate y at the given pixel x.
@@ -136,4 +183,89 @@ function evaluateCurveY(points, targetX, curveType) {
136
183
  }
137
184
  }
138
185
  return null;
186
+ }
187
+ const vectorProduct = (a, b) => a.x * b.y - a.y * b.x;
188
+
189
+ /**
190
+ * Build the curve segments for a set of pixel-coordinate points using d3's curve factory,
191
+ * then evaluate the point on the curve at the given angle.
192
+ *
193
+ * Returns null if no point on the curve matches the target angle.
194
+ */
195
+ function evaluateCurveAtAngle(
196
+ /**
197
+ * The points only uses the x/y coordinate system, because internally curve factory only works with x/y coordinates.
198
+ * So angles/radius are lost during the curve generation.
199
+ */
200
+ points, targetAngle, curveType) {
201
+ if (points.length === 0) {
202
+ return null;
203
+ }
204
+ if (points.length === 1) {
205
+ return points[0];
206
+ }
207
+ const capture = new SegmentCapture();
208
+ const factory = (0, _getCurve.getCurveFactory)(curveType);
209
+ const curveInstance = factory(capture);
210
+ let pointsContainsOrigin = false;
211
+ curveInstance.lineStart();
212
+ for (const p of points) {
213
+ curveInstance.point(p.x, p.y);
214
+ if (p.x === 0 && p.y === 0) {
215
+ pointsContainsOrigin = true;
216
+ }
217
+ }
218
+ curveInstance.lineEnd();
219
+ const xTarget = Math.sin(targetAngle);
220
+ const yTarget = -Math.cos(targetAngle);
221
+ const pointTarget = {
222
+ x: xTarget,
223
+ y: yTarget
224
+ };
225
+
226
+ // Find the segment containing targetAngle.
227
+ for (const segment of capture.segments) {
228
+ const directionX0Target = vectorProduct({
229
+ x: segment.x0,
230
+ y: segment.y0
231
+ }, pointTarget);
232
+ const directionTargetX1 = vectorProduct(pointTarget, {
233
+ x: segment.x1,
234
+ y: segment.y1
235
+ });
236
+
237
+ // Test if target angle is between x0 and x1. To do so we check the sign of the vector product.
238
+ if (directionX0Target >= 0 && directionTargetX1 >= 0) {
239
+ const angle0 = Math.atan2(segment.x0, -segment.y0);
240
+ const angle1 = Math.atan2(segment.x1, -segment.y1);
241
+ const clampedAngleGap0 = (0, _clampAngle.clampAngleRad)(targetAngle - angle0);
242
+ if (clampedAngleGap0 < _epsilon.EPSILON || clampedAngleGap0 > Math.PI * 2 - _epsilon.EPSILON) {
243
+ return {
244
+ x: segment.x0,
245
+ y: segment.y0
246
+ };
247
+ }
248
+ const clampedAngleGap1 = (0, _clampAngle.clampAngleRad)(targetAngle - angle1);
249
+ if (clampedAngleGap1 < _epsilon.EPSILON || clampedAngleGap1 > Math.PI * 2 - _epsilon.EPSILON) {
250
+ return {
251
+ x: segment.x1,
252
+ y: segment.y1
253
+ };
254
+ }
255
+ const t = findTForAngle(segment, targetAngle);
256
+ return {
257
+ x: evaluateSegmentX(segment, t),
258
+ y: evaluateSegmentY(segment, t)
259
+ };
260
+ }
261
+ }
262
+ if (pointsContainsOrigin) {
263
+ // Frequent edge case when handling area with minRadius set to 0.
264
+ // The only point on the curve is at the origin, so we can return (0, 0) for any angle.
265
+ return {
266
+ x: 0,
267
+ y: 0
268
+ };
269
+ }
270
+ return null;
139
271
  }
@@ -1,4 +1,6 @@
1
+ import { EPSILON } from "../../utils/epsilon.mjs";
1
2
  import { getCurveFactory } from "../../internals/getCurve.mjs";
3
+ import { clampAngleRad } from "../../internals/clampAngle.mjs";
2
4
  import { cubicRoots } from "../../internals/cubiqSolver.mjs";
3
5
 
4
6
  /**
@@ -85,6 +87,42 @@ function findTForX(segment, targetX) {
85
87
  return -1;
86
88
  }
87
89
 
90
+ /**
91
+ * Find parameter t such that the segment's x(t) ≈ targetX using cubic roots.
92
+ */
93
+ function findTForAngle(segment, targetAngle) {
94
+ if (!isBezierSegment(segment)) {
95
+ // Linear segment.
96
+ const DeltaY = segment.y1 - segment.y0;
97
+ const DeltaX = segment.x1 - segment.x0;
98
+ const dx = Math.sin(targetAngle);
99
+ const dy = -Math.cos(targetAngle);
100
+ if (Math.abs(dx) < EPSILON) {
101
+ if (Math.abs(DeltaX) < EPSILON) {
102
+ return -1;
103
+ }
104
+ return -segment.x0 / DeltaX;
105
+ }
106
+ if (Math.abs(dy) < EPSILON) {
107
+ if (Math.abs(DeltaY) < EPSILON) {
108
+ return -1;
109
+ }
110
+ return -segment.y0 / DeltaY;
111
+ }
112
+ return (segment.y0 / dy - segment.x0 / dx) / (DeltaX / dx - DeltaY / dy);
113
+ }
114
+ const xBezierCoeffs = cubicBezierCoeffs(segment.x0, segment.cpx1, segment.cpx2, segment.x1);
115
+ const yBezierCoeffs = cubicBezierCoeffs(segment.y0, segment.cpy1, segment.cpy2, segment.y1);
116
+ const targetX = Math.sin(targetAngle);
117
+ const targetY = -Math.cos(targetAngle);
118
+ const polyToSolve = [targetY * xBezierCoeffs[0] - targetX * yBezierCoeffs[0], targetY * xBezierCoeffs[1] - targetX * yBezierCoeffs[1], targetY * xBezierCoeffs[2] - targetX * yBezierCoeffs[2], targetY * xBezierCoeffs[3] - targetX * yBezierCoeffs[3]];
119
+ const roots = cubicRoots(polyToSolve);
120
+ if (roots.length > 0) {
121
+ return roots[0];
122
+ }
123
+ return -1;
124
+ }
125
+
88
126
  /** Evaluate the segment's y at parameter t. */
89
127
  function evaluateSegmentY(segment, t) {
90
128
  if (!isBezierSegment(segment)) {
@@ -93,6 +131,14 @@ function evaluateSegmentY(segment, t) {
93
131
  return cubicBezier(t, segment.y0, segment.cpy1, segment.cpy2, segment.y1);
94
132
  }
95
133
 
134
+ /** Evaluate the segment's x at parameter t. */
135
+ function evaluateSegmentX(segment, t) {
136
+ if (!isBezierSegment(segment)) {
137
+ return segment.x0 + t * (segment.x1 - segment.x0);
138
+ }
139
+ return cubicBezier(t, segment.x0, segment.cpx1, segment.cpx2, segment.x1);
140
+ }
141
+
96
142
  /**
97
143
  * Build the curve segments for a set of pixel-coordinate points
98
144
  * using d3's curve factory, then evaluate y at the given pixel x.
@@ -131,4 +177,89 @@ export function evaluateCurveY(points, targetX, curveType) {
131
177
  }
132
178
  }
133
179
  return null;
180
+ }
181
+ const vectorProduct = (a, b) => a.x * b.y - a.y * b.x;
182
+
183
+ /**
184
+ * Build the curve segments for a set of pixel-coordinate points using d3's curve factory,
185
+ * then evaluate the point on the curve at the given angle.
186
+ *
187
+ * Returns null if no point on the curve matches the target angle.
188
+ */
189
+ export function evaluateCurveAtAngle(
190
+ /**
191
+ * The points only uses the x/y coordinate system, because internally curve factory only works with x/y coordinates.
192
+ * So angles/radius are lost during the curve generation.
193
+ */
194
+ points, targetAngle, curveType) {
195
+ if (points.length === 0) {
196
+ return null;
197
+ }
198
+ if (points.length === 1) {
199
+ return points[0];
200
+ }
201
+ const capture = new SegmentCapture();
202
+ const factory = getCurveFactory(curveType);
203
+ const curveInstance = factory(capture);
204
+ let pointsContainsOrigin = false;
205
+ curveInstance.lineStart();
206
+ for (const p of points) {
207
+ curveInstance.point(p.x, p.y);
208
+ if (p.x === 0 && p.y === 0) {
209
+ pointsContainsOrigin = true;
210
+ }
211
+ }
212
+ curveInstance.lineEnd();
213
+ const xTarget = Math.sin(targetAngle);
214
+ const yTarget = -Math.cos(targetAngle);
215
+ const pointTarget = {
216
+ x: xTarget,
217
+ y: yTarget
218
+ };
219
+
220
+ // Find the segment containing targetAngle.
221
+ for (const segment of capture.segments) {
222
+ const directionX0Target = vectorProduct({
223
+ x: segment.x0,
224
+ y: segment.y0
225
+ }, pointTarget);
226
+ const directionTargetX1 = vectorProduct(pointTarget, {
227
+ x: segment.x1,
228
+ y: segment.y1
229
+ });
230
+
231
+ // Test if target angle is between x0 and x1. To do so we check the sign of the vector product.
232
+ if (directionX0Target >= 0 && directionTargetX1 >= 0) {
233
+ const angle0 = Math.atan2(segment.x0, -segment.y0);
234
+ const angle1 = Math.atan2(segment.x1, -segment.y1);
235
+ const clampedAngleGap0 = clampAngleRad(targetAngle - angle0);
236
+ if (clampedAngleGap0 < EPSILON || clampedAngleGap0 > Math.PI * 2 - EPSILON) {
237
+ return {
238
+ x: segment.x0,
239
+ y: segment.y0
240
+ };
241
+ }
242
+ const clampedAngleGap1 = clampAngleRad(targetAngle - angle1);
243
+ if (clampedAngleGap1 < EPSILON || clampedAngleGap1 > Math.PI * 2 - EPSILON) {
244
+ return {
245
+ x: segment.x1,
246
+ y: segment.y1
247
+ };
248
+ }
249
+ const t = findTForAngle(segment, targetAngle);
250
+ return {
251
+ x: evaluateSegmentX(segment, t),
252
+ y: evaluateSegmentY(segment, t)
253
+ };
254
+ }
255
+ }
256
+ if (pointsContainsOrigin) {
257
+ // Frequent edge case when handling area with minRadius set to 0.
258
+ // The only point on the curve is at the origin, so we can return (0, 0) for any angle.
259
+ return {
260
+ x: 0,
261
+ y: 0
262
+ };
263
+ }
264
+ return null;
134
265
  }
@@ -8,6 +8,7 @@ var _useChartCartesianAxisRendering = require("../../internals/plugins/featurePl
8
8
  var _seriesSelectorOfType = require("../../internals/seriesSelectorOfType");
9
9
  var _getAxisValue = require("../../internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue");
10
10
  var _scaleGuards = require("../../internals/scaleGuards");
11
+ var _getAsNumber = require("../../internals/getAsNumber");
11
12
  var _getValueToPositionMapper = require("../../hooks/getValueToPositionMapper");
12
13
  var _curveEvaluation = require("./curveEvaluation");
13
14
  /**
@@ -43,13 +44,12 @@ function getBracketIndices(xAxis, pointX) {
43
44
 
44
45
  // For continuous axes, find the two adjacent data points surrounding pointX.
45
46
  const xValue = scale.invert(pointX);
46
- const xAsNumber = xValue instanceof Date ? xValue.getTime() : xValue;
47
- const getAsNumber = v => v instanceof Date ? v.getTime() : v;
47
+ const xAsNumber = (0, _getAsNumber.getAsNumber)(xValue);
48
48
 
49
49
  // Find the rightmost index where data[i] <= xValue.
50
50
  let leftIndex = -1;
51
51
  for (let i = 0; i < axisData.length; i += 1) {
52
- if (getAsNumber(axisData[i]) <= xAsNumber) {
52
+ if ((0, _getAsNumber.getAsNumber)(axisData[i]) <= xAsNumber) {
53
53
  leftIndex = i;
54
54
  } else {
55
55
  break;
@@ -60,7 +60,7 @@ function getBracketIndices(xAxis, pointX) {
60
60
  return null;
61
61
  }
62
62
  if (leftIndex === axisData.length - 1) {
63
- if (getAsNumber(axisData[leftIndex]) < xAsNumber) {
63
+ if ((0, _getAsNumber.getAsNumber)(axisData[leftIndex]) < xAsNumber) {
64
64
  // Pointer is strictly past the last data point — out of range.
65
65
  return null;
66
66
  }
@@ -90,6 +90,7 @@ function getBaselinePixelY(baseline, yScale, stackedY0) {
90
90
  if (baseline === 'min') {
91
91
  return yScale.range()[0];
92
92
  }
93
+
93
94
  // Default: use the stacked baseline value.
94
95
  const value = yScale(stackedY0);
95
96
  if (Number.isNaN(value)) {
@@ -192,6 +193,9 @@ function getItemAtPosition(state, point) {
192
193
  connectNulls,
193
194
  curve
194
195
  } = seriesItem;
196
+ if (!connectNulls && (data[left] == null || data[right] == null)) {
197
+ continue;
198
+ }
195
199
  const dataIndex = (0, _getAxisValue.getAxisIndex)(xAxis, point.x);
196
200
  if (dataIndex === -1) {
197
201
  continue;
@@ -249,7 +253,7 @@ function getItemAtPosition(state, point) {
249
253
  }
250
254
 
251
255
  // Step 2: If the closest line is within the proximity threshold, pick it.
252
- if (closestItem && closestDistance <= LINE_PROXIMITY_THRESHOLD) {
256
+ if (closestItem && closestDistance <= LINE_PROXIMITY_THRESHOLD && !series.series[closestItem.seriesId].area) {
253
257
  return closestItem;
254
258
  }
255
259
 
@@ -261,8 +265,8 @@ function getItemAtPosition(state, point) {
261
265
  for (let g = stackingGroups.length - 1; g >= 0; g -= 1) {
262
266
  const groupIds = stackingGroups[g].ids;
263
267
 
264
- // Iterate in reverse so the topmost stacked area is checked first.
265
- for (let i = groupIds.length - 1; i >= 0; i -= 1) {
268
+ // Iterate in direct order cause the `useAreaPlotData` is already doing a reverse order.
269
+ for (let i = 0; i < groupIds.length; i += 1) {
266
270
  const seriesId = groupIds[i];
267
271
  const seriesItem = series.series[seriesId];
268
272
  if (seriesItem.hidden || !seriesItem.area) {
@@ -292,12 +296,7 @@ function getItemAtPosition(state, point) {
292
296
  } = seriesItem;
293
297
 
294
298
  // Check for null gaps at bracket points.
295
- const leftIsNull = data[left] == null;
296
- const rightIsNull = data[right] == null;
297
- if (leftIsNull && rightIsNull) {
298
- continue;
299
- }
300
- if ((leftIsNull || rightIsNull) && !connectNulls) {
299
+ if ((data[left] == null || data[right] == null) && !connectNulls) {
301
300
  continue;
302
301
  }
303
302
  const xScale = xAxis.scale;
@@ -308,28 +307,6 @@ function getItemAtPosition(state, point) {
308
307
  continue;
309
308
  }
310
309
  const getPixelX = idx => xPosition(xData[idx]);
311
- if (left === right) {
312
- // Ordinal axis or pointer exactly on a data point.
313
- const stacked = visibleStackedData[left];
314
- if (!stacked) {
315
- continue;
316
- }
317
- const yBottom = getBaselinePixelY(baseline, yScale, stacked[0]);
318
- const yTop = yScale(stacked[1]);
319
- if ([yBottom, yTop].some(v => v == null || Number.isNaN(v))) {
320
- continue;
321
- }
322
- const yMin = Math.min(yBottom, yTop);
323
- const yMax = Math.max(yBottom, yTop);
324
- if (point.y >= yMin && point.y <= yMax) {
325
- return {
326
- type: 'line',
327
- seriesId,
328
- dataIndex: left
329
- };
330
- }
331
- continue;
332
- }
333
310
 
334
311
  // Build pixel-coordinate points for the top and bottom curves,
335
312
  // then evaluate them at the pointer's x using the actual d3 curve.
@@ -2,6 +2,7 @@ import { selectorChartXAxis, selectorChartYAxis } from "../../internals/plugins/
2
2
  import { selectorAllSeriesOfType } from "../../internals/seriesSelectorOfType.mjs";
3
3
  import { getAxisIndex } from "../../internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs";
4
4
  import { isOrdinalScale } from "../../internals/scaleGuards.mjs";
5
+ import { getAsNumber } from "../../internals/getAsNumber.mjs";
5
6
  import { getValueToPositionMapper } from "../../hooks/getValueToPositionMapper.mjs";
6
7
  import { evaluateCurveY } from "./curveEvaluation.mjs";
7
8
 
@@ -38,8 +39,7 @@ function getBracketIndices(xAxis, pointX) {
38
39
 
39
40
  // For continuous axes, find the two adjacent data points surrounding pointX.
40
41
  const xValue = scale.invert(pointX);
41
- const xAsNumber = xValue instanceof Date ? xValue.getTime() : xValue;
42
- const getAsNumber = v => v instanceof Date ? v.getTime() : v;
42
+ const xAsNumber = getAsNumber(xValue);
43
43
 
44
44
  // Find the rightmost index where data[i] <= xValue.
45
45
  let leftIndex = -1;
@@ -85,6 +85,7 @@ function getBaselinePixelY(baseline, yScale, stackedY0) {
85
85
  if (baseline === 'min') {
86
86
  return yScale.range()[0];
87
87
  }
88
+
88
89
  // Default: use the stacked baseline value.
89
90
  const value = yScale(stackedY0);
90
91
  if (Number.isNaN(value)) {
@@ -187,6 +188,9 @@ export default function getItemAtPosition(state, point) {
187
188
  connectNulls,
188
189
  curve
189
190
  } = seriesItem;
191
+ if (!connectNulls && (data[left] == null || data[right] == null)) {
192
+ continue;
193
+ }
190
194
  const dataIndex = getAxisIndex(xAxis, point.x);
191
195
  if (dataIndex === -1) {
192
196
  continue;
@@ -244,7 +248,7 @@ export default function getItemAtPosition(state, point) {
244
248
  }
245
249
 
246
250
  // Step 2: If the closest line is within the proximity threshold, pick it.
247
- if (closestItem && closestDistance <= LINE_PROXIMITY_THRESHOLD) {
251
+ if (closestItem && closestDistance <= LINE_PROXIMITY_THRESHOLD && !series.series[closestItem.seriesId].area) {
248
252
  return closestItem;
249
253
  }
250
254
 
@@ -256,8 +260,8 @@ export default function getItemAtPosition(state, point) {
256
260
  for (let g = stackingGroups.length - 1; g >= 0; g -= 1) {
257
261
  const groupIds = stackingGroups[g].ids;
258
262
 
259
- // Iterate in reverse so the topmost stacked area is checked first.
260
- for (let i = groupIds.length - 1; i >= 0; i -= 1) {
263
+ // Iterate in direct order cause the `useAreaPlotData` is already doing a reverse order.
264
+ for (let i = 0; i < groupIds.length; i += 1) {
261
265
  const seriesId = groupIds[i];
262
266
  const seriesItem = series.series[seriesId];
263
267
  if (seriesItem.hidden || !seriesItem.area) {
@@ -287,12 +291,7 @@ export default function getItemAtPosition(state, point) {
287
291
  } = seriesItem;
288
292
 
289
293
  // Check for null gaps at bracket points.
290
- const leftIsNull = data[left] == null;
291
- const rightIsNull = data[right] == null;
292
- if (leftIsNull && rightIsNull) {
293
- continue;
294
- }
295
- if ((leftIsNull || rightIsNull) && !connectNulls) {
294
+ if ((data[left] == null || data[right] == null) && !connectNulls) {
296
295
  continue;
297
296
  }
298
297
  const xScale = xAxis.scale;
@@ -303,28 +302,6 @@ export default function getItemAtPosition(state, point) {
303
302
  continue;
304
303
  }
305
304
  const getPixelX = idx => xPosition(xData[idx]);
306
- if (left === right) {
307
- // Ordinal axis or pointer exactly on a data point.
308
- const stacked = visibleStackedData[left];
309
- if (!stacked) {
310
- continue;
311
- }
312
- const yBottom = getBaselinePixelY(baseline, yScale, stacked[0]);
313
- const yTop = yScale(stacked[1]);
314
- if ([yBottom, yTop].some(v => v == null || Number.isNaN(v))) {
315
- continue;
316
- }
317
- const yMin = Math.min(yBottom, yTop);
318
- const yMax = Math.max(yBottom, yTop);
319
- if (point.y >= yMin && point.y <= yMax) {
320
- return {
321
- type: 'line',
322
- seriesId,
323
- dataIndex: left
324
- };
325
- }
326
- continue;
327
- }
328
305
 
329
306
  // Build pixel-coordinate points for the top and bottom curves,
330
307
  // then evaluate them at the pointer's x using the actual d3 curve.
@@ -8,6 +8,7 @@ exports.default = void 0;
8
8
  var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
9
9
  const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => (0, _extends2.default)({}, seriesData, {
10
10
  id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
11
- color: seriesData.color ?? colors[seriesIndex % colors.length]
11
+ color: seriesData.color ?? colors[seriesIndex % colors.length],
12
+ curve: seriesData.curve ?? 'monotoneX'
12
13
  });
13
14
  var _default = exports.default = getSeriesWithDefaultValues;
@@ -1,6 +1,7 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  const getSeriesWithDefaultValues = (seriesData, seriesIndex, colors) => _extends({}, seriesData, {
3
3
  id: seriesData.id ?? `auto-generated-id-${seriesIndex}`,
4
- color: seriesData.color ?? colors[seriesIndex % colors.length]
4
+ color: seriesData.color ?? colors[seriesIndex % colors.length],
5
+ curve: seriesData.curve ?? 'monotoneX'
5
6
  });
6
7
  export default getSeriesWithDefaultValues;
@@ -51,12 +51,16 @@ function seriesProcessor(params, dataset, isItemVisible) {
51
51
  }
52
52
  });
53
53
  } else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
54
+ // TODO: fix mui/no-guarded-throw
55
+ // eslint-disable-next-line mui/no-guarded-throw
54
56
  throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Line series with id="${id}" has no data. ` + 'The chart cannot render this series without data. ' + 'Provide a data property to the series or use the dataset prop.' : (0, _formatErrorMessage2.default)(27, id));
55
57
  }
56
58
  if (process.env.NODE_ENV !== 'production') {
57
59
  if (!data && dataset) {
58
60
  const dataKey = series[id].dataKey;
59
61
  if (!dataKey && !series[id].valueGetter) {
62
+ // TODO: fix mui/no-guarded-throw
63
+ // eslint-disable-next-line mui/no-guarded-throw
60
64
  throw new Error(`MUI X Charts: Line series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
61
65
  }
62
66
  if (dataKey) {
@@ -44,12 +44,16 @@ function seriesProcessor(params, dataset, isItemVisible) {
44
44
  }
45
45
  });
46
46
  } else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
47
+ // TODO: fix mui/no-guarded-throw
48
+ // eslint-disable-next-line mui/no-guarded-throw
47
49
  throw new Error(process.env.NODE_ENV !== "production" ? `MUI X Charts: Line series with id="${id}" has no data. ` + 'The chart cannot render this series without data. ' + 'Provide a data property to the series or use the dataset prop.' : _formatErrorMessage(27, id));
48
50
  }
49
51
  if (process.env.NODE_ENV !== 'production') {
50
52
  if (!data && dataset) {
51
53
  const dataKey = series[id].dataKey;
52
54
  if (!dataKey && !series[id].valueGetter) {
55
+ // TODO: fix mui/no-guarded-throw
56
+ // eslint-disable-next-line mui/no-guarded-throw
53
57
  throw new Error(`MUI X Charts: Line series with id="${id}" has no data, no dataKey, and no valueGetter. ` + 'When using the dataset prop, each series must have a dataKey or valueGetter to identify which dataset values to use. ' + 'Add a dataKey or valueGetter property to the series configuration.');
54
58
  }
55
59
  if (dataKey) {
@@ -54,9 +54,13 @@ function useAreaPlotData(xAxes, yAxes) {
54
54
  const gradientId = yAxes[yAxisId].colorScale && getGradientId(yAxisId) || xAxes[xAxisId].colorScale && getGradientId(xAxisId) || undefined;
55
55
  if (process.env.NODE_ENV !== 'production') {
56
56
  if (xData === undefined) {
57
+ // TODO: fix mui/no-guarded-throw
58
+ // eslint-disable-next-line mui/no-guarded-throw
57
59
  throw new Error(`MUI X Charts: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have a data property to be able to display a line plot. ` + 'The x-axis data defines the positions for each point in the line. ' + 'Provide a data array to the x-axis configuration.');
58
60
  }
59
61
  if (xData.length < stackedData.length) {
62
+ // TODO: fix mui/no-guarded-throw
63
+ // eslint-disable-next-line mui/no-guarded-throw
60
64
  throw new Error(`MUI X Charts: The data length of the x-axis (${xData.length} items) is less than the length of series data (${stackedData.length} items). ` + 'Some data points will not be displayed because they have no corresponding x-axis value. ' + 'Ensure the x-axis data has at least as many items as the series data.');
61
65
  }
62
66
  }
@@ -47,9 +47,13 @@ export function useAreaPlotData(xAxes, yAxes) {
47
47
  const gradientId = yAxes[yAxisId].colorScale && getGradientId(yAxisId) || xAxes[xAxisId].colorScale && getGradientId(xAxisId) || undefined;
48
48
  if (process.env.NODE_ENV !== 'production') {
49
49
  if (xData === undefined) {
50
+ // TODO: fix mui/no-guarded-throw
51
+ // eslint-disable-next-line mui/no-guarded-throw
50
52
  throw new Error(`MUI X Charts: ${xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have a data property to be able to display a line plot. ` + 'The x-axis data defines the positions for each point in the line. ' + 'Provide a data array to the x-axis configuration.');
51
53
  }
52
54
  if (xData.length < stackedData.length) {
55
+ // TODO: fix mui/no-guarded-throw
56
+ // eslint-disable-next-line mui/no-guarded-throw
53
57
  throw new Error(`MUI X Charts: The data length of the x-axis (${xData.length} items) is less than the length of series data (${stackedData.length} items). ` + 'Some data points will not be displayed because they have no corresponding x-axis value. ' + 'Ensure the x-axis data has at least as many items as the series data.');
54
58
  }
55
59
  }
@@ -52,6 +52,8 @@ function useLinePlotData(xAxes, yAxes) {
52
52
  const gradientId = yAxes[yAxisId].colorScale && getGradientId(yAxisId) || xAxes[xAxisId].colorScale && getGradientId(xAxisId) || undefined;
53
53
  if (process.env.NODE_ENV !== 'production') {
54
54
  if (xData === undefined) {
55
+ // TODO: fix mui/no-guarded-throw
56
+ // eslint-disable-next-line mui/no-guarded-throw
55
57
  throw new Error(`MUI X Charts: ${xAxisId === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have a data property to be able to display a line plot. ` + 'The x-axis data defines the positions for each point in the line. ' + 'Provide a data array to the x-axis configuration.');
56
58
  }
57
59
  if (xData.length < stackedData.length) {