@mui/x-charts 8.11.2 → 8.12.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 (330) hide show
  1. package/BarChart/BarChart.d.ts +2 -2
  2. package/BarChart/BarChart.js +1 -0
  3. package/BarChart/BarChart.plugins.d.ts +3 -2
  4. package/BarChart/BarChart.plugins.js +2 -1
  5. package/BarChart/BarElement.js +10 -2
  6. package/BarChart/index.d.ts +2 -0
  7. package/BarChart/index.js +12 -0
  8. package/BarChart/useBarChartProps.d.ts +2 -2
  9. package/BarChart/useBarChartProps.js +4 -3
  10. package/CHANGELOG.md +231 -0
  11. package/ChartContainer/ChartContainer.js +4 -2
  12. package/ChartContainer/useChartContainerProps.js +4 -2
  13. package/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
  14. package/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
  15. package/ChartsLegend/ChartsLegend.js +2 -1
  16. package/ChartsLegend/ContinuousColorLegend.js +1 -0
  17. package/ChartsLegend/PiecewiseColorLegend.d.ts +2 -2
  18. package/ChartsLegend/PiecewiseColorLegend.js +33 -22
  19. package/ChartsLegend/piecewiseColorLegendClasses.d.ts +4 -0
  20. package/ChartsLegend/piecewiseColorLegendClasses.js +2 -2
  21. package/ChartsSurface/ChartsSurface.js +22 -2
  22. package/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  23. package/ChartsWrapper/ChartsWrapper.js +87 -36
  24. package/ChartsXAxis/ChartsGroupedXAxisTicks.js +2 -2
  25. package/ChartsXAxis/ChartsXAxisImpl.js +3 -3
  26. package/ChartsXAxis/getVisibleLabels.js +5 -1
  27. package/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
  28. package/ChartsYAxis/ChartsGroupedYAxisTicks.js +2 -2
  29. package/ChartsYAxis/ChartsYAxisImpl.js +3 -3
  30. package/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
  31. package/LineChart/FocusedMark.d.ts +2 -0
  32. package/LineChart/FocusedMark.js +44 -0
  33. package/LineChart/LineChart.d.ts +2 -2
  34. package/LineChart/LineChart.js +3 -1
  35. package/LineChart/LineChart.plugins.d.ts +3 -2
  36. package/LineChart/LineChart.plugins.js +2 -1
  37. package/LineChart/index.d.ts +1 -0
  38. package/LineChart/index.js +12 -0
  39. package/LineChart/useAreaPlotData.js +2 -2
  40. package/LineChart/useLineChartProps.d.ts +2 -2
  41. package/LineChart/useLineChartProps.js +2 -1
  42. package/LineChart/useLinePlotData.js +2 -2
  43. package/PieChart/PieArc.d.ts +1 -0
  44. package/PieChart/PieArc.js +7 -3
  45. package/PieChart/PieArcPlot.js +1 -0
  46. package/PieChart/PieChart.js +2 -0
  47. package/PieChart/PieChart.plugins.d.ts +2 -1
  48. package/PieChart/PieChart.plugins.js +2 -1
  49. package/PieChart/dataTransform/useTransformData.d.ts +1 -0
  50. package/PieChart/dataTransform/useTransformData.js +9 -1
  51. package/PieChart/index.d.ts +1 -0
  52. package/PieChart/index.js +12 -0
  53. package/RadarChart/RadarAxis/useRadarAxis.js +2 -2
  54. package/RadarChart/RadarChart.plugins.d.ts +1 -1
  55. package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
  56. package/RadarChart/index.d.ts +2 -1
  57. package/RadarChart/index.js +12 -0
  58. package/RadarChart/useRadarChartProps.d.ts +2 -2
  59. package/RadarChart/useRadarChartProps.js +2 -1
  60. package/ScatterChart/BatchScatter.d.ts +32 -0
  61. package/ScatterChart/BatchScatter.js +171 -0
  62. package/ScatterChart/Scatter.js +13 -5
  63. package/ScatterChart/ScatterChart.d.ts +4 -4
  64. package/ScatterChart/ScatterChart.js +13 -2
  65. package/ScatterChart/ScatterChart.plugins.d.ts +4 -3
  66. package/ScatterChart/ScatterChart.plugins.js +3 -2
  67. package/ScatterChart/ScatterPlot.d.ts +10 -0
  68. package/ScatterChart/ScatterPlot.js +14 -2
  69. package/ScatterChart/index.d.ts +1 -0
  70. package/ScatterChart/index.js +12 -0
  71. package/ScatterChart/useScatterChartProps.d.ts +2 -2
  72. package/ScatterChart/useScatterChartProps.js +10 -6
  73. package/SparkLineChart/SparkLineChart.js +10 -5
  74. package/colorPalettes/types.d.ts +1 -1
  75. package/context/ChartApi.d.ts +6 -6
  76. package/esm/BarChart/BarChart.d.ts +2 -2
  77. package/esm/BarChart/BarChart.js +1 -0
  78. package/esm/BarChart/BarChart.plugins.d.ts +3 -2
  79. package/esm/BarChart/BarChart.plugins.js +2 -1
  80. package/esm/BarChart/BarElement.js +10 -2
  81. package/esm/BarChart/index.d.ts +2 -0
  82. package/esm/BarChart/index.js +1 -0
  83. package/esm/BarChart/useBarChartProps.d.ts +2 -2
  84. package/esm/BarChart/useBarChartProps.js +4 -3
  85. package/esm/ChartContainer/ChartContainer.js +4 -2
  86. package/esm/ChartContainer/useChartContainerProps.js +4 -2
  87. package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +4 -4
  88. package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +4 -4
  89. package/esm/ChartsLegend/ChartsLegend.js +2 -1
  90. package/esm/ChartsLegend/ContinuousColorLegend.js +1 -0
  91. package/esm/ChartsLegend/PiecewiseColorLegend.d.ts +2 -2
  92. package/esm/ChartsLegend/PiecewiseColorLegend.js +33 -22
  93. package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +4 -0
  94. package/esm/ChartsLegend/piecewiseColorLegendClasses.js +2 -2
  95. package/esm/ChartsSurface/ChartsSurface.js +22 -2
  96. package/esm/ChartsWrapper/ChartsWrapper.d.ts +5 -0
  97. package/esm/ChartsWrapper/ChartsWrapper.js +87 -36
  98. package/esm/ChartsXAxis/ChartsGroupedXAxisTicks.js +2 -2
  99. package/esm/ChartsXAxis/ChartsXAxisImpl.js +3 -3
  100. package/esm/ChartsXAxis/getVisibleLabels.js +5 -1
  101. package/esm/ChartsXAxis/useAxisTicksProps.d.ts +3 -3
  102. package/esm/ChartsYAxis/ChartsGroupedYAxisTicks.js +2 -2
  103. package/esm/ChartsYAxis/ChartsYAxisImpl.js +3 -3
  104. package/esm/ChartsYAxis/useAxisTicksProps.d.ts +3 -3
  105. package/esm/LineChart/FocusedMark.d.ts +2 -0
  106. package/esm/LineChart/FocusedMark.js +38 -0
  107. package/esm/LineChart/LineChart.d.ts +2 -2
  108. package/esm/LineChart/LineChart.js +3 -1
  109. package/esm/LineChart/LineChart.plugins.d.ts +3 -2
  110. package/esm/LineChart/LineChart.plugins.js +2 -1
  111. package/esm/LineChart/index.d.ts +1 -0
  112. package/esm/LineChart/index.js +1 -0
  113. package/esm/LineChart/useAreaPlotData.js +2 -2
  114. package/esm/LineChart/useLineChartProps.d.ts +2 -2
  115. package/esm/LineChart/useLineChartProps.js +2 -1
  116. package/esm/LineChart/useLinePlotData.js +2 -2
  117. package/esm/PieChart/PieArc.d.ts +1 -0
  118. package/esm/PieChart/PieArc.js +7 -3
  119. package/esm/PieChart/PieArcPlot.js +1 -0
  120. package/esm/PieChart/PieChart.js +2 -0
  121. package/esm/PieChart/PieChart.plugins.d.ts +2 -1
  122. package/esm/PieChart/PieChart.plugins.js +2 -1
  123. package/esm/PieChart/dataTransform/useTransformData.d.ts +1 -0
  124. package/esm/PieChart/dataTransform/useTransformData.js +9 -1
  125. package/esm/PieChart/index.d.ts +1 -0
  126. package/esm/PieChart/index.js +1 -0
  127. package/esm/RadarChart/RadarAxis/useRadarAxis.js +2 -2
  128. package/esm/RadarChart/RadarChart.plugins.d.ts +1 -1
  129. package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +3 -3
  130. package/esm/RadarChart/index.d.ts +2 -1
  131. package/esm/RadarChart/index.js +2 -1
  132. package/esm/RadarChart/useRadarChartProps.d.ts +2 -2
  133. package/esm/RadarChart/useRadarChartProps.js +2 -1
  134. package/esm/ScatterChart/BatchScatter.d.ts +32 -0
  135. package/esm/ScatterChart/BatchScatter.js +165 -0
  136. package/esm/ScatterChart/Scatter.js +13 -5
  137. package/esm/ScatterChart/ScatterChart.d.ts +4 -4
  138. package/esm/ScatterChart/ScatterChart.js +13 -2
  139. package/esm/ScatterChart/ScatterChart.plugins.d.ts +4 -3
  140. package/esm/ScatterChart/ScatterChart.plugins.js +3 -2
  141. package/esm/ScatterChart/ScatterPlot.d.ts +10 -0
  142. package/esm/ScatterChart/ScatterPlot.js +14 -2
  143. package/esm/ScatterChart/index.d.ts +1 -0
  144. package/esm/ScatterChart/index.js +1 -0
  145. package/esm/ScatterChart/useScatterChartProps.d.ts +2 -2
  146. package/esm/ScatterChart/useScatterChartProps.js +10 -6
  147. package/esm/SparkLineChart/SparkLineChart.js +10 -5
  148. package/esm/colorPalettes/types.d.ts +1 -1
  149. package/esm/context/ChartApi.d.ts +6 -6
  150. package/esm/hooks/useAxis.d.ts +5 -5
  151. package/esm/hooks/useDrawingArea.d.ts +20 -2
  152. package/esm/hooks/useFocusedItem.d.ts +15 -0
  153. package/esm/hooks/useFocusedItem.js +20 -0
  154. package/esm/hooks/useIsItemFocused.d.ts +12 -0
  155. package/esm/hooks/useIsItemFocused.js +15 -0
  156. package/esm/hooks/useIsItemFocusedGetter.d.ts +8 -0
  157. package/esm/hooks/useIsItemFocusedGetter.js +14 -0
  158. package/esm/hooks/useScale.js +8 -2
  159. package/esm/hooks/useTicks.js +2 -2
  160. package/esm/hooks/useTicksGrouped.js +2 -2
  161. package/esm/index.d.ts +1 -0
  162. package/esm/index.js +2 -1
  163. package/esm/internals/animation/Transition.js +1 -3
  164. package/esm/internals/index.d.ts +4 -3
  165. package/esm/internals/index.js +4 -3
  166. package/esm/internals/invertScale.js +2 -2
  167. package/esm/internals/plugins/allPlugins.d.ts +5 -4
  168. package/esm/internals/plugins/allPlugins.js +3 -2
  169. package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
  170. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
  171. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +66 -72
  172. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
  173. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
  174. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
  175. package/{internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts → esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.d.ts} +1 -1
  176. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +24 -0
  177. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
  178. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +123 -0
  179. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -3
  180. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
  181. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
  182. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +46 -4
  183. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
  184. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +32 -21
  185. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
  186. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/index.js +2 -0
  187. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
  188. package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +9 -7
  189. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
  190. package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +3 -0
  191. package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
  192. package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
  193. package/esm/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +32 -0
  194. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
  195. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +5 -0
  196. package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
  197. package/esm/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +3 -0
  198. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
  199. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +2 -0
  200. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
  201. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
  202. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +88 -0
  203. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +210 -0
  204. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
  205. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +7 -0
  206. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
  207. package/esm/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +1 -0
  208. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +2 -2
  209. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
  210. package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
  211. package/esm/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
  212. package/esm/internals/scaleGuards.d.ts +11 -0
  213. package/esm/internals/scaleGuards.js +9 -0
  214. package/esm/locales/elGR.d.ts +96 -0
  215. package/esm/locales/elGR.js +100 -0
  216. package/esm/locales/enUS.d.ts +96 -0
  217. package/esm/locales/enUS.js +99 -1
  218. package/esm/locales/frFR.d.ts +96 -0
  219. package/esm/locales/frFR.js +100 -2
  220. package/esm/locales/ptBR.d.ts +96 -0
  221. package/esm/locales/ptBR.js +100 -0
  222. package/esm/locales/ptPT.d.ts +96 -0
  223. package/esm/locales/ptPT.js +100 -0
  224. package/esm/locales/svSE.d.ts +97 -1
  225. package/esm/locales/svSE.js +100 -0
  226. package/esm/locales/utils/chartsLocaleTextApi.d.ts +384 -0
  227. package/esm/locales/utils/getChartsLocalization.d.ts +96 -0
  228. package/esm/models/axis.d.ts +3 -0
  229. package/esm/plugins/index.d.ts +6 -0
  230. package/esm/plugins/index.js +12 -0
  231. package/hooks/useAxis.d.ts +5 -5
  232. package/hooks/useDrawingArea.d.ts +20 -2
  233. package/hooks/useFocusedItem.d.ts +15 -0
  234. package/hooks/useFocusedItem.js +26 -0
  235. package/hooks/useIsItemFocused.d.ts +12 -0
  236. package/hooks/useIsItemFocused.js +20 -0
  237. package/hooks/useIsItemFocusedGetter.d.ts +8 -0
  238. package/hooks/useIsItemFocusedGetter.js +18 -0
  239. package/hooks/useScale.js +8 -2
  240. package/hooks/useTicks.js +2 -2
  241. package/hooks/useTicksGrouped.js +2 -2
  242. package/index.d.ts +1 -0
  243. package/index.js +13 -1
  244. package/internals/animation/Transition.js +0 -2
  245. package/internals/index.d.ts +4 -3
  246. package/internals/index.js +24 -12
  247. package/internals/invertScale.js +2 -2
  248. package/internals/plugins/allPlugins.d.ts +5 -4
  249. package/internals/plugins/allPlugins.js +3 -2
  250. package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +1 -1
  251. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +2 -0
  252. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +63 -69
  253. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +3 -19
  254. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +10 -18
  255. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +1 -1
  256. package/{esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.d.ts → internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.d.ts} +1 -1
  257. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtrema.js +30 -0
  258. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.d.ts +63 -0
  259. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisScale.js +134 -0
  260. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -3
  261. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +8 -6
  262. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +2 -0
  263. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +47 -5
  264. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -0
  265. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +33 -22
  266. package/internals/plugins/featurePlugins/useChartClosestPoint/index.d.ts +3 -0
  267. package/internals/plugins/featurePlugins/useChartClosestPoint/index.js +27 -0
  268. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.d.ts +3 -0
  269. package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.js → useChartClosestPoint/useChartClosestPoint.js} +11 -9
  270. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.d.ts +5 -0
  271. package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.selectors.js +9 -0
  272. package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.d.ts → useChartClosestPoint/useChartClosestPoint.types.d.ts} +8 -4
  273. package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.d.ts +16 -0
  274. package/internals/plugins/featurePlugins/useChartHighlight/highlightStates.js +41 -0
  275. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +4 -0
  276. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +6 -1
  277. package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.d.ts +3 -0
  278. package/internals/plugins/featurePlugins/useChartInteraction/checkHasInteractionPlugin.js +9 -0
  279. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.d.ts +3 -0
  280. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js +27 -0
  281. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.d.ts +3 -0
  282. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.d.ts +20 -0
  283. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.helpers.js +96 -0
  284. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.js +218 -0
  285. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.d.ts +25 -0
  286. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.selectors.js +13 -0
  287. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.d.ts +34 -0
  288. package/internals/plugins/featurePlugins/useChartKeyboardNavigation/useChartKeyboardNavigation.types.js +5 -0
  289. package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisIndex.js +2 -2
  290. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +10 -8
  291. package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.types.d.ts +2 -1
  292. package/internals/plugins/models/seriesConfig/getSeriesWithDefaultValues.types.d.ts +1 -1
  293. package/internals/scaleGuards.d.ts +11 -0
  294. package/internals/scaleGuards.js +17 -0
  295. package/locales/elGR.d.ts +96 -0
  296. package/locales/elGR.js +100 -0
  297. package/locales/enUS.d.ts +96 -0
  298. package/locales/enUS.js +99 -1
  299. package/locales/frFR.d.ts +96 -0
  300. package/locales/frFR.js +100 -2
  301. package/locales/ptBR.d.ts +96 -0
  302. package/locales/ptBR.js +100 -0
  303. package/locales/ptPT.d.ts +96 -0
  304. package/locales/ptPT.js +100 -0
  305. package/locales/svSE.d.ts +97 -1
  306. package/locales/svSE.js +100 -0
  307. package/locales/utils/chartsLocaleTextApi.d.ts +384 -0
  308. package/locales/utils/getChartsLocalization.d.ts +96 -0
  309. package/models/axis.d.ts +3 -0
  310. package/package.json +4 -4
  311. package/plugins/index.d.ts +6 -0
  312. package/plugins/index.js +47 -0
  313. package/esm/internals/isBandScale.d.ts +0 -5
  314. package/esm/internals/isBandScale.js +0 -3
  315. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -22
  316. package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
  317. package/esm/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -2
  318. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
  319. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
  320. package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -3
  321. package/internals/isBandScale.d.ts +0 -5
  322. package/internals/isBandScale.js +0 -9
  323. package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisExtremum.js +0 -29
  324. package/internals/plugins/featurePlugins/useChartVoronoi/index.d.ts +0 -3
  325. package/internals/plugins/featurePlugins/useChartVoronoi/index.js +0 -27
  326. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.d.ts +0 -3
  327. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +0 -5
  328. package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.js +0 -9
  329. /package/esm/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
  330. /package/internals/plugins/featurePlugins/{useChartVoronoi/useChartVoronoi.types.js → useChartClosestPoint/useChartClosestPoint.types.js} +0 -0
