@mui/x-charts 9.0.2 → 9.0.4

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 (150) hide show
  1. package/BarChart/BarChart.js +2 -1
  2. package/BarChart/BarChart.mjs +2 -1
  3. package/BarChart/BarPlot.js +2 -1
  4. package/BarChart/BarPlot.mjs +2 -1
  5. package/BarChart/FocusedBar.js +3 -0
  6. package/BarChart/FocusedBar.mjs +3 -0
  7. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.mts +8 -8
  8. package/BarChart/seriesConfig/bar/getSeriesWithDefaultValues.d.ts +8 -8
  9. package/CHANGELOG.md +223 -0
  10. package/ChartsRadialGrid/ChartsRadialGrid.js +2 -0
  11. package/ChartsRadialGrid/ChartsRadialGrid.mjs +2 -0
  12. package/ChartsRadialGrid/ChartsRadiusGrid.d.mts +1 -0
  13. package/ChartsRadialGrid/ChartsRadiusGrid.d.ts +1 -0
  14. package/ChartsRadialGrid/ChartsRadiusGrid.js +1 -2
  15. package/ChartsRadialGrid/ChartsRadiusGrid.mjs +1 -2
  16. package/ChartsRadiusAxis/ChartsRadiusAxis.d.mts +48 -0
  17. package/ChartsRadiusAxis/ChartsRadiusAxis.d.ts +48 -0
  18. package/ChartsRadiusAxis/ChartsRadiusAxis.js +147 -0
  19. package/ChartsRadiusAxis/ChartsRadiusAxis.mjs +141 -0
  20. package/ChartsRadiusAxis/chartsRadiusAxisClasses.d.mts +6 -0
  21. package/ChartsRadiusAxis/chartsRadiusAxisClasses.d.ts +6 -0
  22. package/ChartsRadiusAxis/chartsRadiusAxisClasses.js +30 -0
  23. package/ChartsRadiusAxis/chartsRadiusAxisClasses.mjs +17 -0
  24. package/ChartsRadiusAxis/createGetLabelTextAnchors.d.mts +10 -0
  25. package/ChartsRadiusAxis/createGetLabelTextAnchors.d.ts +10 -0
  26. package/ChartsRadiusAxis/createGetLabelTextAnchors.js +46 -0
  27. package/ChartsRadiusAxis/createGetLabelTextAnchors.mjs +39 -0
  28. package/ChartsRadiusAxis/getLabelTransform.d.mts +11 -0
  29. package/ChartsRadiusAxis/getLabelTransform.d.ts +11 -0
  30. package/ChartsRadiusAxis/getLabelTransform.js +37 -0
  31. package/ChartsRadiusAxis/getLabelTransform.mjs +31 -0
  32. package/ChartsRadiusAxis/index.d.mts +3 -0
  33. package/ChartsRadiusAxis/index.d.ts +3 -0
  34. package/ChartsRadiusAxis/index.js +19 -0
  35. package/ChartsRadiusAxis/index.mjs +2 -0
  36. package/ChartsRadiusAxis/sharedRadialAxisClasses.d.mts +21 -0
  37. package/ChartsRadiusAxis/sharedRadialAxisClasses.d.ts +21 -0
  38. package/ChartsRadiusAxis/sharedRadialAxisClasses.js +14 -0
  39. package/ChartsRadiusAxis/sharedRadialAxisClasses.mjs +6 -0
  40. package/ChartsRotationAxis/ChartsRotationAxis.d.mts +48 -0
  41. package/ChartsRotationAxis/ChartsRotationAxis.d.ts +48 -0
  42. package/ChartsRotationAxis/ChartsRotationAxis.js +141 -0
  43. package/ChartsRotationAxis/ChartsRotationAxis.mjs +135 -0
  44. package/ChartsRotationAxis/chartsRotationAxisClasses.d.mts +5 -0
  45. package/ChartsRotationAxis/chartsRotationAxisClasses.d.ts +5 -0
  46. package/ChartsRotationAxis/chartsRotationAxisClasses.js +29 -0
  47. package/ChartsRotationAxis/chartsRotationAxisClasses.mjs +16 -0
  48. package/ChartsRotationAxis/getLabelTransform.d.mts +11 -0
  49. package/ChartsRotationAxis/getLabelTransform.d.ts +11 -0
  50. package/ChartsRotationAxis/getLabelTransform.js +37 -0
  51. package/ChartsRotationAxis/getLabelTransform.mjs +31 -0
  52. package/ChartsRotationAxis/index.d.mts +2 -0
  53. package/ChartsRotationAxis/index.d.ts +2 -0
  54. package/ChartsRotationAxis/index.js +19 -0
  55. package/ChartsRotationAxis/index.mjs +2 -0
  56. package/ChartsTooltip/useAxesTooltip.js +18 -7
  57. package/ChartsTooltip/useAxesTooltip.mjs +19 -8
  58. package/ChartsTooltip/useItemTooltip.d.mts +1 -1
  59. package/ChartsTooltip/useItemTooltip.d.ts +1 -1
  60. package/ChartsTooltip/useItemTooltip.js +17 -2
  61. package/ChartsTooltip/useItemTooltip.mjs +18 -3
  62. package/ChartsXAxis/useAxisTicksProps.d.mts +245 -164
  63. package/ChartsXAxis/useAxisTicksProps.d.ts +245 -164
  64. package/ChartsYAxis/useAxisTicksProps.d.mts +245 -164
  65. package/ChartsYAxis/useAxisTicksProps.d.ts +245 -164
  66. package/LineChart/FocusedLineMark.js +3 -0
  67. package/LineChart/FocusedLineMark.mjs +3 -0
  68. package/LineChart/seriesConfig/curveEvaluation.js +24 -19
  69. package/LineChart/seriesConfig/curveEvaluation.mjs +24 -19
  70. package/LineChart/seriesConfig/getItemAtPosition.js +25 -37
  71. package/LineChart/seriesConfig/getItemAtPosition.mjs +24 -36
  72. package/LineChart/seriesConfig/getSeriesWithDefaultValues.js +4 -6
  73. package/LineChart/seriesConfig/getSeriesWithDefaultValues.mjs +4 -6
  74. package/LineChart/seriesConfig/seriesProcessor.d.mts +4 -2
  75. package/LineChart/seriesConfig/seriesProcessor.d.ts +4 -2
  76. package/LineChart/seriesConfig/seriesProcessor.js +2 -2
  77. package/LineChart/seriesConfig/seriesProcessor.mjs +2 -2
  78. package/PieChart/FocusedPieArc.js +3 -0
  79. package/PieChart/FocusedPieArc.mjs +3 -0
  80. package/RadarChart/FocusedRadarMark.js +3 -0
  81. package/RadarChart/FocusedRadarMark.mjs +3 -0
  82. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.mts +2 -2
  83. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
  84. package/ScatterChart/FocusedScatterMark.js +3 -0
  85. package/ScatterChart/FocusedScatterMark.mjs +3 -0
  86. package/hooks/useAxis.d.mts +2 -2
  87. package/hooks/useAxis.d.ts +2 -2
  88. package/index.d.mts +2 -0
  89. package/index.d.ts +2 -0
  90. package/index.js +22 -2
  91. package/index.mjs +3 -1
  92. package/internals/commonNextFocusItem.js +62 -8
  93. package/internals/commonNextFocusItem.mjs +62 -8
  94. package/internals/cubiqSolver.d.mts +5 -0
  95. package/internals/cubiqSolver.d.ts +5 -0
  96. package/internals/cubiqSolver.js +62 -0
  97. package/internals/cubiqSolver.mjs +56 -0
  98. package/internals/findClosestIndex.d.mts +5 -0
  99. package/internals/findClosestIndex.d.ts +5 -0
  100. package/internals/findClosestIndex.js +27 -0
  101. package/internals/findClosestIndex.mjs +22 -0
  102. package/internals/getAsNumber.d.mts +1 -0
  103. package/internals/getAsNumber.d.ts +1 -0
  104. package/internals/getAsNumber.js +9 -0
  105. package/internals/getAsNumber.mjs +3 -0
  106. package/internals/index.d.mts +6 -1
  107. package/internals/index.d.ts +6 -1
  108. package/internals/index.js +59 -2
  109. package/internals/index.mjs +6 -1
  110. package/internals/isPolar.d.mts +3 -2
  111. package/internals/isPolar.d.ts +3 -2
  112. package/internals/isPolar.js +4 -0
  113. package/internals/isPolar.mjs +3 -0
  114. package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.mts +8 -9
  115. package/internals/plugins/corePlugins/useChartSeriesConfig/types/colorProcessor.types.d.ts +8 -9
  116. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +4 -21
  117. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.mjs +4 -21
  118. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.mts +30 -0
  119. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.d.ts +30 -0
  120. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.js +57 -0
  121. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.mjs +51 -0
  122. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.js +7 -1
  123. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.mjs +7 -1
  124. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.js +7 -1
  125. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/utils/getNonEmptySeriesArray.mjs +7 -1
  126. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.mts +3 -2
  127. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.d.ts +3 -2
  128. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.js +25 -14
  129. package/internals/plugins/featurePlugins/useChartPolarAxis/computeAxisValue.mjs +25 -14
  130. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +9 -4
  131. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.mjs +9 -3
  132. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.mts +2 -2
  133. package/internals/plugins/featurePlugins/useChartTooltip/useChartTooltip.selectors.d.ts +2 -2
  134. package/models/axis.d.mts +2 -0
  135. package/models/axis.d.ts +2 -0
  136. package/models/seriesType/bar.d.mts +12 -7
  137. package/models/seriesType/bar.d.ts +12 -7
  138. package/models/seriesType/common.d.mts +10 -0
  139. package/models/seriesType/common.d.ts +10 -0
  140. package/models/seriesType/composition.d.mts +3 -1
  141. package/models/seriesType/composition.d.ts +3 -1
  142. package/models/seriesType/composition.js +6 -2
  143. package/models/seriesType/composition.mjs +5 -1
  144. package/models/seriesType/index.d.mts +3 -3
  145. package/models/seriesType/index.d.ts +3 -3
  146. package/models/seriesType/index.js +0 -22
  147. package/models/seriesType/index.mjs +0 -2
  148. package/models/seriesType/line.d.mts +13 -8
  149. package/models/seriesType/line.d.ts +13 -8
  150. package/package.json +32 -4
