@mui/x-charts 8.7.0 → 8.9.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 (248) hide show
  1. package/BarChart/BarChart.d.ts +4 -3
  2. package/BarChart/BarChart.js +17 -1
  3. package/BarChart/barClasses.d.ts +1 -1
  4. package/BarChart/seriesConfig/seriesProcessor.js +5 -3
  5. package/BarChart/useBarPlotData.js +32 -5
  6. package/CHANGELOG.md +199 -24
  7. package/ChartContainer/ChartContainer.js +22 -0
  8. package/ChartContainer/useChartContainerProps.js +8 -2
  9. package/ChartDataProvider/ChartDataProvider.js +6 -0
  10. package/ChartDataProvider/useChartDataProviderProps.d.ts +1 -1
  11. package/ChartDataProvider/useChartDataProviderProps.js +6 -1
  12. package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +1 -1
  13. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +34 -24
  14. package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +1 -1
  15. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +34 -24
  16. package/ChartsLabel/ChartsLabelMark.d.ts +2 -1
  17. package/ChartsLabel/index.d.ts +1 -0
  18. package/ChartsLabel/index.js +18 -0
  19. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  20. package/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
  21. package/Gauge/GaugeContainer.d.ts +1 -1
  22. package/LineChart/LineChart.d.ts +3 -2
  23. package/LineChart/LineChart.js +23 -1
  24. package/LineChart/LineHighlightPlot.js +10 -4
  25. package/LineChart/MarkPlot.js +17 -3
  26. package/LineChart/useAreaPlotData.js +3 -2
  27. package/PieChart/PieArcLabelPlot.js +3 -0
  28. package/PieChart/PieArcPlot.js +3 -0
  29. package/PieChart/PieChart.d.ts +4 -3
  30. package/PieChart/PieChart.js +1 -1
  31. package/PieChart/pieClasses.d.ts +1 -1
  32. package/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +3 -5
  33. package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.d.ts +2 -13
  34. package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +8 -45
  35. package/RadarChart/RadarChart.d.ts +2 -1
  36. package/RadarChart/RadarChart.js +23 -2
  37. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +4 -3
  38. package/RadarChart/RadarMetricLabels/useRadarMetricData.js +4 -2
  39. package/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +19 -3
  40. package/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +20 -4
  41. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +38 -4
  42. package/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +32 -3
  43. package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.d.ts +8 -0
  44. package/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +38 -0
  45. package/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
  46. package/RadarChart/index.d.ts +1 -1
  47. package/RadarChart/useRadarChartProps.d.ts +3 -0
  48. package/RadarChart/useRadarChartProps.js +15 -3
  49. package/ScatterChart/ScatterChart.d.ts +4 -3
  50. package/ScatterChart/ScatterChart.js +1 -1
  51. package/ScatterChart/ScatterPlot.js +2 -2
  52. package/ScatterChart/seriesConfig/seriesProcessor.js +3 -0
  53. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  54. package/SparkLineChart/SparkLineChart.js +16 -0
  55. package/esm/BarChart/BarChart.d.ts +4 -3
  56. package/esm/BarChart/BarChart.js +17 -1
  57. package/esm/BarChart/barClasses.d.ts +1 -1
  58. package/esm/BarChart/seriesConfig/seriesProcessor.js +5 -3
  59. package/esm/BarChart/useBarPlotData.js +32 -5
  60. package/esm/ChartContainer/ChartContainer.js +22 -0
  61. package/esm/ChartContainer/useChartContainerProps.js +8 -2
  62. package/esm/ChartDataProvider/ChartDataProvider.js +6 -0
  63. package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +1 -1
  64. package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -2
  65. package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +1 -1
  66. package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +36 -26
  67. package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +1 -1
  68. package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +36 -26
  69. package/esm/ChartsLabel/ChartsLabelMark.d.ts +2 -1
  70. package/esm/ChartsLabel/index.d.ts +1 -0
  71. package/esm/ChartsLabel/index.js +1 -0
  72. package/esm/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  73. package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
  74. package/esm/Gauge/GaugeContainer.d.ts +1 -1
  75. package/esm/LineChart/LineChart.d.ts +3 -2
  76. package/esm/LineChart/LineChart.js +23 -1
  77. package/esm/LineChart/LineHighlightPlot.js +11 -5
  78. package/esm/LineChart/MarkPlot.js +17 -3
  79. package/esm/LineChart/useAreaPlotData.js +3 -2
  80. package/esm/PieChart/PieArcLabelPlot.js +3 -0
  81. package/esm/PieChart/PieArcPlot.js +3 -0
  82. package/esm/PieChart/PieChart.d.ts +4 -3
  83. package/esm/PieChart/PieChart.js +1 -1
  84. package/esm/PieChart/pieClasses.d.ts +1 -1
  85. package/esm/RadarChart/RadarAxisHighlight/RadarAxisHighlight.js +3 -5
  86. package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.d.ts +2 -13
  87. package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +8 -45
  88. package/esm/RadarChart/RadarChart.d.ts +2 -1
  89. package/esm/RadarChart/RadarChart.js +23 -2
  90. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +4 -3
  91. package/esm/RadarChart/RadarMetricLabels/useRadarMetricData.js +4 -2
  92. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesArea.js +19 -3
  93. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesMarks.js +20 -4
  94. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.js +38 -4
  95. package/esm/RadarChart/RadarSeriesPlot/RadarSeriesPlot.types.d.ts +32 -3
  96. package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.d.ts +8 -0
  97. package/esm/RadarChart/RadarSeriesPlot/useRadarRotationIndex.js +32 -0
  98. package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.d.ts +2 -2
  99. package/esm/RadarChart/index.d.ts +1 -1
  100. package/esm/RadarChart/useRadarChartProps.d.ts +3 -0
  101. package/esm/RadarChart/useRadarChartProps.js +15 -3
  102. package/esm/ScatterChart/ScatterChart.d.ts +4 -3
  103. package/esm/ScatterChart/ScatterChart.js +1 -1
  104. package/esm/ScatterChart/ScatterPlot.js +2 -2
  105. package/esm/ScatterChart/seriesConfig/seriesProcessor.js +3 -0
  106. package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
  107. package/esm/SparkLineChart/SparkLineChart.js +16 -0
  108. package/esm/hooks/useAxis.d.ts +2 -2
  109. package/esm/hooks/useTicks.d.ts +6 -1
  110. package/esm/hooks/useTicks.js +94 -58
  111. package/esm/index.js +1 -1
  112. package/esm/internals/constants.d.ts +3 -0
  113. package/esm/internals/constants.js +4 -0
  114. package/esm/internals/getLabel.d.ts +1 -1
  115. package/esm/internals/index.d.ts +1 -0
  116. package/esm/internals/index.js +1 -0
  117. package/esm/internals/plugins/corePlugins/corePlugins.d.ts +3 -2
  118. package/esm/internals/plugins/corePlugins/corePlugins.js +2 -1
  119. package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
  120. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
  121. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/index.d.ts +3 -0
  122. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/index.js +2 -0
  123. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +3 -0
  124. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js +27 -0
  125. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +8 -0
  126. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +3 -0
  127. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +21 -0
  128. package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js +1 -0
  129. package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
  130. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
  131. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
  132. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -2
  133. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +1 -0
  134. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
  135. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +7 -0
  136. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.js +14 -0
  137. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +2 -0
  138. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +2 -0
  139. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
  140. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +46 -3
  141. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +18 -1
  142. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -0
  143. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +76 -0
  144. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -5
  145. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -5
  146. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +47 -0
  147. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +48 -0
  148. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +18 -12
  149. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +16 -2
  150. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +6 -1
  151. package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
  152. package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.js +19 -11
  153. package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
  154. package/esm/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.js +19 -11
  155. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
  156. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -4
  157. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +4 -4
  158. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
  159. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +44 -1
  160. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
  161. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +8 -1
  162. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +7 -8
  163. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
  164. package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
  165. package/esm/internals/plugins/utils/useLazySelectorEffect.d.ts +7 -0
  166. package/esm/internals/plugins/utils/useLazySelectorEffect.js +70 -0
  167. package/esm/internals/store/useCharts.d.ts +1 -1
  168. package/esm/models/axis.d.ts +42 -1
  169. package/esm/models/axis.js +4 -0
  170. package/esm/models/index.d.ts +1 -1
  171. package/esm/models/seriesType/bar.d.ts +11 -1
  172. package/esm/models/seriesType/common.d.ts +9 -3
  173. package/esm/models/seriesType/line.d.ts +3 -1
  174. package/esm/models/seriesType/scatter.d.ts +14 -2
  175. package/esm/tests/web-components.js +49 -0
  176. package/esm/themeAugmentation/components.d.ts +3 -0
  177. package/esm/themeAugmentation/props.d.ts +2 -0
  178. package/hooks/useAxis.d.ts +2 -2
  179. package/hooks/useTicks.d.ts +6 -1
  180. package/hooks/useTicks.js +95 -58
  181. package/index.js +1 -1
  182. package/internals/constants.d.ts +3 -0
  183. package/internals/constants.js +5 -1
  184. package/internals/getLabel.d.ts +1 -1
  185. package/internals/index.d.ts +1 -0
  186. package/internals/index.js +8 -0
  187. package/internals/plugins/corePlugins/corePlugins.d.ts +3 -2
  188. package/internals/plugins/corePlugins/corePlugins.js +2 -1
  189. package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
  190. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
  191. package/internals/plugins/corePlugins/useChartExperimentalFeature/index.d.ts +3 -0
  192. package/internals/plugins/corePlugins/useChartExperimentalFeature/index.js +27 -0
  193. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +3 -0
  194. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js +34 -0
  195. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +8 -0
  196. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +10 -0
  197. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +21 -0
  198. package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js +5 -0
  199. package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
  200. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
  201. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
  202. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -2
  203. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +1 -0
  204. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -1
  205. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +7 -0
  206. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.js +21 -0
  207. package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +2 -0
  208. package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +24 -0
  209. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
  210. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +46 -3
  211. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +18 -1
  212. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -0
  213. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +82 -0
  214. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -5
  215. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -6
  216. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +47 -0
  217. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +55 -0
  218. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +18 -12
  219. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +18 -3
  220. package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +6 -1
  221. package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.d.ts +1 -1
  222. package/internals/plugins/featurePlugins/useChartHighlight/createIsFaded.js +20 -13
  223. package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.d.ts +1 -1
  224. package/internals/plugins/featurePlugins/useChartHighlight/createIsHighlighted.js +20 -13
  225. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
  226. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +10 -4
  227. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +4 -4
  228. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
  229. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +44 -1
  230. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
  231. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +8 -1
  232. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +7 -8
  233. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
  234. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
  235. package/internals/plugins/utils/useLazySelectorEffect.d.ts +7 -0
  236. package/internals/plugins/utils/useLazySelectorEffect.js +77 -0
  237. package/internals/store/useCharts.d.ts +1 -1
  238. package/models/axis.d.ts +42 -1
  239. package/models/axis.js +4 -0
  240. package/models/index.d.ts +1 -1
  241. package/models/seriesType/bar.d.ts +11 -1
  242. package/models/seriesType/common.d.ts +9 -3
  243. package/models/seriesType/line.d.ts +3 -1
  244. package/models/seriesType/scatter.d.ts +14 -2
  245. package/package.json +5 -5
  246. package/tests/web-components.js +55 -0
  247. package/themeAugmentation/components.d.ts +3 -0
  248. package/themeAugmentation/props.d.ts +2 -0