@@ -1,4 +1,4 @@
1
- import { isBandScale } from "../../../isBandScale.js";
1
+ import { isOrdinalScale } from "../../../scaleGuards.js";
2
2
  function getAsANumber(value) {
3
3
  return value instanceof Date ? value.getTime() : value;
4
4
  }
@@ -13,7 +13,7 @@ export function getAxisIndex(axisConfig, pointerValue) {
13
13
  data: axisData,
14
14
  reverse
15
15
  } = axisConfig;
16
- if (!isBandScale(scale)) {
16
+ if (!isOrdinalScale(scale)) {
17
17
  const value = scale.invert(pointerValue);
18
18
  if (axisData === undefined) {
19
19
  return -1;
@@ -51,7 +51,7 @@ export function getAxisValue(axisConfig, pointerValue, dataIndex) {
51
51
  scale,
52
52
  data: axisData
53
53
  } = axisConfig;
54
- if (!isBandScale(scale)) {
54
+ if (!isOrdinalScale(scale)) {
55
55
  if (dataIndex === null) {
56
56
  return scale.invert(pointerValue);
57
57
  }
@@ -16,6 +16,7 @@ import { getSVGPoint } from "../../../getSVGPoint.js";
16
16
  import { selectorChartsInteractionIsInitialized } from "../useChartInteraction/index.js";
17
17
  import { selectorChartAxisInteraction } from "./useChartCartesianInteraction.selectors.js";
18
18
  import { useLazySelectorEffect } from "../../utils/useLazySelectorEffect.js";
19
+ import { checkHasInteractionPlugin } from "../useChartInteraction/checkHasInteractionPlugin.js";
19
20
  export const useChartCartesianAxis = ({
20
21
  params,
21
22
  store,
@@ -99,26 +100,27 @@ export const useChartCartesianAxis = ({
99
100
  onHighlightedAxisChange(nextAxisInteraction);
100
101
  }
101
102
  }, !onHighlightedAxisChange);
103
+ const hasInteractionPlugin = checkHasInteractionPlugin(instance);
102
104
  React.useEffect(() => {
103
105
  const element = svgRef.current;
104
- if (!isInteractionEnabled || !element || params.disableAxisListener) {
106
+ if (!isInteractionEnabled || !hasInteractionPlugin || !element || params.disableAxisListener) {
105
107
  return () => {};
106
108
  }
107
109
 
108
110
  // Clean the interaction when the mouse leaves the chart.
109
111
  const moveEndHandler = instance.addInteractionListener('moveEnd', event => {
110
112
  if (!event.detail.activeGestures.pan) {
111
- instance.cleanInteraction?.();
113
+ instance.cleanInteraction();
112
114
  }
113
115
  });
114
116
  const panEndHandler = instance.addInteractionListener('panEnd', event => {
115
117
  if (!event.detail.activeGestures.move) {
116
- instance.cleanInteraction?.();
118
+ instance.cleanInteraction();
117
119
  }
118
120
  });
119
121
  const pressEndHandler = instance.addInteractionListener('quickPressEnd', event => {
120
122
  if (!event.detail.activeGestures.move && !event.detail.activeGestures.pan) {
121
- instance.cleanInteraction?.();
123
+ instance.cleanInteraction();
122
124
  }
123
125
  });
124
126
  const gestureHandler = event => {
@@ -135,7 +137,7 @@ export const useChartCartesianAxis = ({
135
137
  instance.cleanInteraction?.();
136
138
  return;
137
139
  }
138
- instance.setPointerCoordinate?.(svgPoint);
140
+ instance.setPointerCoordinate(svgPoint);
139
141
  };
140
142
  const moveHandler = instance.addInteractionListener('move', gestureHandler);
141
143
  const panHandler = instance.addInteractionListener('pan', gestureHandler);
@@ -148,7 +150,7 @@ export const useChartCartesianAxis = ({
148
150
  pressHandler.cleanup();
149
151
  pressEndHandler.cleanup();
150
152
  };
151
- }, [svgRef, store, xAxisWithScale, usedXAxis, yAxisWithScale, usedYAxis, instance, params.disableAxisListener, isInteractionEnabled]);
153
+ }, [svgRef, store, xAxisWithScale, usedXAxis, yAxisWithScale, usedYAxis, instance, params.disableAxisListener, isInteractionEnabled, hasInteractionPlugin]);
152
154
  React.useEffect(() => {
153
155
  const element = svgRef.current;
154
156
  const onAxisClick = params.onAxisClick;
@@ -1,3 +1,5 @@
1
1
  import { AxisId } from "../../../../models/axis.js";
2
+ export declare const selectorChartPreviewXScales: import("reselect").Selector<any, Record<AxisId, import("./getAxisScale.js").ScaleDefinition>, [axisId: AxisId]>;
2
3
  export declare const selectorChartPreviewComputedXAxis: import("reselect").Selector<any, import("./useChartCartesianAxis.types.js").ComputedAxisConfig<import("../../../index.js").ChartsXAxisProps>, [axisId: AxisId]>;
4
+ export declare const selectorChartPreviewYScales: import("reselect").Selector<any, Record<AxisId, import("./getAxisScale.js").ScaleDefinition>, [axisId: AxisId]>;
3
5
  export declare const selectorChartPreviewComputedYAxis: import("reselect").Selector<any, import("./useChartCartesianAxis.types.js").ComputedAxisConfig<import("../../../index.js").ChartsYAxisProps>, [axisId: AxisId]>;
@@ -5,6 +5,8 @@ import { computeAxisValue } from "./computeAxisValue.js";
5
5
  import { selectorChartZoomAxisFilters, selectorChartZoomOptionsLookup } from "./useChartCartesianAxisRendering.selectors.js";
6
6
  import { selectorChartDrawingArea } from "../../corePlugins/useChartDimensions/index.js";
7
7
  import { ZOOM_SLIDER_PREVIEW_SIZE } from "../../../constants.js";
8
+ import { selectorPreferStrictDomainInLineCharts } from "../../corePlugins/useChartExperimentalFeature/index.js";
9
+ import { getXAxesScales, getYAxesScales } from "./getAxisScale.js";
8
10
  function createPreviewDrawingArea(axisDirection, mainChartDrawingArea) {
9
11
  return axisDirection === 'x' ? {
10
12
  left: 0,
@@ -22,7 +24,25 @@ function createPreviewDrawingArea(axisDirection, mainChartDrawingArea) {
22
24
  bottom: mainChartDrawingArea.height
23
25
  };
24
26
  }
25
- export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRawXAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorChartDrawingArea, (_, axisId) => axisId], (xAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, axisId) => {
27
+ export const selectorChartPreviewXScales = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorPreferStrictDomainInLineCharts, (_, axisId) => axisId], function selectorChartPreviewXScales(xAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, axisId) {
28
+ const hasAxis = xAxes?.some(axis => axis.id === axisId);
29
+ const drawingArea = createPreviewDrawingArea(hasAxis ? 'x' : 'y', chartDrawingArea);
30
+ const options = zoomOptions[axisId];
31
+ const zoomMap = new Map([[axisId, {
32
+ axisId,
33
+ start: options.minStart,
34
+ end: options.maxEnd
35
+ }]]);
36
+ return getXAxesScales({
37
+ drawingArea,
38
+ formattedSeries,
39
+ axis: xAxes,
40
+ seriesConfig,
41
+ zoomMap,
42
+ preferStrictDomainInLineCharts
43
+ });
44
+ });
45
+ export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRawXAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorChartDrawingArea, selectorPreferStrictDomainInLineCharts, selectorChartPreviewXScales, (_, axisId) => axisId], (xAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, preferStrictDomainInLineCharts, scales, axisId) => {
26
46
  const hasAxis = xAxes?.some(axis => axis.id === axisId);
27
47
  const drawingArea = createPreviewDrawingArea(hasAxis ? 'x' : 'y', chartDrawingArea);
28
48
  const options = zoomOptions[axisId];
@@ -32,6 +52,7 @@ export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRa
32
52
  end: options.maxEnd
33
53
  }]]);
34
54
  const computedAxes = computeAxisValue({
55
+ scales,
35
56
  drawingArea,
36
57
  formattedSeries,
37
58
  axis: xAxes,
@@ -39,7 +60,8 @@ export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRa
39
60
  axisDirection: 'x',
40
61
  zoomMap,
41
62
  zoomOptions,
42
- getFilters
63
+ getFilters,
64
+ preferStrictDomainInLineCharts
43
65
  });
44
66
  if (computedAxes.axis[axisId]) {
45
67
  return {
@@ -48,7 +70,25 @@ export const selectorChartPreviewComputedXAxis = createSelector([selectorChartRa
48
70
  }
49
71
  return computedAxes.axis;
50
72
  });
51
- export const selectorChartPreviewComputedYAxis = createSelector([selectorChartRawYAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorChartDrawingArea, (_, axisId) => axisId], (yAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, axisId) => {
73
+ export const selectorChartPreviewYScales = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorPreferStrictDomainInLineCharts, (_, axisId) => axisId], function selectorChartPreviewYScales(yAxes, chartDrawingArea, formattedSeries, seriesConfig, zoomOptions, preferStrictDomainInLineCharts, axisId) {
74
+ const hasAxis = yAxes?.some(axis => axis.id === axisId);
75
+ const drawingArea = createPreviewDrawingArea(hasAxis ? 'y' : 'x', chartDrawingArea);
76
+ const options = zoomOptions[axisId];
77
+ const zoomMap = new Map([[axisId, {
78
+ axisId,
79
+ start: options.minStart,
80
+ end: options.maxEnd
81
+ }]]);
82
+ return getYAxesScales({
83
+ drawingArea,
84
+ formattedSeries,
85
+ axis: yAxes,
86
+ seriesConfig,
87
+ zoomMap,
88
+ preferStrictDomainInLineCharts
89
+ });
90
+ });
91
+ export const selectorChartPreviewComputedYAxis = createSelector([selectorChartRawYAxis, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorChartDrawingArea, selectorPreferStrictDomainInLineCharts, selectorChartPreviewYScales, (_, axisId) => axisId], (yAxes, formattedSeries, seriesConfig, zoomOptions, getFilters, chartDrawingArea, preferStrictDomainInLineCharts, scales, axisId) => {
52
92
  const hasAxis = yAxes?.some(axis => axis.id === axisId);
53
93
  const drawingArea = createPreviewDrawingArea(hasAxis ? 'y' : 'x', chartDrawingArea);
54
94
  const options = zoomOptions[axisId];
@@ -58,6 +98,7 @@ export const selectorChartPreviewComputedYAxis = createSelector([selectorChartRa
58
98
  end: options.maxEnd
59
99
  }]]);
60
100
  const computedAxes = computeAxisValue({
101
+ scales,
61
102
  drawingArea,
62
103
  formattedSeries,
63
104
  axis: yAxes,
@@ -65,7 +106,8 @@ export const selectorChartPreviewComputedYAxis = createSelector([selectorChartRa
65
106
  axisDirection: 'y',
66
107
  zoomMap,
67
108
  zoomOptions,
68
- getFilters
109
+ getFilters,
110
+ preferStrictDomainInLineCharts
69
111
  });
70
112
  if (computedAxes.axis[axisId]) {
71
113
  return {
@@ -23,6 +23,16 @@ export declare const selectorChartZoomOptionsLookup: import("reselect").Selector
23
23
  [x: number]: import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions;
24
24
  }, []>;
25
25
  export declare const selectorChartAxisZoomOptionsLookup: import("reselect").Selector<any, import("./useChartCartesianAxis.types.js").DefaultizedZoomOptions, [axisId: AxisId]>;
26
+ export declare const selectorChartXScales: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
27
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
28
+ } & Partial<{}> & {
29
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
30
+ }, Record<AxisId, import("./getAxisScale.js").ScaleDefinition>, []>;
31
+ export declare const selectorChartYScales: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
32
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
33
+ } & Partial<{}> & {
34
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
35
+ }, Record<AxisId, import("./getAxisScale.js").ScaleDefinition>, []>;
26
36
  export declare const selectorChartZoomAxisFilters: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & Partial<import("./useChartCartesianAxis.types.js").UseChartCartesianAxisState> & {
27
37
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
28
38
  } & {
@@ -7,6 +7,7 @@ import { createAxisFilterMapper, createGetAxisFilters } from "./createAxisFilter
7
7
  import { createZoomLookup } from "./createZoomLookup.js";
8
8
  import { selectorChartRawXAxis, selectorChartRawYAxis } from "./useChartCartesianAxisLayout.selectors.js";
9
9
  import { selectorPreferStrictDomainInLineCharts } from "../../corePlugins/useChartExperimentalFeature/index.js";
10
+ import { getXAxesScales, getYAxesScales } from "./getAxisScale.js";
10
11
  export const createZoomMap = zoom => {
11
12
  const zoomItemMap = new Map();
12
13
  zoom.forEach(zoomItem => {
@@ -24,34 +25,42 @@ export const selectorChartZoomIsInteracting = createSelector([selectorChartZoomS
24
25
  export const selectorChartZoomMap = createSelector([selectorChartZoomState], zoom => zoom?.zoomData && createZoomMap(zoom?.zoomData));
25
26
  export const selectorChartZoomOptionsLookup = createSelector([selectorChartRawXAxis, selectorChartRawYAxis], (xAxis, yAxis) => _extends({}, createZoomLookup('x')(xAxis), createZoomLookup('y')(yAxis)));
26
27
  export const selectorChartAxisZoomOptionsLookup = createSelector([selectorChartZoomOptionsLookup, (_, axisId) => axisId], (axisLookup, axisId) => axisLookup[axisId]);
27
- const selectorChartXFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartSeriesConfig, selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && createAxisFilterMapper({
28
- zoomMap,
29
- zoomOptions,
30
- seriesConfig,
31
- formattedSeries,
32
- direction: 'x'
33
- }));
34
- const selectorChartYFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartSeriesConfig, selectorChartSeriesProcessed], (zoomMap, zoomOptions, seriesConfig, formattedSeries) => zoomMap && zoomOptions && createAxisFilterMapper({
35
- zoomMap,
36
- zoomOptions,
37
- seriesConfig,
38
- formattedSeries,
39
- direction: 'y'
40
- }));
41
- export const selectorChartZoomAxisFilters = createSelector([selectorChartXFilter, selectorChartYFilter, selectorChartRawXAxis, selectorChartRawYAxis], (xMapper, yMapper, xAxis, yAxis) => {
28
+ const selectorChartXFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && createAxisFilterMapper(zoomMap, zoomOptions, 'x'));
29
+ const selectorChartYFilter = createSelector([selectorChartZoomMap, selectorChartZoomOptionsLookup], (zoomMap, zoomOptions) => zoomMap && zoomOptions && createAxisFilterMapper(zoomMap, zoomOptions, 'y'));
30
+ export const selectorChartXScales = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorPreferStrictDomainInLineCharts], function selectorChartXScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts) {
31
+ return getXAxesScales({
32
+ drawingArea,
33
+ formattedSeries,
34
+ axis,
35
+ seriesConfig,
36
+ zoomMap,
37
+ preferStrictDomainInLineCharts
38
+ });
39
+ });
40
+ export const selectorChartYScales = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorPreferStrictDomainInLineCharts], function selectorChartYScales(axis, drawingArea, formattedSeries, seriesConfig, zoomMap, preferStrictDomainInLineCharts) {
41
+ return getYAxesScales({
42
+ drawingArea,
43
+ formattedSeries,
44
+ axis,
45
+ seriesConfig,
46
+ zoomMap,
47
+ preferStrictDomainInLineCharts
48
+ });
49
+ });
50
+ export const selectorChartZoomAxisFilters = createSelector([selectorChartXFilter, selectorChartYFilter, selectorChartRawXAxis, selectorChartRawYAxis, selectorChartXScales, selectorChartYScales], (xMapper, yMapper, xAxis, yAxis, xScales, yScales) => {
42
51
  if (xMapper === undefined || yMapper === undefined) {
43
52
  // Early return if there is no zoom.
44
53
  return undefined;
45
54
  }
46
- const xFilters = xAxis?.reduce((acc, axis, index) => {
47
- const filter = xMapper(axis, index);
55
+ const xFilters = xAxis?.reduce((acc, axis) => {
56
+ const filter = xMapper(axis.id, axis.data, xScales[axis.id].scale);
48
57
  if (filter !== null) {
49
58
  acc[axis.id] = filter;
50
59
  }
51
60
  return acc;
52
61
  }, {});
53
- const yFilters = yAxis?.reduce((acc, axis, index) => {
54
- const filter = yMapper(axis, index);
62
+ const yFilters = yAxis?.reduce((acc, axis) => {
63
+ const filter = yMapper(axis.id, axis.data, yScales[axis.id].scale);
55
64
  if (filter !== null) {
56
65
  acc[axis.id] = filter;
57
66
  }
@@ -67,7 +76,8 @@ export const selectorChartZoomAxisFilters = createSelector([selectorChartXFilter
67
76
  * The only interesting selectors that merge axis data and zoom if provided.
68
77
  */
69
78
 
70
- export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts) => computeAxisValue({
79
+ export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts, selectorChartXScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, scales) => computeAxisValue({
80
+ scales,
71
81
  drawingArea,
72
82
  formattedSeries,
73
83
  axis,
@@ -78,7 +88,8 @@ export const selectorChartXAxis = createSelector([selectorChartRawXAxis, selecto
78
88
  getFilters,
79
89
  preferStrictDomainInLineCharts
80
90
  }));
81
- export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts) => computeAxisValue({
91
+ export const selectorChartYAxis = createSelector([selectorChartRawYAxis, selectorChartDrawingArea, selectorChartSeriesProcessed, selectorChartSeriesConfig, selectorChartZoomMap, selectorChartZoomOptionsLookup, selectorChartZoomAxisFilters, selectorPreferStrictDomainInLineCharts, selectorChartYScales], (axis, drawingArea, formattedSeries, seriesConfig, zoomMap, zoomOptions, getFilters, preferStrictDomainInLineCharts, scales) => computeAxisValue({
92
+ scales,
82
93
  drawingArea,
83
94
  formattedSeries,
84
95
  axis,
@@ -0,0 +1,3 @@
1
+ export { useChartClosestPoint } from "./useChartClosestPoint.js";
2
+ export * from "./useChartClosestPoint.selectors.js";
3
+ export type { UseChartClosestPointSignature } from "./useChartClosestPoint.types.js";
@@ -0,0 +1,2 @@
1
+ export { useChartClosestPoint } from "./useChartClosestPoint.js";
2
+ export * from "./useChartClosestPoint.selectors.js";
@@ -0,0 +1,3 @@
1
+ import { ChartPlugin } from "../../models/index.js";
2
+ import { UseChartClosestPointSignature } from "./useChartClosestPoint.types.js";
3
+ export declare const useChartClosestPoint: ChartPlugin<UseChartClosestPointSignature>;
@@ -11,7 +11,7 @@ import { useSelector } from "../../../store/useSelector.js";
11
11
  import { selectorChartXAxis, selectorChartYAxis, selectorChartZoomIsInteracting } from "../useChartCartesianAxis/index.js";
12
12
  import { selectorChartSeriesProcessed } from "../../corePlugins/useChartSeries/useChartSeries.selectors.js";
13
13
  import { selectorChartDrawingArea } from "../../corePlugins/useChartDimensions/index.js";
14
- export const useChartVoronoi = ({
14
+ export const useChartClosestPoint = ({
15
15
  svgRef,
16
16
  params,
17
17
  store,
@@ -86,7 +86,8 @@ export const useChartVoronoi = ({
86
86
  seriesId,
87
87
  seriesIndexes,
88
88
  startIndex: points.length,
89
- endIndex: points.length + seriesPoints.length
89
+ endIndex: points.length + seriesPoints.length,
90
+ markerSize: series[seriesId].markerSize
90
91
  };
91
92
  points = points.concat(seriesPoints);
92
93
  });
@@ -123,11 +124,12 @@ export const useChartVoronoi = ({
123
124
  // The point index in the series with id=closestSeries.seriesId.
124
125
  const seriesPointIndex = (2 * closestPointIndex - voronoiRef.current[closestSeries.seriesId].startIndex) / 2;
125
126
  const dataIndex = voronoiRef.current[closestSeries.seriesId].seriesIndexes[seriesPointIndex];
126
- if (voronoiMaxRadius !== undefined) {
127
+ const maxRadius = voronoiMaxRadius === 'item' ? closestSeries.markerSize : voronoiMaxRadius;
128
+ if (maxRadius !== undefined) {
127
129
  const pointX = delauneyRef.current.points[2 * closestPointIndex];
128
130
  const pointY = delauneyRef.current.points[2 * closestPointIndex + 1];
129
131
  const dist2 = (pointX - svgPoint.x) ** 2 + (pointY - svgPoint.y) ** 2;
130
- if (dist2 > voronoiMaxRadius ** 2) {
132
+ if (dist2 > maxRadius ** 2) {
131
133
  // The closest point is too far to be considered.
132
134
  return 'outside-voronoi-max-radius';
133
135
  }
@@ -233,17 +235,17 @@ export const useChartVoronoi = ({
233
235
  }
234
236
  };
235
237
  };
236
- useChartVoronoi.getDefaultizedParams = ({
238
+ useChartClosestPoint.getDefaultizedParams = ({
237
239
  params
238
240
  }) => _extends({}, params, {
239
241
  disableVoronoi: params.disableVoronoi ?? !params.series.some(item => item.type === 'scatter')
240
242
  });
241
- useChartVoronoi.getInitialState = params => ({
243
+ useChartClosestPoint.getInitialState = params => ({
242
244
  voronoi: {
243
245
  isVoronoiEnabled: !params.disableVoronoi
244
246
  }
245
247
  });
246
- useChartVoronoi.params = {
248
+ useChartClosestPoint.params = {
247
249
  disableVoronoi: true,
248
250
  voronoiMaxRadius: true,
249
251
  onItemClick: true
@@ -0,0 +1,5 @@
1
+ export declare const selectorChartsIsVoronoiEnabled: import("reselect").Selector<import("../../corePlugins/useChartId/useChartId.types.js").UseChartIdState & import("../../corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js").UseChartExperimentalFeaturesState & import("../../corePlugins/useChartDimensions/useChartDimensions.types.js").UseChartDimensionsState & import("../../corePlugins/useChartSeries/useChartSeries.types.js").UseChartSeriesState<keyof import("../../../index.js").ChartsSeriesConfig> & import("../../corePlugins/useChartAnimation/useChartAnimation.types.js").UseChartAnimationState & import("../../../index.js").UseChartInteractionListenerState & import("./useChartClosestPoint.types.js").UseChartVoronoiState & Partial<{}> & {
2
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
3
+ } & {
4
+ cacheKey: import("../../models/index.js").ChartStateCacheKey;
5
+ }, boolean | undefined, any[]>;
@@ -0,0 +1,3 @@
1
+ import { createSelector } from "../../utils/selectors.js";
2
+ const selectVoronoi = state => state.voronoi;
3
+ export const selectorChartsIsVoronoiEnabled = createSelector([selectVoronoi], voronoi => voronoi?.isVoronoiEnabled);
@@ -29,10 +29,11 @@ export interface UseChartVoronoiParameters {
29
29
  */
30
30
  disableVoronoi?: boolean;
31
31
  /**
32
- * Defines the maximal distance between a scatter point and the pointer that triggers the interaction.
32
+ * Defines the maximum distance between a scatter point and the pointer that triggers the interaction.
33
+ * If set to `'item'`, the radius is the `markerSize`.
33
34
  * If `undefined`, the radius is assumed to be infinite.
34
35
  */
35
- voronoiMaxRadius?: number | undefined;
36
+ voronoiMaxRadius?: 'item' | number | undefined;
36
37
  /**
37
38
  * Callback fired when clicking close to an item.
38
39
  * This is only available for scatter plot for now.
@@ -41,10 +42,13 @@ export interface UseChartVoronoiParameters {
41
42
  */
42
43
  onItemClick?: (event: MouseEvent, scatterItemIdentifier: ScatterItemIdentifier) => void;
43
44
  }
44
- export type UseChartVoronoiDefaultizedParameters = UseChartVoronoiParameters & {
45
+ export type UseChartVoronoiDefaultizedParameters = Pick<UseChartVoronoiParameters, 'voronoiMaxRadius' | 'onItemClick'> & {
46
+ /**
47
+ * If true, the voronoi plugin is disabled.
48
+ */
45
49
  disableVoronoi: boolean;
46
50
  };
47
- export type UseChartVoronoiSignature = ChartPluginSignature<{
51
+ export type UseChartClosestPointSignature = ChartPluginSignature<{
48
52
  instance: UseChartVoronoiInstance;
49
53
  state: UseChartVoronoiState;
50
54
  params: UseChartVoronoiParameters;
@@ -0,0 +1,16 @@
1
+ import { HighlightItemData } from "./useChartHighlight.types.js";
2
+ import { HighlightScope } from "./highlightConfig.types.js";
3
+ import { SeriesId } from "../../../../models/seriesType/common.js";
4
+ export declare function isSeriesHighlighted(scope: Partial<HighlightScope> | null, item: HighlightItemData | null, seriesId: SeriesId): boolean;
5
+ export declare function isSeriesFaded(scope: Partial<HighlightScope> | null, item: HighlightItemData | null, seriesId: SeriesId): boolean;
6
+ /**
7
+ * Returns the data index of the highlighted item for a specific series.
8
+ * If the item is not highlighted, it returns `null`.
9
+ */
10
+ export declare function getSeriesHighlightedItem(scope: Partial<HighlightScope> | null, item: HighlightItemData | null, seriesId: SeriesId): number | null | undefined;
11
+ /**
12
+ * Returns the data index of the "unfaded item" for a specific series.
13
+ * An "unfaded item" is the only item of a faded series that shouldn't be faded.
14
+ * If the series is not faded or if there is no highlighted item, it returns `null`.
15
+ */
16
+ export declare function getSeriesUnfadedItem(scope: Partial<HighlightScope> | null, item: HighlightItemData | null, seriesId: SeriesId): number | null | undefined;
@@ -0,0 +1,32 @@
1
+ export function isSeriesHighlighted(scope, item, seriesId) {
2
+ return scope?.highlight === 'series' && item?.seriesId === seriesId;
3
+ }
4
+ export function isSeriesFaded(scope, item, seriesId) {
5
+ if (isSeriesHighlighted(scope, item, seriesId)) {
6
+ return false;
7
+ }
8
+ return scope?.fade === 'global' && item != null || scope?.fade === 'series' && item?.seriesId === seriesId;
9
+ }
10
+
11
+ /**
12
+ * Returns the data index of the highlighted item for a specific series.
13
+ * If the item is not highlighted, it returns `null`.
14
+ */
15
+ export function getSeriesHighlightedItem(scope, item, seriesId) {
16
+ return scope?.highlight === 'item' && item?.seriesId === seriesId ? item.dataIndex : null;
17
+ }
18
+
19
+ /**
20
+ * Returns the data index of the "unfaded item" for a specific series.
21
+ * An "unfaded item" is the only item of a faded series that shouldn't be faded.
22
+ * If the series is not faded or if there is no highlighted item, it returns `null`.
23
+ */
24
+ export function getSeriesUnfadedItem(scope, item, seriesId) {
25
+ if (isSeriesHighlighted(scope, item, seriesId)) {
26
+ return null;
27
+ }
28
+ if (getSeriesHighlightedItem(scope, item, seriesId) === item?.dataIndex) {
29
+ return null;
30
+ }
31
+ return (scope?.fade === 'series' || scope?.fade === 'global') && item?.seriesId === seriesId ? item.dataIndex : null;
32
+ }
@@ -27,4 +27,8 @@ export declare const selectorChartsIsFadedCallback: import("reselect").Selector<
27
27
  cacheKey: import("../../models/index.js").ChartStateCacheKey;
28
28
  } & import("./useChartHighlight.types.js").UseChartHighlightState, (item: HighlightItemData | null) => boolean, any[]>;
29
29
  export declare const selectorChartsIsHighlighted: import("reselect").Selector<any, boolean, [item: HighlightItemData | null]>;
30
+ export declare const selectorChartIsSeriesHighlighted: import("reselect").Selector<any, boolean, [seriesId: SeriesId]>;
31
+ export declare const selectorChartIsSeriesFaded: import("reselect").Selector<any, boolean, [seriesId: SeriesId]>;
32
+ export declare const selectorChartSeriesUnfadedItem: import("reselect").Selector<any, number | null | undefined, [seriesId: SeriesId]>;
33
+ export declare const selectorChartSeriesHighlightedItem: import("reselect").Selector<any, number | null | undefined, [seriesId: SeriesId]>;
30
34
  export declare const selectorChartsIsFaded: import("reselect").Selector<any, boolean, [item: HighlightItemData | null]>;
@@ -1,6 +1,7 @@
1
1
  import { createSelector } from "../../utils/selectors.js";
2
2
  import { createIsHighlighted } from "./createIsHighlighted.js";
3
3
  import { createIsFaded } from "./createIsFaded.js";
4
+ import { getSeriesHighlightedItem, getSeriesUnfadedItem, isSeriesFaded, isSeriesHighlighted } from "./highlightStates.js";
4
5
  const selectHighlight = state => state.highlight;
5
6
  const selectSeries = state => state.series;
6
7
  export const selectorChartsHighlightScopePerSeriesId = createSelector([selectSeries], series => {
@@ -32,6 +33,10 @@ export const selectorChartsIsFadedCallback = createSelector([selectorChartsHighl
32
33
  export const selectorChartsIsHighlighted = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, item) => item], function selectorChartsIsHighlighted(highlightScope, highlightedItem, item) {
33
34
  return createIsHighlighted(highlightScope, highlightedItem)(item);
34
35
  });
36
+ export const selectorChartIsSeriesHighlighted = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, seriesId) => seriesId], isSeriesHighlighted);
37
+ export const selectorChartIsSeriesFaded = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, seriesId) => seriesId], isSeriesFaded);
38
+ export const selectorChartSeriesUnfadedItem = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, seriesId) => seriesId], getSeriesUnfadedItem);
39
+ export const selectorChartSeriesHighlightedItem = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, seriesId) => seriesId], getSeriesHighlightedItem);
35
40
  export const selectorChartsIsFaded = createSelector([selectorChartsHighlightScope, selectorChartsHighlightedItem, (_, item) => item], function selectorChartsIsFaded(highlightScope, highlightedItem, item) {
36
41
  return createIsFaded(highlightScope, highlightedItem)(item);
37
42
  });
@@ -0,0 +1,3 @@
1
+ import { ChartAnyPluginSignature, ChartUsedInstance } from "../../models/plugin.js";
2
+ import { UseChartInteractionInstance } from "./useChartInteraction.types.js";
3
+ export declare function checkHasInteractionPlugin<T extends ChartAnyPluginSignature>(instance: ChartUsedInstance<T>): instance is ChartUsedInstance<T> & UseChartInteractionInstance;
@@ -0,0 +1,3 @@
1
+ export function checkHasInteractionPlugin(instance) {
2
+ return instance.setPointerCoordinate !== undefined;
3
+ }
@@ -0,0 +1,3 @@
1
+ export { useChartKeyboardNavigation } from "./useChartKeyboardNavigation.js";
2
+ export * from "./useChartKeyboardNavigation.selectors.js";
3
+ export type { UseChartKeyboardNavigationSignature } from "./useChartKeyboardNavigation.types.js";
@@ -0,0 +1,2 @@
1
+ export { useChartKeyboardNavigation } from "./useChartKeyboardNavigation.js";
2
+ export * from "./useChartKeyboardNavigation.selectors.js";
@@ -0,0 +1,3 @@
1
+ import { ChartPlugin } from "../../models/index.js";
2
+ import { UseChartKeyboardNavigationSignature } from "./useChartKeyboardNavigation.types.js";
3
+ export declare const useChartKeyboardNavigation: ChartPlugin<UseChartKeyboardNavigationSignature>;
@@ -0,0 +1,20 @@
1
+ import { ChartSeriesType, ChartsSeriesConfig } from "../../../../models/seriesType/config.js";
2
+ import { SeriesId } from "../../../../models/seriesType/common.js";
3
+ import { ProcessedSeries } from "../../corePlugins/useChartSeries/index.js";
4
+ /**
5
+ * Returns the next series type and id that contains some data.
6
+ * Returns `null` if no other series have data.
7
+ */
8
+ export declare function getNextSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: ChartSeriesType, seriesId?: SeriesId): {
9
+ type: Exclude<ChartSeriesType, 'sankey'>;
10
+ seriesId: SeriesId;
11
+ } | null;
12
+ /**
13
+ * Returns the previous series type and id that contains some data.
14
+ * Returns `null` if no other series have data.
15
+ */
16
+ export declare function getPreviousSeriesWithData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type?: ChartSeriesType, seriesId?: SeriesId): {
17
+ type: Exclude<ChartSeriesType, 'sankey'>;
18
+ seriesId: SeriesId;
19
+ } | null;
20
+ export declare function seriesHasData(series: ProcessedSeries<keyof ChartsSeriesConfig>, type: ChartSeriesType, seriesId: SeriesId): boolean | undefined;
@@ -0,0 +1,88 @@
1
+ /**
2
+ * Returns the next series type and id that contains some data.
3
+ * Returns `null` if no other series have data.
4
+ */
5
+ export function getNextSeriesWithData(series, type, seriesId) {
6
+ const startingTypeIndex = type !== undefined && series[type] ? Object.keys(series).indexOf(type) : 0;
7
+ const currentSeriesIndex = type !== undefined && seriesId !== undefined && series[type] && series[type].series[seriesId] ? series[type].seriesOrder.indexOf(seriesId) : -1;
8
+ const typesAvailable = Object.keys(series).filter(t => t !== 'sankey');
9
+
10
+ // Loop over all series types starting with the current seriesType
11
+ for (let typeGap = 0; typeGap < typesAvailable.length; typeGap += 1) {
12
+ const typeIndex = (startingTypeIndex + typeGap) % typesAvailable.length;
13
+ const seriesOfType = series[typesAvailable[typeIndex]];
14
+
15
+ // Edge case for the current series type: we don't loop on previous series of the same type.
16
+ const startingSeriesIndex = typeGap === 0 ? currentSeriesIndex + 1 : 0;
17
+ for (let seriesIndex = startingSeriesIndex; seriesIndex < seriesOfType.seriesOrder.length; seriesIndex += 1) {
18
+ if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
19
+ return {
20
+ type: typesAvailable[typeIndex],
21
+ seriesId: seriesOfType.seriesOrder[seriesIndex]
22
+ };
23
+ }
24
+ }
25
+ }
26
+
27
+ // End looping on the initial type up to the initial series (excluded)
28
+ const typeIndex = startingTypeIndex;
29
+ const seriesOfType = series[typesAvailable[typeIndex]];
30
+ const endingSeriesIndex = currentSeriesIndex;
31
+ for (let seriesIndex = 0; seriesIndex < endingSeriesIndex; seriesIndex += 1) {
32
+ if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
33
+ return {
34
+ type: typesAvailable[typeIndex],
35
+ seriesId: seriesOfType.seriesOrder[seriesIndex]
36
+ };
37
+ }
38
+ }
39
+ return null;
40
+ }
41
+
42
+ /**
43
+ * Returns the previous series type and id that contains some data.
44
+ * Returns `null` if no other series have data.
45
+ */
46
+ export function getPreviousSeriesWithData(series, type, seriesId) {
47
+ const startingTypeIndex = type !== undefined && series[type] ? Object.keys(series).indexOf(type) : 0;
48
+ const startingSeriesIndex = type !== undefined && seriesId !== undefined && series[type] && series[type].series[seriesId] ? series[type].seriesOrder.indexOf(seriesId) : 1;
49
+ const typesAvailable = Object.keys(series).filter(t => t !== 'sankey');
50
+
51
+ // Loop over all series types starting with the current seriesType
52
+ for (let typeGap = 0; typeGap < typesAvailable.length; typeGap += 1) {
53
+ const typeIndex = (typesAvailable.length + startingTypeIndex - typeGap) % typesAvailable.length;
54
+ const seriesOfType = series[typesAvailable[typeIndex]];
55
+ const maxGap = typeGap === 0 ? startingSeriesIndex + 1 : seriesOfType.seriesOrder.length;
56
+ for (let seriesGap = 1; seriesGap < maxGap; seriesGap += 1) {
57
+ const seriesIndex = (seriesOfType.seriesOrder.length + startingSeriesIndex - seriesGap) % seriesOfType.seriesOrder.length;
58
+ if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
59
+ return {
60
+ type: typesAvailable[typeIndex],
61
+ seriesId: seriesOfType.seriesOrder[seriesIndex]
62
+ };
63
+ }
64
+ }
65
+ }
66
+
67
+ // End looping on the initial type down to the initial series (excluded)
68
+ const typeIndex = startingTypeIndex;
69
+ const seriesOfType = series[typesAvailable[typeIndex]];
70
+ const availableSeriesIds = seriesOfType.seriesOrder;
71
+ for (let seriesIndex = availableSeriesIds.length - 1; seriesIndex > startingSeriesIndex; seriesIndex -= 1) {
72
+ if (seriesOfType.series[seriesOfType.seriesOrder[seriesIndex]].data.length > 0) {
73
+ return {
74
+ type: typesAvailable[typeIndex],
75
+ seriesId: seriesOfType.seriesOrder[seriesIndex]
76
+ };
77
+ }
78
+ }
79
+ return null;
80
+ }
81
+ export function seriesHasData(series, type, seriesId) {
82
+ // @ts-ignore snakey is not in MIT version
83
+ if (type === 'sankey') {
84
+ return false;
85
+ }
86
+ const data = series[type]?.series[seriesId]?.data;
87
+ return data && data.length > 0;
88
+ }