package/index.d.mts CHANGED
@@ -29,6 +29,8 @@ export type { ChartsContainerProps, ChartsContainerSlots, ChartsContainerSlotPro
29
29
  export * from "./ChartsDataProvider/index.mjs";
30
30
  export * from "./ChartsRadialDataProvider/index.mjs";
31
31
  export * from "./ChartsRadialGrid/index.mjs";
32
+ export * from "./ChartsRadiusAxis/index.mjs";
33
+ export { type ChartsRotationAxisProps, Unstable_ChartsRotationAxis } from "./ChartsRotationAxis/index.mjs";
32
34
  export * from "./Toolbar/index.mjs";
33
35
  export * from "./ChartsWrapper/index.mjs";
34
36
  export * from "./ChartsBrushOverlay/index.mjs";
package/index.d.ts CHANGED
@@ -29,6 +29,8 @@ export type { ChartsContainerProps, ChartsContainerSlots, ChartsContainerSlotPro
29
29
  export * from "./ChartsDataProvider/index.js";
30
30
  export * from "./ChartsRadialDataProvider/index.js";
31
31
  export * from "./ChartsRadialGrid/index.js";
32
+ export * from "./ChartsRadiusAxis/index.js";
33
+ export { type ChartsRotationAxisProps, Unstable_ChartsRotationAxis } from "./ChartsRotationAxis/index.js";
32
34
  export * from "./Toolbar/index.js";
33
35
  export * from "./ChartsWrapper/index.js";
34
36
  export * from "./ChartsBrushOverlay/index.js";
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v9.0.2
2
+ * @mui/x-charts v9.0.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -11,7 +11,8 @@ Object.defineProperty(exports, "__esModule", {
11
11
  value: true
12
12
  });
13
13
  var _exportNames = {
14
- ChartsContainer: true
14
+ ChartsContainer: true,
15
+ Unstable_ChartsRotationAxis: true
15
16
  };
16
17
  Object.defineProperty(exports, "ChartsContainer", {
17
18
  enumerable: true,
@@ -19,6 +20,12 @@ Object.defineProperty(exports, "ChartsContainer", {
19
20
  return _ChartsContainer.ChartsContainer;
20
21
  }
21
22
  });
23
+ Object.defineProperty(exports, "Unstable_ChartsRotationAxis", {
24
+ enumerable: true,
25
+ get: function () {
26
+ return _ChartsRotationAxis.Unstable_ChartsRotationAxis;
27
+ }
28
+ });
22
29
  var _constants = require("./constants");
23
30
  Object.keys(_constants).forEach(function (key) {
24
31
  if (key === "default" || key === "__esModule") return;
@@ -368,6 +375,19 @@ Object.keys(_ChartsRadialGrid).forEach(function (key) {
368
375
  }
369
376
  });
370
377
  });
378
+ var _ChartsRadiusAxis = require("./ChartsRadiusAxis");
379
+ Object.keys(_ChartsRadiusAxis).forEach(function (key) {
380
+ if (key === "default" || key === "__esModule") return;
381
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
382
+ if (key in exports && exports[key] === _ChartsRadiusAxis[key]) return;
383
+ Object.defineProperty(exports, key, {
384
+ enumerable: true,
385
+ get: function () {
386
+ return _ChartsRadiusAxis[key];
387
+ }
388
+ });
389
+ });
390
+ var _ChartsRotationAxis = require("./ChartsRotationAxis");
371
391
  var _Toolbar = require("./Toolbar");
372
392
  Object.keys(_Toolbar).forEach(function (key) {
373
393
  if (key === "default" || key === "__esModule") return;
package/index.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v9.0.2
2
+ * @mui/x-charts v9.0.4
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -35,6 +35,8 @@ export { ChartsContainer } from "./ChartsContainer/index.mjs";
35
35
  export * from "./ChartsDataProvider/index.mjs";
36
36
  export * from "./ChartsRadialDataProvider/index.mjs";
37
37
  export * from "./ChartsRadialGrid/index.mjs";
38
+ export * from "./ChartsRadiusAxis/index.mjs";
39
+ export { Unstable_ChartsRotationAxis } from "./ChartsRotationAxis/index.mjs";
38
40
  export * from "./Toolbar/index.mjs";
39
41
  export * from "./ChartsWrapper/index.mjs";
40
42
  export * from "./ChartsBrushOverlay/index.mjs";
@@ -10,8 +10,13 @@ exports.createGetPreviousSeriesFocusedItem = createGetPreviousSeriesFocusedItem;
10
10
  var _getPreviousNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries");
11
11
  var _getMaxSeriesLength = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength");
12
12
  var _getNextNonEmptySeries = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries");
13
+ var _findVisibleDataIndex = require("./plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex");
13
14
  var _seriesHasData = require("./seriesHasData");
14
15
  var _useChartSeries = require("./plugins/corePlugins/useChartSeries/useChartSeries.selectors");
16
+ function isSeriesHidden(processedSeries, type, seriesId) {
17
+ const seriesItem = processedSeries[type]?.series[seriesId];
18
+ return Boolean(seriesItem && 'hidden' in seriesItem && seriesItem.hidden);
19
+ }
15
20
  function createGetNextIndexFocusedItem(
16
21
  /**
17
22
  * The set of series types compatible with this navigation action.
@@ -25,7 +30,7 @@ allowCycles = false) {
25
30
  const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
26
31
  let seriesId = currentItem?.seriesId;
27
32
  let type = currentItem?.type;
28
- if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId)) {
33
+ if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId) || isSeriesHidden(processedSeries, type, seriesId)) {
29
34
  const nextSeries = (0, _getNextNonEmptySeries.getNextNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
30
35
  if (nextSeries === null) {
31
36
  return null;
@@ -40,10 +45,22 @@ allowCycles = false) {
40
45
  } else {
41
46
  dataIndex = Math.min(maxLength - 1, dataIndex);
42
47
  }
48
+ const visibleDataIndex = (0, _findVisibleDataIndex.findVisibleDataIndex)({
49
+ processedSeries,
50
+ type,
51
+ seriesId,
52
+ startIndex: dataIndex,
53
+ dataLength: maxLength,
54
+ direction: 1,
55
+ allowCycles
56
+ });
57
+ if (visibleDataIndex === null) {
58
+ return null;
59
+ }
43
60
  return {
44
61
  type: type,
45
62
  seriesId,
46
- dataIndex
63
+ dataIndex: visibleDataIndex
47
64
  };
48
65
  };
49
66
  }
@@ -60,7 +77,7 @@ allowCycles = false) {
60
77
  const processedSeries = (0, _useChartSeries.selectorChartSeriesProcessed)(state);
61
78
  let seriesId = currentItem?.seriesId;
62
79
  let type = currentItem?.type;
63
- if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId)) {
80
+ if (!type || seriesId == null || !(0, _seriesHasData.seriesHasData)(processedSeries, type, seriesId) || isSeriesHidden(processedSeries, type, seriesId)) {
64
81
  const previousSeries = (0, _getPreviousNonEmptySeries.getPreviousNonEmptySeries)(processedSeries, compatibleSeriesTypes, type, seriesId);
65
82
  if (previousSeries === null) {
66
83
  return null;
@@ -75,10 +92,22 @@ allowCycles = false) {
75
92
  } else {
76
93
  dataIndex = Math.max(0, dataIndex);
77
94
  }
95
+ const visibleDataIndex = (0, _findVisibleDataIndex.findVisibleDataIndex)({
96
+ processedSeries,
97
+ type,
98
+ seriesId,
99
+ startIndex: dataIndex,
100
+ dataLength: maxLength,
101
+ direction: -1,
102
+ allowCycles
103
+ });
104
+ if (visibleDataIndex === null) {
105
+ return null;
106
+ }
78
107
  return {
79
108
  type: type,
80
109
  seriesId,
81
- dataIndex
110
+ dataIndex: visibleDataIndex
82
111
  };
83
112
  };
84
113
  }
@@ -97,11 +126,24 @@ compatibleSeriesTypes) {
97
126
  }
98
127
  type = nextSeries.type;
99
128
  seriesId = nextSeries.seriesId;
100
- const dataIndex = currentItem?.dataIndex == null ? 0 : currentItem.dataIndex;
129
+ const data = processedSeries[type].series[seriesId].data;
130
+ const startIndex = currentItem?.dataIndex == null ? 0 : Math.min(currentItem.dataIndex, data.length - 1);
131
+ const visibleDataIndex = (0, _findVisibleDataIndex.findVisibleDataIndex)({
132
+ processedSeries,
133
+ type,
134
+ seriesId,
135
+ startIndex,
136
+ dataLength: data.length,
137
+ direction: 1,
138
+ allowCycles: true
139
+ });
140
+ if (visibleDataIndex === null) {
141
+ return null;
142
+ }
101
143
  return {
102
144
  type: type,
103
145
  seriesId,
104
- dataIndex
146
+ dataIndex: visibleDataIndex
105
147
  };
106
148
  };
107
149
  }
@@ -121,11 +163,23 @@ compatibleSeriesTypes) {
121
163
  type = previousSeries.type;
122
164
  seriesId = previousSeries.seriesId;
123
165
  const data = processedSeries[type].series[seriesId].data;
124
- const dataIndex = currentItem?.dataIndex == null ? data.length - 1 : currentItem.dataIndex;
166
+ const startIndex = currentItem?.dataIndex == null ? data.length - 1 : Math.min(currentItem.dataIndex, data.length - 1);
167
+ const visibleDataIndex = (0, _findVisibleDataIndex.findVisibleDataIndex)({
168
+ processedSeries,
169
+ type,
170
+ seriesId,
171
+ startIndex,
172
+ dataLength: data.length,
173
+ direction: -1,
174
+ allowCycles: true
175
+ });
176
+ if (visibleDataIndex === null) {
177
+ return null;
178
+ }
125
179
  return {
126
180
  type: type,
127
181
  seriesId,
128
- dataIndex
182
+ dataIndex: visibleDataIndex
129
183
  };
130
184
  };
131
185
  }
@@ -1,8 +1,13 @@
1
1
  import { getPreviousNonEmptySeries } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getPreviousNonEmptySeries.mjs";
2
2
  import { getMaxSeriesLength } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getMaxSeriesLength.mjs";
3
3
  import { getNextNonEmptySeries } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/getNextNonEmptySeries.mjs";
4
+ import { findVisibleDataIndex } from "./plugins/featurePlugins/useChartKeyboardNavigation/utils/findVisibleDataIndex.mjs";
4
5
  import { seriesHasData } from "./seriesHasData.mjs";
5
6
  import { selectorChartSeriesProcessed } from "./plugins/corePlugins/useChartSeries/useChartSeries.selectors.mjs";
7
+ function isSeriesHidden(processedSeries, type, seriesId) {
8
+ const seriesItem = processedSeries[type]?.series[seriesId];
9
+ return Boolean(seriesItem && 'hidden' in seriesItem && seriesItem.hidden);
10
+ }
6
11
  export function createGetNextIndexFocusedItem(
7
12
  /**
8
13
  * The set of series types compatible with this navigation action.
@@ -16,7 +21,7 @@ allowCycles = false) {
16
21
  const processedSeries = selectorChartSeriesProcessed(state);
17
22
  let seriesId = currentItem?.seriesId;
18
23
  let type = currentItem?.type;
19
- if (!type || seriesId == null || !seriesHasData(processedSeries, type, seriesId)) {
24
+ if (!type || seriesId == null || !seriesHasData(processedSeries, type, seriesId) || isSeriesHidden(processedSeries, type, seriesId)) {
20
25
  const nextSeries = getNextNonEmptySeries(processedSeries, compatibleSeriesTypes, type, seriesId);
21
26
  if (nextSeries === null) {
22
27
  return null;
@@ -31,10 +36,22 @@ allowCycles = false) {
31
36
  } else {
32
37
  dataIndex = Math.min(maxLength - 1, dataIndex);
33
38
  }
39
+ const visibleDataIndex = findVisibleDataIndex({
40
+ processedSeries,
41
+ type,
42
+ seriesId,
43
+ startIndex: dataIndex,
44
+ dataLength: maxLength,
45
+ direction: 1,
46
+ allowCycles
47
+ });
48
+ if (visibleDataIndex === null) {
49
+ return null;
50
+ }
34
51
  return {
35
52
  type: type,
36
53
  seriesId,
37
- dataIndex
54
+ dataIndex: visibleDataIndex
38
55
  };
39
56
  };
40
57
  }
@@ -51,7 +68,7 @@ allowCycles = false) {
51
68
  const processedSeries = selectorChartSeriesProcessed(state);
52
69
  let seriesId = currentItem?.seriesId;
53
70
  let type = currentItem?.type;
54
- if (!type || seriesId == null || !seriesHasData(processedSeries, type, seriesId)) {
71
+ if (!type || seriesId == null || !seriesHasData(processedSeries, type, seriesId) || isSeriesHidden(processedSeries, type, seriesId)) {
55
72
  const previousSeries = getPreviousNonEmptySeries(processedSeries, compatibleSeriesTypes, type, seriesId);
56
73
  if (previousSeries === null) {
57
74
  return null;
@@ -66,10 +83,22 @@ allowCycles = false) {
66
83
  } else {
67
84
  dataIndex = Math.max(0, dataIndex);
68
85
  }
86
+ const visibleDataIndex = findVisibleDataIndex({
87
+ processedSeries,
88
+ type,
89
+ seriesId,
90
+ startIndex: dataIndex,
91
+ dataLength: maxLength,
92
+ direction: -1,
93
+ allowCycles
94
+ });
95
+ if (visibleDataIndex === null) {
96
+ return null;
97
+ }
69
98
  return {
70
99
  type: type,
71
100
  seriesId,
72
- dataIndex
101
+ dataIndex: visibleDataIndex
73
102
  };
74
103
  };
75
104
  }
@@ -88,11 +117,24 @@ compatibleSeriesTypes) {
88
117
  }
89
118
  type = nextSeries.type;
90
119
  seriesId = nextSeries.seriesId;
91
- const dataIndex = currentItem?.dataIndex == null ? 0 : currentItem.dataIndex;
120
+ const data = processedSeries[type].series[seriesId].data;
121
+ const startIndex = currentItem?.dataIndex == null ? 0 : Math.min(currentItem.dataIndex, data.length - 1);
122
+ const visibleDataIndex = findVisibleDataIndex({
123
+ processedSeries,
124
+ type,
125
+ seriesId,
126
+ startIndex,
127
+ dataLength: data.length,
128
+ direction: 1,
129
+ allowCycles: true
130
+ });
131
+ if (visibleDataIndex === null) {
132
+ return null;
133
+ }
92
134
  return {
93
135
  type: type,
94
136
  seriesId,
95
- dataIndex
137
+ dataIndex: visibleDataIndex
96
138
  };
97
139
  };
98
140
  }
@@ -112,11 +154,23 @@ compatibleSeriesTypes) {
112
154
  type = previousSeries.type;
113
155
  seriesId = previousSeries.seriesId;
114
156
  const data = processedSeries[type].series[seriesId].data;
115
- const dataIndex = currentItem?.dataIndex == null ? data.length - 1 : currentItem.dataIndex;
157
+ const startIndex = currentItem?.dataIndex == null ? data.length - 1 : Math.min(currentItem.dataIndex, data.length - 1);
158
+ const visibleDataIndex = findVisibleDataIndex({
159
+ processedSeries,
160
+ type,
161
+ seriesId,
162
+ startIndex,
163
+ dataLength: data.length,
164
+ direction: -1,
165
+ allowCycles: true
166
+ });
167
+ if (visibleDataIndex === null) {
168
+ return null;
169
+ }
116
170
  return {
117
171
  type: type,
118
172
  seriesId,
119
- dataIndex
173
+ dataIndex: visibleDataIndex
120
174
  };
121
175
  };
122
176
  }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Cubic equation solver. Only returns real root between 0 and 1, which is the only case we care about for curve evaluation.
3
+ * From https://www.particleincell.com/2013/cubic-line-intersection/
4
+ */
5
+ export declare function cubicRoots(P: [number, number, number, number]): number[];
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Cubic equation solver. Only returns real root between 0 and 1, which is the only case we care about for curve evaluation.
3
+ * From https://www.particleincell.com/2013/cubic-line-intersection/
4
+ */
5
+ export declare function cubicRoots(P: [number, number, number, number]): number[];
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.cubicRoots = cubicRoots;
7
+ /**
8
+ * Cubic equation solver. Only returns real root between 0 and 1, which is the only case we care about for curve evaluation.
9
+ * From https://www.particleincell.com/2013/cubic-line-intersection/
10
+ */
11
+ function cubicRoots(P) {
12
+ const a = P[0];
13
+ const b = P[1];
14
+ const c = P[2];
15
+ const d = P[3];
16
+ if (a === 0) {
17
+ if (b === 0) {
18
+ if (c === 0) {
19
+ return []; // constant case
20
+ }
21
+ return [-d / c].filter(r => r >= 0 && r <= 1); // linear case
22
+ }
23
+
24
+ // quadratic case
25
+ const discriminant = c * c - 4 * b * d;
26
+ if (discriminant < 0) {
27
+ return [];
28
+ }
29
+ const sqrtDisc = Math.sqrt(discriminant);
30
+ return [(-c + sqrtDisc) / (2 * b), (-c - sqrtDisc) / (2 * b)].filter(r => r >= 0 && r <= 1);
31
+ }
32
+
33
+ // cubic case
34
+
35
+ const A = b / a;
36
+ const B = c / a;
37
+ const C = d / a;
38
+ const Q = (3 * B - Math.pow(A, 2)) / 9;
39
+ const R = (9 * A * B - 27 * C - 2 * Math.pow(A, 3)) / 54;
40
+ const D = Math.pow(Q, 3) + Math.pow(R, 2); // polynomial discriminant
41
+
42
+ const result = [];
43
+ if (D >= 0)
44
+ // complex or duplicate roots
45
+ {
46
+ const S = Math.sign(R + Math.sqrt(D)) * Math.pow(Math.abs(R + Math.sqrt(D)), 1 / 3);
47
+ const T = Math.sign(R - Math.sqrt(D)) * Math.pow(Math.abs(R - Math.sqrt(D)), 1 / 3);
48
+ result.push(-A / 3 + (S + T)); // real root
49
+
50
+ if (S - T !== 0) {
51
+ return result.filter(r => r >= 0 && r <= 1);
52
+ }
53
+ result.push(-A / 3 - (S + T) / 2); // real part of complex root
54
+ result.push(-A / 3 - (S + T) / 2); // real part of complex root
55
+ return result.filter(r => r >= 0 && r <= 1);
56
+ }
57
+ const th = Math.acos(R / Math.sqrt(-Math.pow(Q, 3)));
58
+ result.push(2 * Math.sqrt(-Q) * Math.cos(th / 3) - A / 3);
59
+ result.push(2 * Math.sqrt(-Q) * Math.cos((th + 2 * Math.PI) / 3) - A / 3);
60
+ result.push(2 * Math.sqrt(-Q) * Math.cos((th + 4 * Math.PI) / 3) - A / 3);
61
+ return result.filter(r => r >= 0 && r <= 1);
62
+ }
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Cubic equation solver. Only returns real root between 0 and 1, which is the only case we care about for curve evaluation.
3
+ * From https://www.particleincell.com/2013/cubic-line-intersection/
4
+ */
5
+ export function cubicRoots(P) {
6
+ const a = P[0];
7
+ const b = P[1];
8
+ const c = P[2];
9
+ const d = P[3];
10
+ if (a === 0) {
11
+ if (b === 0) {
12
+ if (c === 0) {
13
+ return []; // constant case
14
+ }
15
+ return [-d / c].filter(r => r >= 0 && r <= 1); // linear case
16
+ }
17
+
18
+ // quadratic case
19
+ const discriminant = c * c - 4 * b * d;
20
+ if (discriminant < 0) {
21
+ return [];
22
+ }
23
+ const sqrtDisc = Math.sqrt(discriminant);
24
+ return [(-c + sqrtDisc) / (2 * b), (-c - sqrtDisc) / (2 * b)].filter(r => r >= 0 && r <= 1);
25
+ }
26
+
27
+ // cubic case
28
+
29
+ const A = b / a;
30
+ const B = c / a;
31
+ const C = d / a;
32
+ const Q = (3 * B - Math.pow(A, 2)) / 9;
33
+ const R = (9 * A * B - 27 * C - 2 * Math.pow(A, 3)) / 54;
34
+ const D = Math.pow(Q, 3) + Math.pow(R, 2); // polynomial discriminant
35
+
36
+ const result = [];
37
+ if (D >= 0)
38
+ // complex or duplicate roots
39
+ {
40
+ const S = Math.sign(R + Math.sqrt(D)) * Math.pow(Math.abs(R + Math.sqrt(D)), 1 / 3);
41
+ const T = Math.sign(R - Math.sqrt(D)) * Math.pow(Math.abs(R - Math.sqrt(D)), 1 / 3);
42
+ result.push(-A / 3 + (S + T)); // real root
43
+
44
+ if (S - T !== 0) {
45
+ return result.filter(r => r >= 0 && r <= 1);
46
+ }
47
+ result.push(-A / 3 - (S + T) / 2); // real part of complex root
48
+ result.push(-A / 3 - (S + T) / 2); // real part of complex root
49
+ return result.filter(r => r >= 0 && r <= 1);
50
+ }
51
+ const th = Math.acos(R / Math.sqrt(-Math.pow(Q, 3)));
52
+ result.push(2 * Math.sqrt(-Q) * Math.cos(th / 3) - A / 3);
53
+ result.push(2 * Math.sqrt(-Q) * Math.cos((th + 2 * Math.PI) / 3) - A / 3);
54
+ result.push(2 * Math.sqrt(-Q) * Math.cos((th + 4 * Math.PI) / 3) - A / 3);
55
+ return result.filter(r => r >= 0 && r <= 1);
56
+ }
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns the index of the entry in `axisData` whose numeric value is closest
3
+ * to `valueAsNumber`. Returns -1 if `axisData` is empty.
4
+ */
5
+ export declare function findClosestIndex(axisData: readonly any[], valueAsNumber: number): number;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Returns the index of the entry in `axisData` whose numeric value is closest
3
+ * to `valueAsNumber`. Returns -1 if `axisData` is empty.
4
+ */
5
+ export declare function findClosestIndex(axisData: readonly any[], valueAsNumber: number): number;
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.findClosestIndex = findClosestIndex;
7
+ var _getAsNumber = require("./getAsNumber");
8
+ /**
9
+ * Returns the index of the entry in `axisData` whose numeric value is closest
10
+ * to `valueAsNumber`. Returns -1 if `axisData` is empty.
11
+ */
12
+ function findClosestIndex(axisData, valueAsNumber) {
13
+ return axisData.findIndex((pointValue, index) => {
14
+ const v = (0, _getAsNumber.getAsNumber)(pointValue);
15
+ if (v > valueAsNumber) {
16
+ if (index === 0 || Math.abs(valueAsNumber - v) <= Math.abs(valueAsNumber - (0, _getAsNumber.getAsNumber)(axisData[index - 1]))) {
17
+ return true;
18
+ }
19
+ }
20
+ if (v <= valueAsNumber) {
21
+ if (index === axisData.length - 1 || Math.abs(valueAsNumber - v) < Math.abs(valueAsNumber - (0, _getAsNumber.getAsNumber)(axisData[index + 1]))) {
22
+ return true;
23
+ }
24
+ }
25
+ return false;
26
+ });
27
+ }
@@ -0,0 +1,22 @@
1
+ import { getAsNumber } from "./getAsNumber.mjs";
2
+
3
+ /**
4
+ * Returns the index of the entry in `axisData` whose numeric value is closest
5
+ * to `valueAsNumber`. Returns -1 if `axisData` is empty.
6
+ */
7
+ export function findClosestIndex(axisData, valueAsNumber) {
8
+ return axisData.findIndex((pointValue, index) => {
9
+ const v = getAsNumber(pointValue);
10
+ if (v > valueAsNumber) {
11
+ if (index === 0 || Math.abs(valueAsNumber - v) <= Math.abs(valueAsNumber - getAsNumber(axisData[index - 1]))) {
12
+ return true;
13
+ }
14
+ }
15
+ if (v <= valueAsNumber) {
16
+ if (index === axisData.length - 1 || Math.abs(valueAsNumber - v) < Math.abs(valueAsNumber - getAsNumber(axisData[index + 1]))) {
17
+ return true;
18
+ }
19
+ }
20
+ return false;
21
+ });
22
+ }
@@ -0,0 +1 @@
1
+ export declare function getAsNumber(value: number | Date): number;
@@ -0,0 +1 @@
1
+ export declare function getAsNumber(value: number | Date): number;
@@ -0,0 +1,9 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getAsNumber = getAsNumber;
7
+ function getAsNumber(value) {
8
+ return value instanceof Date ? value.getTime() : value;
9
+ }
@@ -0,0 +1,3 @@
1
+ export function getAsNumber(value) {
2
+ return value instanceof Date ? value.getTime() : value;
3
+ }
@@ -17,6 +17,7 @@ export { processBarDataForPlot } from "../BarChart/useBarPlotData.mjs";
17
17
  export { useRadarChartProps } from "../RadarChart/useRadarChartProps.mjs";
18
18
  export * from "../ChartsContainer/useChartsContainerProps.mjs";
19
19
  export * from "../ChartsDataProvider/useChartsDataProviderProps.mjs";
20
+ export * from "../ChartsRadialDataProvider/useChartsRadialDataProviderProps.mjs";
20
21
  export * from "./seriesSelectorOfType.mjs";
21
22
  export { useSkipAnimation } from "../hooks/useSkipAnimation.mjs";
22
23
  export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.mjs";
@@ -54,6 +55,7 @@ export * from "./isDefined.mjs";
54
55
  export * from "./getScale.mjs";
55
56
  export * from "./stacking/index.mjs";
56
57
  export * from "./getCurve.mjs";
58
+ export * from "./getSymbol.mjs";
57
59
  export * from "./consumeSlots.mjs";
58
60
  export * from "./consumeThemeProps.mjs";
59
61
  export * from "./defaultizeMargin.mjs";
@@ -75,6 +77,8 @@ export * from "../context/ChartsProvider/index.mjs";
75
77
  export * from "../context/ChartsSlotsContext.mjs";
76
78
  export * from "../models/seriesType/config.mjs";
77
79
  export * from "../models/seriesType/common.mjs";
80
+ export * from "../models/seriesType/line.mjs";
81
+ export * from "../models/seriesType/bar.mjs";
78
82
  export * from "../models/z-axis.mjs";
79
83
  export * from "../models/axis.mjs";
80
84
  export * from "../models/seriesType/composition.mjs";
@@ -84,4 +88,5 @@ export * from "./createSvgIcon.mjs";
84
88
  export * from "./constants.mjs";
85
89
  export * from "./scales/index.mjs";
86
90
  export * from "./identifierSerializer.mjs";
87
- export * from "./identifierCleaner.mjs";
91
+ export * from "./identifierCleaner.mjs";
92
+ export { default as getLineItemAtPosition } from "../LineChart/seriesConfig/getItemAtPosition.mjs";
@@ -17,6 +17,7 @@ export { processBarDataForPlot } from "../BarChart/useBarPlotData.js";
17
17
  export { useRadarChartProps } from "../RadarChart/useRadarChartProps.js";
18
18
  export * from "../ChartsContainer/useChartsContainerProps.js";
19
19
  export * from "../ChartsDataProvider/useChartsDataProviderProps.js";
20
+ export * from "../ChartsRadialDataProvider/useChartsRadialDataProviderProps.js";
20
21
  export * from "./seriesSelectorOfType.js";
21
22
  export { useSkipAnimation } from "../hooks/useSkipAnimation.js";
22
23
  export { useRegisterPointerInteractions } from "./plugins/featurePlugins/shared/useRegisterPointerInteractions.js";
@@ -54,6 +55,7 @@ export * from "./isDefined.js";
54
55
  export * from "./getScale.js";
55
56
  export * from "./stacking/index.js";
56
57
  export * from "./getCurve.js";
58
+ export * from "./getSymbol.js";
57
59
  export * from "./consumeSlots.js";
58
60
  export * from "./consumeThemeProps.js";
59
61
  export * from "./defaultizeMargin.js";
@@ -75,6 +77,8 @@ export * from "../context/ChartsProvider/index.js";
75
77
  export * from "../context/ChartsSlotsContext.js";
76
78
  export * from "../models/seriesType/config.js";
77
79
  export * from "../models/seriesType/common.js";
80
+ export * from "../models/seriesType/line.js";
81
+ export * from "../models/seriesType/bar.js";
78
82
  export * from "../models/z-axis.js";
79
83
  export * from "../models/axis.js";
80
84
  export * from "../models/seriesType/composition.js";
@@ -84,4 +88,5 @@ export * from "./createSvgIcon.js";
84
88
  export * from "./constants.js";
85
89
  export * from "./scales/index.js";
86
90
  export * from "./identifierSerializer.js";
87
- export * from "./identifierCleaner.js";
91
+ export * from "./identifierCleaner.js";
92
+ export { default as getLineItemAtPosition } from "../LineChart/seriesConfig/getItemAtPosition.js";