package/hooks/useTicks.js CHANGED
@@ -5,6 +5,7 @@ var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWild
5
5
  Object.defineProperty(exports, "__esModule", {
6
6
  value: true
7
7
  });
8
+ exports.getTicks = getTicks;
8
9
  exports.useTicks = useTicks;
9
10
  var React = _interopRequireWildcard(require("react"));
10
11
  var _ChartProvider = require("../context/ChartProvider");
@@ -16,7 +17,7 @@ const offsetRatio = {
16
17
  end: 1,
17
18
  middle: 0.5
18
19
  };
19
- function useTicks(options) {
20
+ function getTicks(options) {
20
21
  const {
21
22
  scale,
22
23
  tickNumber,
@@ -24,75 +25,111 @@ function useTicks(options) {
24
25
  tickInterval,
25
26
  tickPlacement = 'extremities',
26
27
  tickLabelPlacement: tickLabelPlacementProp,
27
- direction
28
+ isInside
28
29
  } = options;
29
- const {
30
- instance
31
- } = (0, _ChartProvider.useChartContext)();
32
- return React.useMemo(() => {
33
- // band scale
34
- if ((0, _isBandScale.isBandScale)(scale)) {
35
- const domain = scale.domain();
36
- const tickLabelPlacement = tickLabelPlacementProp ?? 'middle';
37
- if (scale.bandwidth() > 0) {
38
- // scale type = 'band'
39
- const filteredDomain = typeof tickInterval === 'function' && domain.filter(tickInterval) || typeof tickInterval === 'object' && tickInterval || domain;
40
- return [...filteredDomain.map(value => ({
30
+
31
+ // band scale
32
+ if ((0, _isBandScale.isBandScale)(scale)) {
33
+ const domain = scale.domain();
34
+ const tickLabelPlacement = tickLabelPlacementProp ?? 'middle';
35
+ if (scale.bandwidth() > 0) {
36
+ // scale type = 'band'
37
+ const filteredDomain = typeof tickInterval === 'function' && domain.filter(tickInterval) || typeof tickInterval === 'object' && tickInterval || domain;
38
+ return [...filteredDomain.map(value => {
39
+ const defaultTickLabel = `${value}`;
40
+ return {
41
41
  value,
42
42
  formattedValue: valueFormatter?.(value, {
43
43
  location: 'tick',
44
- scale
45
- }) ?? `${value}`,
44
+ scale,
45
+ tickNumber,
46
+ defaultTickLabel
47
+ }) ?? defaultTickLabel,
46
48
  offset: scale(value) - (scale.step() - scale.bandwidth()) / 2 + offsetRatio[tickPlacement] * scale.step(),
47
49
  labelOffset: tickLabelPlacement === 'tick' ? 0 : scale.step() * (offsetRatio[tickLabelPlacement] - offsetRatio[tickPlacement])
48
- })), ...(tickPlacement === 'extremities' ? [{
49
- formattedValue: undefined,
50
- offset: scale.range()[1],
51
- labelOffset: 0
52
- }] : [])];
53
- }
50
+ };
51
+ }), ...(tickPlacement === 'extremities' ? [{
52
+ formattedValue: undefined,
53
+ offset: scale.range()[1],
54
+ labelOffset: 0
55
+ }] : [])];
56
+ }
54
57
 
55
- // scale type = 'point'
56
- const filteredDomain = typeof tickInterval === 'function' && domain.filter(tickInterval) || typeof tickInterval === 'object' && tickInterval || domain;
57
- return filteredDomain.map(value => ({
58
+ // scale type = 'point'
59
+ const filteredDomain = typeof tickInterval === 'function' && domain.filter(tickInterval) || typeof tickInterval === 'object' && tickInterval || domain;
60
+ return filteredDomain.map(value => {
61
+ const defaultTickLabel = `${value}`;
62
+ return {
58
63
  value,
59
64
  formattedValue: valueFormatter?.(value, {
60
65
  location: 'tick',
61
- scale
62
- }) ?? `${value}`,
66
+ scale,
67
+ tickNumber,
68
+ defaultTickLabel
69
+ }) ?? defaultTickLabel,
63
70
  offset: scale(value),
64
71
  labelOffset: 0
65
- }));
66
- }
67
- const domain = scale.domain();
68
- // Skip axis rendering if no data is available
69
- // - The domains contains Infinity for continuous scales.
70
- if (domain.some(_isInfinity.isInfinity)) {
71
- return [];
72
- }
73
- const tickLabelPlacement = tickLabelPlacementProp;
74
- const ticks = typeof tickInterval === 'object' ? tickInterval : scale.ticks(tickNumber);
72
+ };
73
+ });
74
+ }
75
+ const domain = scale.domain();
76
+ // Skip axis rendering if no data is available
77
+ // - The domains contains Infinity for continuous scales.
78
+ if (domain.some(_isInfinity.isInfinity)) {
79
+ return [];
80
+ }
81
+ const tickLabelPlacement = tickLabelPlacementProp;
82
+ const ticks = typeof tickInterval === 'object' ? tickInterval : scale.ticks(tickNumber);
75
83
 
76
- // Ticks inside the drawing area
77
- const visibleTicks = [];
78
- for (let i = 0; i < ticks.length; i += 1) {
79
- const value = ticks[i];
80
- const offset = scale(value);
81
- const isInside = direction === 'x' ? instance.isXInside(offset) : instance.isYInside(offset);
82
- if (isInside) {
83
- visibleTicks.push({
84
- value,
85
- formattedValue: valueFormatter?.(value, {
86
- location: 'tick',
87
- scale
88
- }) ?? scale.tickFormat(tickNumber)(value),
89
- offset,
90
- // Allowing the label to be placed in the middle of a continuous scale is weird.
91
- // But it is useful in some cases, like funnel categories with a linear scale.
92
- labelOffset: tickLabelPlacement === 'middle' ? scale(ticks[i - 1] ?? 0) - (offset + scale(ticks[i - 1] ?? 0)) / 2 : 0
93
- });
94
- }
84
+ // Ticks inside the drawing area
85
+ const visibleTicks = [];
86
+ for (let i = 0; i < ticks.length; i += 1) {
87
+ const value = ticks[i];
88
+ const offset = scale(value);
89
+ if (isInside(offset)) {
90
+ /* If d3 returns an empty string, it means that a tick should be shown, but its label shouldn't.
91
+ * This is especially useful in a log scale where we want to show ticks to demonstrate it's a log
92
+ * scale, but don't want to show labels because they would overlap.
93
+ * https://github.com/mui/mui-x/issues/18239 */
94
+ const defaultTickLabel = scale.tickFormat(tickNumber)(value);
95
+ visibleTicks.push({
96
+ value,
97
+ formattedValue: valueFormatter?.(value, {
98
+ location: 'tick',
99
+ scale,
100
+ tickNumber,
101
+ defaultTickLabel
102
+ }) ?? defaultTickLabel,
103
+ offset,
104
+ // Allowing the label to be placed in the middle of a continuous scale is weird.
105
+ // But it is useful in some cases, like funnel categories with a linear scale.
106
+ labelOffset: tickLabelPlacement === 'middle' ? scale(ticks[i - 1] ?? 0) - (offset + scale(ticks[i - 1] ?? 0)) / 2 : 0
107
+ });
95
108
  }
96
- return visibleTicks;
97
- }, [scale, tickLabelPlacementProp, tickInterval, tickNumber, tickPlacement, valueFormatter, direction, instance]);
109
+ }
110
+ return visibleTicks;
111
+ }
112
+ function useTicks(options) {
113
+ const {
114
+ scale,
115
+ tickNumber,
116
+ valueFormatter,
117
+ tickInterval,
118
+ tickPlacement = 'extremities',
119
+ tickLabelPlacement,
120
+ direction
121
+ } = options;
122
+ const {
123
+ instance
124
+ } = (0, _ChartProvider.useChartContext)();
125
+ const isInside = direction === 'x' ? instance.isXInside : instance.isYInside;
126
+ return React.useMemo(() => getTicks({
127
+ scale,
128
+ tickNumber,
129
+ tickPlacement,
130
+ tickInterval,
131
+ tickLabelPlacement,
132
+ valueFormatter,
133
+ isInside
134
+ }), [scale, tickNumber, tickPlacement, tickInterval, tickLabelPlacement, valueFormatter, isInside]);
98
135
  }
package/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @mui/x-charts v8.7.0
2
+ * @mui/x-charts v8.9.0
3
3
  *
4
4
  * @license MIT
5
5
  * This source code is licensed under the MIT license found in the
@@ -1,8 +1,11 @@
1
1
  import type { ZoomSliderShowTooltip } from "./plugins/featurePlugins/useChartCartesianAxis/zoom.types.js";
2
2
  /** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
3
3
  export declare const ZOOM_SLIDER_MARGIN = 4;
4
+ /** Size of the zoom slider preview. */
5
+ export declare const ZOOM_SLIDER_PREVIEW_SIZE = 40;
4
6
  /** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
5
7
  export declare const DEFAULT_ZOOM_SLIDER_SIZE: number;
8
+ export declare const DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE: number;
6
9
  export declare const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP: ZoomSliderShowTooltip;
7
10
  /** Default margin for pie charts. */
8
11
  export declare const DEFAULT_PIE_CHART_MARGIN: {
@@ -3,12 +3,16 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
- exports.ZOOM_SLIDER_MARGIN = exports.DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = exports.DEFAULT_PIE_CHART_MARGIN = void 0;
6
+ exports.ZOOM_SLIDER_PREVIEW_SIZE = exports.ZOOM_SLIDER_MARGIN = exports.DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = exports.DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE = exports.DEFAULT_PIE_CHART_MARGIN = void 0;
7
7
  /** Margin in the opposite direction of the axis, i.e., horizontal if the axis is vertical and vice versa. */
8
8
  const ZOOM_SLIDER_MARGIN = exports.ZOOM_SLIDER_MARGIN = 4;
9
9
 
10
+ /** Size of the zoom slider preview. */
11
+ const ZOOM_SLIDER_PREVIEW_SIZE = exports.ZOOM_SLIDER_PREVIEW_SIZE = 40;
12
+
10
13
  /** Size reserved for the zoom slider. The actual size of the slider might be smaller. */
11
14
  const DEFAULT_ZOOM_SLIDER_SIZE = exports.DEFAULT_ZOOM_SLIDER_SIZE = 20 + 2 * ZOOM_SLIDER_MARGIN;
15
+ const DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE = exports.DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE = 40 + 2 * ZOOM_SLIDER_MARGIN;
12
16
  const DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = exports.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP = 'hover';
13
17
 
14
18
  /** Default margin for pie charts. */
@@ -1 +1 @@
1
- export declare function getLabel<Location extends string>(value: string | ((location: Location) => string) | undefined, location: Location): string | undefined;
1
+ export declare function getLabel<Location extends string>(value: string | ((location: Location) => string | undefined) | undefined, location: Location): string | undefined;
@@ -7,6 +7,7 @@ export { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
7
7
  export { useDrawingArea } from "../hooks/useDrawingArea.js";
8
8
  export { useScatterChartProps } from "../ScatterChart/useScatterChartProps.js";
9
9
  export { useScatterPlotData } from "../ScatterChart/useScatterPlotData.js";
10
+ export { seriesConfig as scatterSeriesConfig } from "../ScatterChart/seriesConfig/index.js";
10
11
  export { useLineChartProps } from "../LineChart/useLineChartProps.js";
11
12
  export { useAreaPlotData } from "../LineChart/useAreaPlotData.js";
12
13
  export { useLinePlotData } from "../LineChart/useLinePlotData.js";
@@ -9,6 +9,7 @@ var _exportNames = {
9
9
  useDrawingArea: true,
10
10
  useScatterChartProps: true,
11
11
  useScatterPlotData: true,
12
+ scatterSeriesConfig: true,
12
13
  useLineChartProps: true,
13
14
  useAreaPlotData: true,
14
15
  useLinePlotData: true,
@@ -37,6 +38,12 @@ Object.defineProperty(exports, "getCartesianAxisTriggerTooltip", {
37
38
  return _getAxisTriggerTooltip.getAxisTriggerTooltip;
38
39
  }
39
40
  });
41
+ Object.defineProperty(exports, "scatterSeriesConfig", {
42
+ enumerable: true,
43
+ get: function () {
44
+ return _seriesConfig.seriesConfig;
45
+ }
46
+ });
40
47
  Object.defineProperty(exports, "useAreaPlotData", {
41
48
  enumerable: true,
42
49
  get: function () {
@@ -156,6 +163,7 @@ var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
156
163
  var _useDrawingArea = require("../hooks/useDrawingArea");
157
164
  var _useScatterChartProps = require("../ScatterChart/useScatterChartProps");
158
165
  var _useScatterPlotData = require("../ScatterChart/useScatterPlotData");
166
+ var _seriesConfig = require("../ScatterChart/seriesConfig");
159
167
  var _useLineChartProps = require("../LineChart/useLineChartProps");
160
168
  var _useAreaPlotData = require("../LineChart/useAreaPlotData");
161
169
  var _useLinePlotData = require("../LineChart/useLinePlotData");
@@ -1,5 +1,6 @@
1
1
  import { type UseChartAnimationSignature } from "./useChartAnimation/index.js";
2
2
  import { type UseChartDimensionsSignature } from "./useChartDimensions/index.js";
3
+ import { type UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature/index.js";
3
4
  import { type UseChartIdSignature, UseChartIdParameters } from "./useChartId/index.js";
4
5
  import { type UseChartSeriesSignature } from "./useChartSeries/index.js";
5
6
  import { type UseChartInteractionListenerSignature } from "./useChartInteractionListener/index.js";
@@ -7,6 +8,6 @@ import { type UseChartInteractionListenerSignature } from "./useChartInteraction
7
8
  * Internal plugins that create the tools used by the other plugins.
8
9
  * These plugins are used by the Charts components.
9
10
  */
10
- export declare const CHART_CORE_PLUGINS: readonly [import("../models/index.js").ChartPlugin<UseChartIdSignature>, import("../models/index.js").ChartPlugin<UseChartDimensionsSignature>, import("../models/index.js").ChartPlugin<UseChartSeriesSignature>, import("../models/index.js").ChartPlugin<UseChartInteractionListenerSignature>, import("../models/index.js").ChartPlugin<UseChartAnimationSignature>];
11
- export type ChartCorePluginSignatures = [UseChartIdSignature, UseChartDimensionsSignature, UseChartSeriesSignature, UseChartAnimationSignature, UseChartInteractionListenerSignature];
11
+ export declare const CHART_CORE_PLUGINS: readonly [import("../models/index.js").ChartPlugin<UseChartIdSignature>, import("../models/index.js").ChartPlugin<UseChartExperimentalFeaturesSignature>, import("../models/index.js").ChartPlugin<UseChartDimensionsSignature>, import("../models/index.js").ChartPlugin<UseChartSeriesSignature>, import("../models/index.js").ChartPlugin<UseChartInteractionListenerSignature>, import("../models/index.js").ChartPlugin<UseChartAnimationSignature>];
12
+ export type ChartCorePluginSignatures = [UseChartIdSignature, UseChartExperimentalFeaturesSignature, UseChartDimensionsSignature, UseChartSeriesSignature, UseChartAnimationSignature, UseChartInteractionListenerSignature];
12
13
  export interface ChartCorePluginParameters extends UseChartIdParameters {}
@@ -6,6 +6,7 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.CHART_CORE_PLUGINS = void 0;
7
7
  var _useChartAnimation = require("./useChartAnimation");
8
8
  var _useChartDimensions = require("./useChartDimensions");
9
+ var _useChartExperimentalFeature = require("./useChartExperimentalFeature");
9
10
  var _useChartId = require("./useChartId");
10
11
  var _useChartSeries = require("./useChartSeries");
11
12
  var _useChartInteractionListener = require("./useChartInteractionListener");
@@ -13,4 +14,4 @@ var _useChartInteractionListener = require("./useChartInteractionListener");
13
14
  * Internal plugins that create the tools used by the other plugins.
14
15
  * These plugins are used by the Charts components.
15
16
  */
16
- const CHART_CORE_PLUGINS = exports.CHART_CORE_PLUGINS = [_useChartId.useChartId, _useChartDimensions.useChartDimensions, _useChartSeries.useChartSeries, _useChartInteractionListener.useChartInteractionListener, _useChartAnimation.useChartAnimation];
17
+ const CHART_CORE_PLUGINS = exports.CHART_CORE_PLUGINS = [_useChartId.useChartId, _useChartExperimentalFeature.useChartExperimentalFeatures, _useChartDimensions.useChartDimensions, _useChartSeries.useChartSeries, _useChartInteractionListener.useChartInteractionListener, _useChartAnimation.useChartAnimation];
@@ -1,4 +1,4 @@
1
- export declare const selectorChartSkipAnimation: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("./useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
1
+ export declare const selectorChartSkipAnimation: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("./useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
2
2
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
3
3
  } & {
4
4
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
@@ -3,7 +3,7 @@ import type { UseChartDimensionsSignature } from "./useChartDimensions.types.js"
3
3
  import { ChartState } from "../../models/chart.js";
4
4
  export declare const selectorChartDimensionsState: ChartRootSelector<UseChartDimensionsSignature>;
5
5
  export declare const selectorChartMargin: (state: ChartState<[UseChartDimensionsSignature]>) => import("./useChartDimensions.types.js").ChartMargin;
6
- export declare const selectorChartDrawingArea: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
6
+ export declare const selectorChartDrawingArea: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
7
7
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
8
8
  } & Partial<import("../../../index.js").UseChartCartesianAxisState> & {
9
9
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
@@ -15,7 +15,7 @@ export declare const selectorChartDrawingArea: import("reselect").Selector<impor
15
15
  top: number;
16
16
  bottom: number;
17
17
  }, []>;
18
- export declare const selectorChartPropsSize: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
18
+ export declare const selectorChartPropsSize: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
19
19
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
20
20
  } & {
21
21
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
@@ -23,7 +23,7 @@ export declare const selectorChartPropsSize: import("reselect").Selector<import(
23
23
  width: number | undefined;
24
24
  height: number | undefined;
25
25
  }, any[]>;
26
- export declare const selectorChartContainerSize: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
26
+ export declare const selectorChartContainerSize: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("./useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
27
27
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
28
28
  } & {
29
29
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
@@ -0,0 +1,3 @@
1
+ export { useChartExperimentalFeatures } from "./useChartExperimentalFeature.js";
2
+ export type { UseChartExperimentalFeaturesSignature, UseChartExperimentalFeaturesParameters } from "./useChartExperimentalFeature.types.js";
3
+ export * from "./useChartExperimentalFeature.selectors.js";
@@ -0,0 +1,27 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ var _exportNames = {
7
+ useChartExperimentalFeatures: true
8
+ };
9
+ Object.defineProperty(exports, "useChartExperimentalFeatures", {
10
+ enumerable: true,
11
+ get: function () {
12
+ return _useChartExperimentalFeature.useChartExperimentalFeatures;
13
+ }
14
+ });
15
+ var _useChartExperimentalFeature = require("./useChartExperimentalFeature");
16
+ var _useChartExperimentalFeature2 = require("./useChartExperimentalFeature.selectors");
17
+ Object.keys(_useChartExperimentalFeature2).forEach(function (key) {
18
+ if (key === "default" || key === "__esModule") return;
19
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
20
+ if (key in exports && exports[key] === _useChartExperimentalFeature2[key]) return;
21
+ Object.defineProperty(exports, key, {
22
+ enumerable: true,
23
+ get: function () {
24
+ return _useChartExperimentalFeature2[key];
25
+ }
26
+ });
27
+ });
@@ -0,0 +1,3 @@
1
+ import { ChartPlugin } from "../../models/index.js";
2
+ import type { UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature.types.js";
3
+ export declare const useChartExperimentalFeatures: ChartPlugin<UseChartExperimentalFeaturesSignature>;
@@ -0,0 +1,34 @@
1
+ "use strict";
2
+ 'use client';
3
+
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.useChartExperimentalFeatures = void 0;
9
+ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
10
+ var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
11
+ const useChartExperimentalFeatures = ({
12
+ params,
13
+ store
14
+ }) => {
15
+ (0, _useEnhancedEffect.default)(() => {
16
+ store.update(prevState => {
17
+ return (0, _extends2.default)({}, prevState, {
18
+ experimentalFeatures: params.experimentalFeatures
19
+ });
20
+ });
21
+ }, [store, params.experimentalFeatures]);
22
+ return {};
23
+ };
24
+ exports.useChartExperimentalFeatures = useChartExperimentalFeatures;
25
+ useChartExperimentalFeatures.params = {
26
+ experimentalFeatures: true
27
+ };
28
+ useChartExperimentalFeatures.getInitialState = ({
29
+ experimentalFeatures
30
+ }) => {
31
+ return {
32
+ experimentalFeatures
33
+ };
34
+ };
@@ -0,0 +1,8 @@
1
+ import { ChartRootSelector } from "../../utils/selectors.js";
2
+ import type { UseChartExperimentalFeaturesSignature } from "./useChartExperimentalFeature.types.js";
3
+ export declare const selectorChartExperimentalFeaturesState: ChartRootSelector<UseChartExperimentalFeaturesSignature>;
4
+ export declare const selectorPreferStrictDomainInLineCharts: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("./useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
5
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
6
+ } & {
7
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
8
+ }, boolean, any[]>;
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.selectorPreferStrictDomainInLineCharts = exports.selectorChartExperimentalFeaturesState = void 0;
7
+ var _selectors = require("../../utils/selectors");
8
+ const selectorChartExperimentalFeaturesState = state => state.experimentalFeatures;
9
+ exports.selectorChartExperimentalFeaturesState = selectorChartExperimentalFeaturesState;
10
+ const selectorPreferStrictDomainInLineCharts = exports.selectorPreferStrictDomainInLineCharts = (0, _selectors.createSelector)([selectorChartExperimentalFeaturesState], features => Boolean(features?.preferStrictDomainInLineCharts));
@@ -0,0 +1,21 @@
1
+ import { ChartPluginSignature } from "../../models/index.js";
2
+ export interface ChartExperimentalFeatures {
3
+ /**
4
+ * Default domainLimit to strict for line chart x-axis.
5
+ */
6
+ preferStrictDomainInLineCharts?: boolean;
7
+ }
8
+ export interface UseChartExperimentalFeaturesParameters {
9
+ /**
10
+ * Options to enable features planned for the next major.
11
+ */
12
+ experimentalFeatures?: ChartExperimentalFeatures;
13
+ }
14
+ export interface UseChartExperimentalFeaturesState {
15
+ experimentalFeatures?: ChartExperimentalFeatures;
16
+ }
17
+ export type UseChartExperimentalFeaturesSignature = ChartPluginSignature<{
18
+ params: UseChartExperimentalFeaturesParameters;
19
+ defaultizedParams: UseChartExperimentalFeaturesParameters;
20
+ state: UseChartExperimentalFeaturesState;
21
+ }>;
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -3,7 +3,7 @@
3
3
  * @param {ChartState<[UseChartIdSignature]>} state The state of the chart.
4
4
  * @returns {string} The id attribute of the chart.
5
5
  */
6
- export declare const selectorChartId: import("reselect").Selector<import("./useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
6
+ export declare const selectorChartId: import("reselect").Selector<import("./useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
7
7
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
8
8
  } & {
9
9
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
@@ -1,12 +1,12 @@
1
1
  import { ChartRootSelector } from "../../utils/selectors.js";
2
2
  import { UseChartSeriesSignature } from "./useChartSeries.types.js";
3
3
  export declare const selectorChartSeriesState: ChartRootSelector<UseChartSeriesSignature>;
4
- export declare const selectorChartSeriesProcessed: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
4
+ export declare const selectorChartSeriesProcessed: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
5
5
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
6
6
  } & {
7
7
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
8
8
  }, import("./useChartSeries.types.js").ProcessedSeries<keyof import("../../../index.js").ChartsSeriesConfig>, any[]>;
9
- export declare const selectorChartSeriesConfig: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
9
+ export declare const selectorChartSeriesConfig: import("reselect").Selector<import("../useChartId/useChartId.types.js").UseChartIdState & import("../useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("./useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../useChartInteractionListener/index.js").UseChartInteractionListenerState & Partial<{}> & {
10
10
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
11
11
  } & {
12
12
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
@@ -7,7 +7,7 @@ import { ProcessedSeries } from "../../corePlugins/useChartSeries/useChartSeries
7
7
  import { GetZoomAxisFilters, ZoomData } from "./zoom.types.js";
8
8
  export type ComputeResult<T extends ChartsAxisProps> = {
9
9
  axis: ComputedAxisConfig<T>;
10
- axisIds: string[];
10
+ axisIds: AxisId[];
11
11
  };
12
12
  type ComputeCommonParams<T extends ChartSeriesType = ChartSeriesType> = {
13
13
  drawingArea: ChartDrawingArea;
@@ -16,6 +16,10 @@ type ComputeCommonParams<T extends ChartSeriesType = ChartSeriesType> = {
16
16
  zoomMap?: Map<AxisId, ZoomData>;
17
17
  zoomOptions?: Record<AxisId, DefaultizedZoomOptions>;
18
18
  getFilters?: GetZoomAxisFilters;
19
+ /**
20
+ * @deprecated To remove in v9. This is an experimental feature to avoid breaking change.
21
+ */
22
+ preferStrictDomainInLineCharts?: boolean;
19
23
  };
20
24
  export declare function computeAxisValue<T extends ChartSeriesType>(options: ComputeCommonParams<T> & {
21
25
  axis?: DefaultedYAxis[];
@@ -16,6 +16,7 @@ var _dateHelpers = require("../../../dateHelpers");
16
16
  var _zoom = require("./zoom");
17
17
  var _getAxisExtremum = require("./getAxisExtremum");
18
18
  var _getAxisTriggerTooltip = require("./getAxisTriggerTooltip");
19
+ var _getAxisDomainLimit = require("./getAxisDomainLimit");
19
20
  function getRange(drawingArea, axisDirection,
20
21
  // | 'rotation' | 'radius',
21
22
  axis) {
@@ -32,7 +33,8 @@ function computeAxisValue({
32
33
  axisDirection,
33
34
  zoomMap,
34
35
  zoomOptions,
35
- getFilters
36
+ getFilters,
37
+ preferStrictDomainInLineCharts
36
38
  }) {
37
39
  if (allAxis === undefined) {
38
40
  return {
@@ -102,7 +104,7 @@ function computeAxisValue({
102
104
  return;
103
105
  }
104
106
  const scaleType = axis.scaleType ?? 'linear';
105
- const domainLimit = axis.domainLimit ?? 'nice';
107
+ const domainLimit = preferStrictDomainInLineCharts ? (0, _getAxisDomainLimit.getAxisDomainLimit)(axis, axisDirection, axisIndex, formattedSeries) : axis.domainLimit ?? 'nice';
106
108
  const axisExtremums = [axis.min ?? minData, axis.max ?? maxData];
107
109
  if (typeof domainLimit === 'function') {
108
110
  const {
@@ -11,6 +11,7 @@ export declare const defaultZoomOptions: {
11
11
  filterMode: "keep";
12
12
  slider: {
13
13
  enabled: false;
14
+ preview: false;
14
15
  size: number;
15
16
  showTooltip: import("./zoom.types.js").ZoomSliderShowTooltip;
16
17
  };
@@ -17,6 +17,7 @@ const defaultZoomOptions = exports.defaultZoomOptions = {
17
17
  filterMode: 'keep',
18
18
  slider: {
19
19
  enabled: false,
20
+ preview: false,
20
21
  size: _constants.DEFAULT_ZOOM_SLIDER_SIZE,
21
22
  showTooltip: _constants.DEFAULT_ZOOM_SLIDER_SHOW_TOOLTIP
22
23
  }
@@ -35,7 +36,9 @@ const defaultizeZoom = (zoom, axisId, axisDirection) => {
35
36
  axisId,
36
37
  axisDirection
37
38
  }, defaultZoomOptions, zoom, {
38
- slider: (0, _extends2.default)({}, defaultZoomOptions.slider, zoom.slider)
39
+ slider: (0, _extends2.default)({}, defaultZoomOptions.slider, {
40
+ size: zoom.slider?.preview ?? defaultZoomOptions.slider.preview ? _constants.DEFAULT_ZOOM_SLIDER_PREVIEW_SIZE : _constants.DEFAULT_ZOOM_SLIDER_SIZE
41
+ }, zoom.slider)
39
42
  });
40
43
  };
41
44
  exports.defaultizeZoom = defaultizeZoom;
@@ -0,0 +1,7 @@
1
+ import { AxisConfig } from "../../../../models/axis.js";
2
+ import { CartesianChartSeriesType } from "../../../../models/seriesType/config.js";
3
+ import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
4
+ export declare const getAxisDomainLimit: <T extends CartesianChartSeriesType>(axis: AxisConfig, axisDirection: "x" | "y", axisIndex: number, formattedSeries: ProcessedSeries<T | "line">) => "nice" | "strict" | ((min: number, max: number) => {
5
+ min: number;
6
+ max: number;
7
+ });
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.getAxisDomainLimit = void 0;
7
+ const getAxisDomainLimit = (axis, axisDirection, axisIndex, formattedSeries) => {
8
+ if (axis.domainLimit !== undefined) {
9
+ return axis.domainLimit;
10
+ }
11
+ if (axisDirection === 'x') {
12
+ for (const seriesId of formattedSeries.line?.seriesOrder ?? []) {
13
+ const series = formattedSeries.line.series[seriesId];
14
+ if (series.xAxisId === axis.id || series.xAxisId === undefined && axisIndex === 0) {
15
+ return 'strict';
16
+ }
17
+ }
18
+ }
19
+ return 'nice';
20
+ };
21
+ exports.getAxisDomainLimit = getAxisDomainLimit;
@@ -3,6 +3,8 @@ export type * from "./useChartCartesianAxis.types.js";
3
3
  export * from "./useChartCartesianAxisRendering.selectors.js";
4
4
  export * from "./useChartCartesianAxisLayout.selectors.js";
5
5
  export * from "./useChartCartesianInteraction.selectors.js";
6
+ export * from "./useChartCartesianHighlight.selectors.js";
7
+ export * from "./useChartCartesianAxisPreview.selectors.js";
6
8
  export { defaultizeXAxis, defaultizeYAxis } from "./defaultizeAxis.js";
7
9
  export * from "./computeAxisValue.js";
8
10
  export * from "./createZoomLookup.js";