@mui/x-charts 8.0.0-alpha.12 → 8.0.0-alpha.13

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 (314) hide show
  1. package/BarChart/BarChart.d.ts +1 -1
  2. package/BarChart/BarChart.js +14 -30
  3. package/BarChart/useBarChartProps.js +3 -18
  4. package/CHANGELOG.md +299 -0
  5. package/ChartContainer/ChartContainer.d.ts +1 -1
  6. package/ChartContainer/ChartContainer.js +15 -7
  7. package/ChartDataProvider/ChartDataProvider.d.ts +2 -2
  8. package/ChartDataProvider/ChartDataProvider.js +4 -3
  9. package/ChartsAxis/ChartsAxis.d.ts +1 -25
  10. package/ChartsAxis/ChartsAxis.js +25 -87
  11. package/ChartsAxis/axisClasses.d.ts +5 -1
  12. package/ChartsLabel/ChartsLabelMark.d.ts +6 -1
  13. package/ChartsLabel/ChartsLabelMark.js +15 -2
  14. package/ChartsLabel/index.d.ts +1 -1
  15. package/ChartsLabel/labelGradientClasses.d.ts +1 -1
  16. package/ChartsLabel/labelMarkClasses.d.ts +1 -1
  17. package/ChartsLabel/labelMarkClasses.js +1 -1
  18. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  19. package/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  20. package/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
  21. package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
  22. package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
  23. package/ChartsTooltip/ChartsTooltipTable.js +1 -1
  24. package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
  25. package/ChartsXAxis/ChartsXAxis.js +70 -57
  26. package/ChartsYAxis/ChartsYAxis.js +11 -15
  27. package/Gauge/Gauge.js +4 -3
  28. package/Gauge/GaugeContainer.js +7 -5
  29. package/LineChart/LineChart.d.ts +1 -1
  30. package/LineChart/LineChart.js +14 -30
  31. package/LineChart/useLineChartProps.js +2 -17
  32. package/PieChart/PieArcLabelPlot.js +1 -1
  33. package/PieChart/PieArcPlot.js +1 -1
  34. package/PieChart/PieChart.d.ts +1 -1
  35. package/PieChart/PieChart.js +6 -4
  36. package/ScatterChart/ScatterChart.d.ts +1 -1
  37. package/ScatterChart/ScatterChart.js +14 -30
  38. package/ScatterChart/useScatterChartProps.js +2 -17
  39. package/SparkLineChart/SparkLineChart.d.ts +4 -8
  40. package/SparkLineChart/SparkLineChart.js +23 -21
  41. package/constants/index.d.ts +8 -1
  42. package/constants/index.js +13 -6
  43. package/context/AnimationProvider/useSkipAnimation.js +1 -1
  44. package/context/ChartProvider/ChartProvider.types.d.ts +6 -6
  45. package/context/PolarProvider/Polar.types.d.ts +3 -2
  46. package/esm/BarChart/BarChart.d.ts +1 -1
  47. package/esm/BarChart/BarChart.js +14 -30
  48. package/esm/BarChart/useBarChartProps.js +3 -18
  49. package/esm/ChartContainer/ChartContainer.d.ts +1 -1
  50. package/esm/ChartContainer/ChartContainer.js +15 -7
  51. package/esm/ChartDataProvider/ChartDataProvider.d.ts +2 -2
  52. package/esm/ChartDataProvider/ChartDataProvider.js +4 -3
  53. package/esm/ChartsAxis/ChartsAxis.d.ts +1 -25
  54. package/esm/ChartsAxis/ChartsAxis.js +24 -86
  55. package/esm/ChartsAxis/axisClasses.d.ts +5 -1
  56. package/esm/ChartsLabel/ChartsLabelMark.d.ts +6 -1
  57. package/esm/ChartsLabel/ChartsLabelMark.js +15 -2
  58. package/esm/ChartsLabel/index.d.ts +1 -1
  59. package/esm/ChartsLabel/index.js +0 -3
  60. package/esm/ChartsLabel/labelGradientClasses.d.ts +1 -1
  61. package/esm/ChartsLabel/labelMarkClasses.d.ts +1 -1
  62. package/esm/ChartsLabel/labelMarkClasses.js +1 -1
  63. package/esm/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  64. package/esm/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  65. package/esm/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
  66. package/esm/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
  67. package/esm/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
  68. package/esm/ChartsTooltip/ChartsTooltipTable.js +1 -1
  69. package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
  70. package/esm/ChartsXAxis/ChartsXAxis.js +70 -57
  71. package/esm/ChartsYAxis/ChartsYAxis.js +12 -16
  72. package/esm/Gauge/Gauge.js +4 -3
  73. package/esm/Gauge/GaugeContainer.js +7 -5
  74. package/esm/LineChart/LineChart.d.ts +1 -1
  75. package/esm/LineChart/LineChart.js +14 -30
  76. package/esm/LineChart/useLineChartProps.js +2 -17
  77. package/esm/PieChart/PieArcLabelPlot.js +1 -1
  78. package/esm/PieChart/PieArcPlot.js +1 -1
  79. package/esm/PieChart/PieChart.d.ts +1 -1
  80. package/esm/PieChart/PieChart.js +6 -4
  81. package/esm/ScatterChart/ScatterChart.d.ts +1 -1
  82. package/esm/ScatterChart/ScatterChart.js +14 -30
  83. package/esm/ScatterChart/useScatterChartProps.js +2 -17
  84. package/esm/SparkLineChart/SparkLineChart.d.ts +4 -8
  85. package/esm/SparkLineChart/SparkLineChart.js +23 -21
  86. package/esm/constants/index.d.ts +8 -1
  87. package/esm/constants/index.js +12 -5
  88. package/esm/context/AnimationProvider/useSkipAnimation.js +1 -1
  89. package/esm/context/ChartProvider/ChartProvider.types.d.ts +6 -6
  90. package/esm/context/PolarProvider/Polar.types.d.ts +3 -2
  91. package/esm/hooks/useAxis.d.ts +2 -2
  92. package/esm/hooks/useAxis.js +1 -1
  93. package/esm/hooks/useSvgRef.js +1 -1
  94. package/esm/index.js +1 -1
  95. package/esm/internals/defaultizeColor.d.ts +23 -23
  96. package/esm/internals/defaultizeMargin.d.ts +3 -0
  97. package/esm/internals/defaultizeMargin.js +15 -0
  98. package/esm/internals/domUtils.js +1 -0
  99. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.d.ts +1 -1
  100. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +52 -31
  101. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +549 -105
  102. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +19 -18
  103. package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +7 -16
  104. package/esm/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +2 -2
  105. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +2 -3
  106. package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +3 -3
  107. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  108. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +7 -2
  109. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +13 -15
  110. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +37 -35
  111. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +3 -36
  112. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +37 -9
  113. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -1
  114. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -1
  115. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +216 -0
  116. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +6 -0
  117. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +15 -14
  118. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +15 -13
  119. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +70 -0
  120. package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +4 -0
  121. package/{internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.d.ts → esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts} +1815 -911
  122. package/{modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js → esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js} +4 -6
  123. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +86 -130
  124. package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +2 -2
  125. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +188 -71
  126. package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +9 -4
  127. package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.d.ts +2 -2
  128. package/esm/internals/plugins/models/plugin.d.ts +1 -1
  129. package/esm/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
  130. package/esm/internals/plugins/utils/ChartStore.d.ts +7 -7
  131. package/esm/internals/plugins/utils/selectors.d.ts +1 -0
  132. package/esm/internals/store/useCharts.js +0 -8
  133. package/esm/internals/store/useSelector.d.ts +1 -1
  134. package/esm/internals/store/useSelector.js +4 -1
  135. package/esm/internals/store/useStore.js +1 -1
  136. package/esm/models/axis.d.ts +56 -10
  137. package/esm/models/colorMapping.d.ts +1 -1
  138. package/esm/models/index.d.ts +0 -1
  139. package/esm/models/index.js +0 -1
  140. package/esm/models/seriesType/bar.d.ts +1 -1
  141. package/esm/models/seriesType/config.d.ts +1 -1
  142. package/esm/models/seriesType/line.d.ts +1 -1
  143. package/esm/models/seriesType/pie.d.ts +1 -1
  144. package/esm/models/seriesType/scatter.d.ts +1 -1
  145. package/esm/models/z-axis.d.ts +1 -1
  146. package/hooks/useAxis.d.ts +2 -2
  147. package/hooks/useAxis.js +5 -5
  148. package/hooks/useSvgRef.js +1 -1
  149. package/index.js +1 -1
  150. package/internals/defaultizeColor.d.ts +23 -23
  151. package/internals/defaultizeMargin.d.ts +3 -0
  152. package/internals/defaultizeMargin.js +22 -0
  153. package/internals/domUtils.js +1 -0
  154. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.d.ts +1 -1
  155. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +51 -30
  156. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +549 -105
  157. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +20 -19
  158. package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +7 -16
  159. package/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +2 -2
  160. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +2 -3
  161. package/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +3 -3
  162. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  163. package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +7 -2
  164. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +13 -15
  165. package/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +39 -37
  166. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +3 -36
  167. package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +36 -8
  168. package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -1
  169. package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +4 -4
  170. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +216 -0
  171. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +12 -0
  172. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +16 -15
  173. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +15 -13
  174. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +70 -0
  175. package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +11 -0
  176. package/{modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.d.ts → internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts} +1815 -911
  177. package/internals/plugins/featurePlugins/useChartCartesianAxis/{useChartCartesianAxis.selectors.js → useChartCartesianAxisRendering.selectors.js} +10 -13
  178. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +86 -130
  179. package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +2 -2
  180. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +188 -71
  181. package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +10 -5
  182. package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.d.ts +2 -2
  183. package/internals/plugins/models/plugin.d.ts +1 -1
  184. package/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
  185. package/internals/plugins/utils/ChartStore.d.ts +7 -7
  186. package/internals/plugins/utils/selectors.d.ts +1 -0
  187. package/internals/store/useCharts.js +0 -8
  188. package/internals/store/useSelector.d.ts +1 -1
  189. package/internals/store/useSelector.js +5 -1
  190. package/internals/store/useStore.js +1 -1
  191. package/models/axis.d.ts +56 -10
  192. package/models/colorMapping.d.ts +1 -1
  193. package/models/index.d.ts +0 -1
  194. package/models/index.js +0 -11
  195. package/models/seriesType/bar.d.ts +1 -1
  196. package/models/seriesType/config.d.ts +1 -1
  197. package/models/seriesType/line.d.ts +1 -1
  198. package/models/seriesType/pie.d.ts +1 -1
  199. package/models/seriesType/scatter.d.ts +1 -1
  200. package/models/z-axis.d.ts +1 -1
  201. package/modern/BarChart/BarChart.d.ts +1 -1
  202. package/modern/BarChart/BarChart.js +14 -30
  203. package/modern/BarChart/useBarChartProps.js +3 -18
  204. package/modern/ChartContainer/ChartContainer.d.ts +1 -1
  205. package/modern/ChartContainer/ChartContainer.js +15 -7
  206. package/modern/ChartDataProvider/ChartDataProvider.d.ts +2 -2
  207. package/modern/ChartDataProvider/ChartDataProvider.js +4 -3
  208. package/modern/ChartsAxis/ChartsAxis.d.ts +1 -25
  209. package/modern/ChartsAxis/ChartsAxis.js +24 -86
  210. package/modern/ChartsAxis/axisClasses.d.ts +5 -1
  211. package/modern/ChartsLabel/ChartsLabelMark.d.ts +6 -1
  212. package/modern/ChartsLabel/ChartsLabelMark.js +15 -2
  213. package/modern/ChartsLabel/index.d.ts +1 -1
  214. package/modern/ChartsLabel/index.js +0 -3
  215. package/modern/ChartsLabel/labelGradientClasses.d.ts +1 -1
  216. package/modern/ChartsLabel/labelMarkClasses.d.ts +1 -1
  217. package/modern/ChartsLabel/labelMarkClasses.js +1 -1
  218. package/modern/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  219. package/modern/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
  220. package/modern/ChartsLegend/piecewiseColorLegendClasses.d.ts +1 -1
  221. package/modern/ChartsReferenceLine/ChartsXReferenceLine.d.ts +1 -1
  222. package/modern/ChartsReferenceLine/ChartsYReferenceLine.d.ts +1 -1
  223. package/modern/ChartsTooltip/ChartsTooltipTable.js +1 -1
  224. package/modern/ChartsTooltip/chartsTooltipClasses.d.ts +1 -1
  225. package/modern/ChartsXAxis/ChartsXAxis.js +70 -57
  226. package/modern/ChartsYAxis/ChartsYAxis.js +12 -16
  227. package/modern/Gauge/Gauge.js +4 -3
  228. package/modern/Gauge/GaugeContainer.js +7 -5
  229. package/modern/LineChart/LineChart.d.ts +1 -1
  230. package/modern/LineChart/LineChart.js +14 -30
  231. package/modern/LineChart/useLineChartProps.js +2 -17
  232. package/modern/PieChart/PieArcLabelPlot.js +1 -1
  233. package/modern/PieChart/PieArcPlot.js +1 -1
  234. package/modern/PieChart/PieChart.d.ts +1 -1
  235. package/modern/PieChart/PieChart.js +6 -4
  236. package/modern/ScatterChart/ScatterChart.d.ts +1 -1
  237. package/modern/ScatterChart/ScatterChart.js +14 -30
  238. package/modern/ScatterChart/useScatterChartProps.js +2 -17
  239. package/modern/SparkLineChart/SparkLineChart.d.ts +4 -8
  240. package/modern/SparkLineChart/SparkLineChart.js +23 -21
  241. package/modern/constants/index.d.ts +8 -1
  242. package/modern/constants/index.js +12 -5
  243. package/modern/context/AnimationProvider/useSkipAnimation.js +1 -1
  244. package/modern/context/ChartProvider/ChartProvider.types.d.ts +6 -6
  245. package/modern/context/PolarProvider/Polar.types.d.ts +3 -2
  246. package/modern/hooks/useAxis.d.ts +2 -2
  247. package/modern/hooks/useAxis.js +1 -1
  248. package/modern/hooks/useSvgRef.js +1 -1
  249. package/modern/index.js +1 -1
  250. package/modern/internals/defaultizeColor.d.ts +23 -23
  251. package/modern/internals/defaultizeMargin.d.ts +3 -0
  252. package/modern/internals/defaultizeMargin.js +15 -0
  253. package/modern/internals/domUtils.js +1 -0
  254. package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.d.ts +1 -1
  255. package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +52 -31
  256. package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +549 -105
  257. package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.js +19 -18
  258. package/modern/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +7 -16
  259. package/modern/internals/plugins/corePlugins/useChartSeries/processSeries.d.ts +2 -2
  260. package/modern/internals/plugins/corePlugins/useChartSeries/useChartSeries.js +2 -3
  261. package/modern/internals/plugins/corePlugins/useChartSeries/useChartSeries.types.d.ts +3 -3
  262. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
  263. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +7 -2
  264. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.d.ts +13 -15
  265. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/createAxisFilterMapper.js +37 -35
  266. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.d.ts +3 -36
  267. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +37 -9
  268. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -1
  269. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -1
  270. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +216 -0
  271. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.js +6 -0
  272. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +15 -14
  273. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +15 -13
  274. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.d.ts +70 -0
  275. package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisLayout.selectors.js +4 -0
  276. package/{esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.d.ts → modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts} +1815 -911
  277. package/{esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.selectors.js → modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js} +4 -6
  278. package/modern/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +86 -130
  279. package/modern/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.js +2 -2
  280. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +188 -71
  281. package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +9 -4
  282. package/modern/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.types.d.ts +2 -2
  283. package/modern/internals/plugins/models/plugin.d.ts +1 -1
  284. package/modern/internals/plugins/models/seriesConfig/seriesProcessor.types.d.ts +1 -1
  285. package/modern/internals/plugins/utils/ChartStore.d.ts +7 -7
  286. package/modern/internals/plugins/utils/selectors.d.ts +1 -0
  287. package/modern/internals/store/useCharts.js +0 -8
  288. package/modern/internals/store/useSelector.d.ts +1 -1
  289. package/modern/internals/store/useSelector.js +4 -1
  290. package/modern/internals/store/useStore.js +1 -1
  291. package/modern/models/axis.d.ts +56 -10
  292. package/modern/models/colorMapping.d.ts +1 -1
  293. package/modern/models/index.d.ts +0 -1
  294. package/modern/models/index.js +0 -1
  295. package/modern/models/seriesType/bar.d.ts +1 -1
  296. package/modern/models/seriesType/config.d.ts +1 -1
  297. package/modern/models/seriesType/line.d.ts +1 -1
  298. package/modern/models/seriesType/pie.d.ts +1 -1
  299. package/modern/models/seriesType/scatter.d.ts +1 -1
  300. package/modern/models/z-axis.d.ts +1 -1
  301. package/package.json +3 -3
  302. package/tsconfig.build.tsbuildinfo +1 -1
  303. package/esm/internals/calculateMargins.d.ts +0 -7
  304. package/esm/internals/calculateMargins.js +0 -25
  305. package/esm/models/layout.d.ts +0 -18
  306. package/esm/models/layout.js +0 -1
  307. package/internals/calculateMargins.d.ts +0 -7
  308. package/internals/calculateMargins.js +0 -33
  309. package/models/layout.d.ts +0 -18
  310. package/models/layout.js +0 -5
  311. package/modern/internals/calculateMargins.d.ts +0 -7
  312. package/modern/internals/calculateMargins.js +0 -25
  313. package/modern/models/layout.d.ts +0 -18
  314. package/modern/models/layout.js +0 -1
@@ -1,31 +1,11 @@
1
1
  'use client';
2
2
 
3
- import _extends from "@babel/runtime/helpers/esm/extends";
4
3
  import * as React from 'react';
5
4
  import PropTypes from 'prop-types';
6
5
  import { ChartsXAxis } from "../ChartsXAxis/index.js";
7
6
  import { ChartsYAxis } from "../ChartsYAxis/index.js";
8
7
  import { useXAxes, useYAxes } from "../hooks/index.js";
9
8
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
- const getAxisId = (propsValue, defaultAxisId) => {
11
- if (propsValue == null) {
12
- return null;
13
- }
14
- if (typeof propsValue === 'object') {
15
- return propsValue.axisId ?? defaultAxisId ?? null;
16
- }
17
- return propsValue;
18
- };
19
- const mergeProps = (axisConfig, slots, slotProps) => {
20
- return typeof axisConfig === 'object' ? _extends({}, axisConfig, {
21
- slots: _extends({}, slots, axisConfig?.slots),
22
- slotProps: _extends({}, slotProps, axisConfig?.slotProps)
23
- }) : {
24
- slots,
25
- slotProps
26
- };
27
- };
28
-
29
9
  /**
30
10
  * Demos:
31
11
  *
@@ -37,55 +17,37 @@ const mergeProps = (axisConfig, slots, slotProps) => {
37
17
  */
38
18
  function ChartsAxis(props) {
39
19
  const {
40
- topAxis,
41
- leftAxis,
42
- rightAxis,
43
- bottomAxis,
44
20
  slots,
45
21
  slotProps
46
22
  } = props;
47
23
  const {
48
- xAxis,
49
- xAxisIds
24
+ xAxisIds,
25
+ xAxis
50
26
  } = useXAxes();
51
27
  const {
52
- yAxis,
53
- yAxisIds
28
+ yAxisIds,
29
+ yAxis
54
30
  } = useYAxes();
55
- const leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis, yAxisIds[0]);
56
- const bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis, xAxisIds[0]);
57
- const topId = getAxisId(topAxis, xAxisIds[0]);
58
- const rightId = getAxisId(rightAxis, yAxisIds[0]);
59
- if (topId !== null && !xAxis[topId]) {
60
- throw new Error([`MUI X: id used for top axis "${topId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
61
- }
62
- if (leftId !== null && !yAxis[leftId]) {
63
- throw new Error([`MUI X: id used for left axis "${leftId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
64
- }
65
- if (rightId !== null && !yAxis[rightId]) {
66
- throw new Error([`MUI X: id used for right axis "${rightId}" is not defined.`, `Available ids are: ${yAxisIds.join(', ')}.`].join('\n'));
67
- }
68
- if (bottomId !== null && !xAxis[bottomId]) {
69
- throw new Error([`MUI X: id used for bottom axis "${bottomId}" is not defined.`, `Available ids are: ${xAxisIds.join(', ')}.`].join('\n'));
70
- }
71
- const topAxisProps = mergeProps(topAxis, slots, slotProps);
72
- const bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
73
- const leftAxisProps = mergeProps(leftAxis, slots, slotProps);
74
- const rightAxisProps = mergeProps(rightAxis, slots, slotProps);
75
31
  return /*#__PURE__*/_jsxs(React.Fragment, {
76
- children: [topId && /*#__PURE__*/_jsx(ChartsXAxis, _extends({}, topAxisProps, {
77
- position: "top",
78
- axisId: topId
79
- })), bottomId && /*#__PURE__*/_jsx(ChartsXAxis, _extends({}, bottomAxisProps, {
80
- position: "bottom",
81
- axisId: bottomId
82
- })), leftId && /*#__PURE__*/_jsx(ChartsYAxis, _extends({}, leftAxisProps, {
83
- position: "left",
84
- axisId: leftId
85
- })), rightId && /*#__PURE__*/_jsx(ChartsYAxis, _extends({}, rightAxisProps, {
86
- position: "right",
87
- axisId: rightId
88
- }))]
32
+ children: [xAxisIds.map(axisId => {
33
+ if (!xAxis[axisId].position || xAxis[axisId].position === 'none') {
34
+ return null;
35
+ }
36
+ return /*#__PURE__*/_jsx(ChartsXAxis, {
37
+ slots: slots,
38
+ slotProps: slotProps,
39
+ axisId: axisId
40
+ }, axisId);
41
+ }), yAxisIds.map(axisId => {
42
+ if (!yAxis[axisId].position || yAxis[axisId].position === 'none') {
43
+ return null;
44
+ }
45
+ return /*#__PURE__*/_jsx(ChartsYAxis, {
46
+ slots: slots,
47
+ slotProps: slotProps,
48
+ axisId: axisId
49
+ }, axisId);
50
+ })]
89
51
  });
90
52
  }
91
53
  process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
@@ -93,24 +55,6 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
93
55
  // | These PropTypes are generated from the TypeScript type definitions |
94
56
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
95
57
  // ----------------------------------------------------------------------
96
- /**
97
- * Indicate which axis to display the bottom of the charts.
98
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
99
- * @default xAxisIds[0] The id of the first provided axis
100
- */
101
- bottomAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
102
- /**
103
- * Indicate which axis to display the left of the charts.
104
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
105
- * @default yAxisIds[0] The id of the first provided axis
106
- */
107
- leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
108
- /**
109
- * Indicate which axis to display the right of the charts.
110
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
111
- * @default null
112
- */
113
- rightAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
114
58
  /**
115
59
  * The props used for each component slot.
116
60
  * @default {}
@@ -120,12 +64,6 @@ process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
120
64
  * Overridable component slots.
121
65
  * @default {}
122
66
  */
123
- slots: PropTypes.object,
124
- /**
125
- * Indicate which axis to display the top of the charts.
126
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
127
- * @default null
128
- */
129
- topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string])
67
+ slots: PropTypes.object
130
68
  } : void 0;
131
69
  export { ChartsAxis };
@@ -7,7 +7,11 @@ export interface ChartsAxisClasses {
7
7
  tickContainer: string;
8
8
  /** Styles applied to ticks. */
9
9
  tick: string;
10
- /** Styles applied to ticks label. */
10
+ /** Styles applied to ticks label.
11
+ *
12
+ * ⚠️ For performance reasons, only the inline styles get considered for bounding box computation.
13
+ * Modifying text size by adding properties like `font-size` or `letter-spacing` to this class might cause labels to overlap.
14
+ */
11
15
  tickLabel: string;
12
16
  /** Styles applied to the group containing the axis label. */
13
17
  label: string;
@@ -1,12 +1,17 @@
1
1
  import * as React from 'react';
2
2
  import { SxProps, Theme } from '@mui/material/styles';
3
3
  import { ChartsLabelMarkClasses } from "./labelMarkClasses.js";
4
+ export interface ChartsLabelCustomMarkProps {
5
+ className?: string;
6
+ /** Color of the series this mark refers to. */
7
+ color?: string;
8
+ }
4
9
  export interface ChartsLabelMarkProps {
5
10
  /**
6
11
  * The type of the mark.
7
12
  * @default 'square'
8
13
  */
9
- type?: 'square' | 'circle' | 'line';
14
+ type?: 'square' | 'circle' | 'line' | React.ComponentType<ChartsLabelCustomMarkProps>;
10
15
  /**
11
16
  * The color of the mark.
12
17
  */
@@ -20,8 +20,11 @@ const Root = styled('div', {
20
20
  alignItems: 'center',
21
21
  justifyContent: 'center',
22
22
  flexShrink: 0,
23
+ width: 14,
24
+ height: 14,
23
25
  [`&.${labelMarkClasses.line}`]: {
24
26
  width: 16,
27
+ height: 'unset',
25
28
  display: 'flex',
26
29
  alignItems: 'center',
27
30
  [`.${labelMarkClasses.mask}`]: {
@@ -44,7 +47,13 @@ const Root = styled('div', {
44
47
  overflow: 'hidden'
45
48
  },
46
49
  svg: {
47
- display: 'block',
50
+ display: 'block'
51
+ },
52
+ [`& .${labelMarkClasses.mask} > *`]: {
53
+ height: '100%',
54
+ width: '100%'
55
+ },
56
+ [`& .${labelMarkClasses.mask}`]: {
48
57
  height: '100%',
49
58
  width: '100%'
50
59
  }
@@ -68,6 +77,7 @@ const ChartsLabelMark = consumeThemeProps('MuiChartsLabelMark', {
68
77
  classes
69
78
  } = props,
70
79
  other = _objectWithoutPropertiesLoose(props, _excluded);
80
+ const Component = type;
71
81
  return /*#__PURE__*/_jsx(Root, _extends({
72
82
  className: clsx(classes?.root, className),
73
83
  ownerState: props,
@@ -76,7 +86,10 @@ const ChartsLabelMark = consumeThemeProps('MuiChartsLabelMark', {
76
86
  }, other, {
77
87
  children: /*#__PURE__*/_jsx("div", {
78
88
  className: classes?.mask,
79
- children: /*#__PURE__*/_jsx("svg", {
89
+ children: typeof Component === 'function' ? /*#__PURE__*/_jsx(Component, {
90
+ className: classes?.fill,
91
+ color: color
92
+ }) : /*#__PURE__*/_jsx("svg", {
80
93
  viewBox: "0 0 24 24",
81
94
  preserveAspectRatio: type === 'line' ? 'none' : undefined,
82
95
  children: /*#__PURE__*/_jsx("rect", {
@@ -1,4 +1,4 @@
1
- export type { ChartsLabelMarkProps } from './ChartsLabelMark';
1
+ export type { ChartsLabelMarkProps, ChartsLabelCustomMarkProps } from './ChartsLabelMark';
2
2
  export { labelClasses } from "./labelClasses.js";
3
3
  export type { ChartsLabelClasses } from './labelClasses';
4
4
  export { labelMarkClasses } from "./labelMarkClasses.js";
@@ -1,6 +1,3 @@
1
- // export * from './ChartsLabel';
2
-
3
- // export * from './ChartsLabelGradient';
4
1
  export { labelClasses } from "./labelClasses.js";
5
2
  export { labelMarkClasses } from "./labelMarkClasses.js";
6
3
  export { labelGradientClasses } from "./labelGradientClasses.js";
@@ -13,4 +13,4 @@ export interface ChartsLabelGradientClasses {
13
13
  }
14
14
  export declare function getLabelGradientUtilityClass(slot: string): string;
15
15
  export declare const labelGradientClasses: ChartsLabelGradientClasses;
16
- export declare const useUtilityClasses: (props: ChartsLabelGradientProps) => Record<"fill" | "mask" | "root", string>;
16
+ export declare const useUtilityClasses: (props: ChartsLabelGradientProps) => Record<"root" | "mask" | "fill", string>;
@@ -15,4 +15,4 @@ export interface ChartsLabelMarkClasses {
15
15
  }
16
16
  export declare function getLabelMarkUtilityClass(slot: string): string;
17
17
  export declare const labelMarkClasses: ChartsLabelMarkClasses;
18
- export declare const useUtilityClasses: (props: ChartsLabelMarkProps) => Record<"fill" | "mask" | "root", string>;
18
+ export declare const useUtilityClasses: (props: ChartsLabelMarkProps) => Record<"root" | "mask" | "fill", string>;
@@ -10,7 +10,7 @@ export const useUtilityClasses = props => {
10
10
  type
11
11
  } = props;
12
12
  const slots = {
13
- root: ['root', type],
13
+ root: typeof type === 'function' ? ['root'] : ['root', type],
14
14
  mask: ['mask'],
15
15
  fill: ['fill']
16
16
  };
@@ -14,5 +14,5 @@ export interface ChartsLegendClasses {
14
14
  /** Styles applied to the legend in row layout. */
15
15
  horizontal: string;
16
16
  }
17
- export declare const useUtilityClasses: (props: ChartsLegendProps & ChartsLegendSlotExtension) => Record<"label" | "mark" | "root" | "series", string>;
17
+ export declare const useUtilityClasses: (props: ChartsLegendProps & ChartsLegendSlotExtension) => Record<"root" | "label" | "mark" | "series", string>;
18
18
  export declare const legendClasses: ChartsLegendClasses;
@@ -22,5 +22,5 @@ export interface ContinuousColorLegendClasses {
22
22
  /** Styles applied to the series label. */
23
23
  label: string;
24
24
  }
25
- export declare const useUtilityClasses: (props: ContinuousColorLegendProps & ChartsLegendSlotExtension) => Record<"label" | "mark" | "root" | "minLabel" | "maxLabel" | "gradient", string>;
25
+ export declare const useUtilityClasses: (props: ContinuousColorLegendProps & ChartsLegendSlotExtension) => Record<"root" | "label" | "mark" | "minLabel" | "maxLabel" | "gradient", string>;
26
26
  export declare const continuousColorLegendClasses: ContinuousColorLegendClasses;
@@ -24,5 +24,5 @@ export interface PiecewiseColorLegendClasses {
24
24
  /** Styles applied to the series label. */
25
25
  label: string;
26
26
  }
27
- export declare const useUtilityClasses: (props: PiecewiseColorLegendProps & ChartsLegendSlotExtension) => Record<"label" | "mark" | "root" | "item" | "minLabel" | "maxLabel", string>;
27
+ export declare const useUtilityClasses: (props: PiecewiseColorLegendProps & ChartsLegendSlotExtension) => Record<"root" | "label" | "mark" | "item" | "minLabel" | "maxLabel", string>;
28
28
  export declare const piecewiseColorLegendClasses: PiecewiseColorLegendClasses;
@@ -8,6 +8,6 @@ export type ChartsXReferenceLineProps<TValue extends string | number | Date = st
8
8
  */
9
9
  x: TValue;
10
10
  };
11
- export declare function getXReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"line" | "label" | "root", string>;
11
+ export declare function getXReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"root" | "line" | "label", string>;
12
12
  declare function ChartsXReferenceLine(props: ChartsXReferenceLineProps): React.JSX.Element | null;
13
13
  export { ChartsXReferenceLine };
@@ -8,6 +8,6 @@ export type ChartsYReferenceLineProps<TValue extends string | number | Date = st
8
8
  */
9
9
  y: TValue;
10
10
  };
11
- export declare function getYReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"line" | "label" | "root", string>;
11
+ export declare function getYReferenceLineClasses(classes?: Partial<ChartsReferenceLineClasses>): Record<"root" | "line" | "label", string>;
12
12
  declare function ChartsYReferenceLine(props: ChartsYReferenceLineProps): React.JSX.Element | null;
13
13
  export { ChartsYReferenceLine };
@@ -13,7 +13,7 @@ export const ChartsTooltipPaper = styled('div', {
13
13
  }) => ({
14
14
  backgroundColor: (theme.vars || theme).palette.background.paper,
15
15
  color: (theme.vars || theme).palette.text.primary,
16
- borderRadius: theme.shape.borderRadius,
16
+ borderRadius: (theme.vars || theme).shape?.borderRadius,
17
17
  border: `solid ${(theme.vars || theme).palette.divider} 1px`
18
18
  }));
19
19
 
@@ -23,4 +23,4 @@ export interface ChartsTooltipClasses {
23
23
  export type ChartsTooltipClassKey = keyof Omit<ChartsTooltipClasses, 'markCell' | 'labelCell' | 'valueCell'>;
24
24
  export declare function getChartsTooltipUtilityClass(slot: string): string;
25
25
  export declare const chartsTooltipClasses: ChartsTooltipClasses;
26
- export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"mark" | "table" | "root" | "cell" | "row" | "markCell" | "labelCell" | "valueCell" | "paper" | "axisValueCell", string>;
26
+ export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"root" | "mark" | "table" | "cell" | "row" | "markCell" | "labelCell" | "valueCell" | "paper" | "axisValueCell", string>;
@@ -1,7 +1,7 @@
1
1
  'use client';
2
2
 
3
- import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
4
3
  import _extends from "@babel/runtime/helpers/esm/extends";
4
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
5
5
  const _excluded = ["scale", "tickNumber", "reverse"];
6
6
  import * as React from 'react';
7
7
  import PropTypes from 'prop-types';
@@ -36,61 +36,68 @@ const useUtilityClasses = ownerState => {
36
36
  };
37
37
  return composeClasses(slots, getAxisUtilityClass, classes);
38
38
  };
39
- function addLabelDimension(xTicks, {
39
+
40
+ /* Returns a set of indices of the tick labels that should be visible. */
41
+ function getVisibleLabels(xTicks, {
40
42
  tickLabelStyle: style,
41
43
  tickLabelInterval,
44
+ tickLabelMinGap,
42
45
  reverse,
43
- isMounted
46
+ isMounted,
47
+ isPointInside
44
48
  }) {
45
- const withDimension = xTicks.map(tick => {
49
+ const getTickLabelSize = tick => {
46
50
  if (!isMounted || tick.formattedValue === undefined) {
47
- return _extends({}, tick, {
51
+ return {
48
52
  width: 0,
49
53
  height: 0
50
- });
54
+ };
51
55
  }
52
56
  const tickSizes = getWordsByLines({
53
57
  style,
54
58
  needsComputation: true,
55
59
  text: tick.formattedValue
56
60
  });
57
- return _extends({}, tick, {
61
+ return {
58
62
  width: Math.max(...tickSizes.map(size => size.width)),
59
63
  height: Math.max(tickSizes.length * tickSizes[0].height)
60
- });
61
- });
64
+ };
65
+ };
62
66
  if (typeof tickLabelInterval === 'function') {
63
- return withDimension.map((item, index) => _extends({}, item, {
64
- skipLabel: !tickLabelInterval(item.value, index)
65
- }));
67
+ return new Set(xTicks.filter((item, index) => tickLabelInterval(item.value, index)));
66
68
  }
67
69
 
68
70
  // Filter label to avoid overlap
69
- let currentTextLimit = 0;
70
71
  let previousTextLimit = 0;
71
72
  const direction = reverse ? -1 : 1;
72
- return withDimension.map((item, labelIndex) => {
73
+ return new Set(xTicks.filter((item, labelIndex) => {
73
74
  const {
74
- width,
75
75
  offset,
76
- labelOffset,
77
- height
76
+ labelOffset
78
77
  } = item;
79
- const distance = getMinXTranslation(width, height, style?.angle);
80
78
  const textPosition = offset + labelOffset;
81
- const gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
79
+ if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
80
+ return false;
81
+ }
82
+ if (!isPointInside(textPosition)) {
83
+ return false;
84
+ }
82
85
 
83
- currentTextLimit = textPosition - direction * (gapRatio * distance) / 2;
84
- if (labelIndex > 0 && direction * currentTextLimit < direction * previousTextLimit) {
86
+ /* Measuring text width is expensive, so we need to delay it as much as possible to improve performance. */
87
+ const {
88
+ width,
89
+ height
90
+ } = getTickLabelSize(item);
91
+ const distance = getMinXTranslation(width, height, style?.angle);
92
+ const currentTextLimit = textPosition - direction * distance / 2;
93
+ if (labelIndex > 0 && direction * currentTextLimit < direction * (previousTextLimit + tickLabelMinGap)) {
85
94
  // Except for the first label, we skip all label that overlap with the last accepted.
86
95
  // Notice that the early return prevents `previousTextLimit` from being updated.
87
- return _extends({}, item, {
88
- skipLabel: true
89
- });
96
+ return false;
90
97
  }
91
- previousTextLimit = textPosition + direction * (gapRatio * distance) / 2;
92
- return item;
93
- });
98
+ previousTextLimit = textPosition + direction * distance / 2;
99
+ return true;
100
+ }));
94
101
  }
95
102
  const XAxisRoot = styled(AxisRoot, {
96
103
  name: 'MuiChartsXAxis',
@@ -98,10 +105,10 @@ const XAxisRoot = styled(AxisRoot, {
98
105
  overridesResolver: (props, styles) => styles.root
99
106
  })({});
100
107
  const defaultProps = {
101
- position: 'bottom',
102
108
  disableLine: false,
103
109
  disableTicks: false,
104
- tickSize: 6
110
+ tickSize: 6,
111
+ tickLabelMinGap: 4
105
112
  };
106
113
 
107
114
  /**
@@ -146,12 +153,12 @@ function ChartsXAxis(inProps) {
146
153
  tickLabelInterval,
147
154
  tickPlacement,
148
155
  tickLabelPlacement,
149
- sx
156
+ tickLabelMinGap,
157
+ sx,
158
+ offset
150
159
  } = defaultizedProps;
151
160
  const theme = useTheme();
152
- const classes = useUtilityClasses(_extends({}, defaultizedProps, {
153
- theme
154
- }));
161
+ const classes = useUtilityClasses(defaultizedProps);
155
162
  const {
156
163
  left,
157
164
  top,
@@ -171,7 +178,7 @@ function ChartsXAxis(inProps) {
171
178
  elementType: TickLabel,
172
179
  externalSlotProps: slotProps?.axisTickLabel,
173
180
  additionalProps: {
174
- style: _extends({
181
+ style: _extends({}, theme.typography.caption, {
175
182
  fontSize: 12,
176
183
  textAnchor: 'middle',
177
184
  dominantBaseline: position === 'bottom' ? 'hanging' : 'auto'
@@ -188,11 +195,18 @@ function ChartsXAxis(inProps) {
188
195
  tickPlacement,
189
196
  tickLabelPlacement
190
197
  });
191
- const xTicksWithDimension = addLabelDimension(xTicks, {
198
+ const visibleLabels = getVisibleLabels(xTicks, {
192
199
  tickLabelStyle: axisTickLabelProps.style,
193
200
  tickLabelInterval,
201
+ tickLabelMinGap,
194
202
  reverse,
195
- isMounted
203
+ isMounted,
204
+ isPointInside: x => instance.isPointInside({
205
+ x,
206
+ y: -1
207
+ }, {
208
+ direction: 'x'
209
+ })
196
210
  });
197
211
  const labelRefPoint = {
198
212
  x: left + width / 2,
@@ -215,44 +229,40 @@ function ChartsXAxis(inProps) {
215
229
  // Skip axis rendering if no data is available
216
230
  // - The domain is an empty array for band/point scales.
217
231
  // - The domains contains Infinity for continuous scales.
218
- if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(isInfinity)) {
232
+ // - The position is set to 'none'.
233
+ if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(isInfinity) || position === 'none') {
219
234
  return null;
220
235
  }
221
236
  return /*#__PURE__*/_jsxs(XAxisRoot, {
222
- transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
237
+ transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
223
238
  className: classes.root,
224
239
  sx: sx,
225
240
  children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
226
241
  x1: left,
227
242
  x2: left + width,
228
243
  className: classes.line
229
- }, slotProps?.axisLine)), xTicksWithDimension.map(({
230
- formattedValue,
231
- offset,
232
- labelOffset,
233
- skipLabel
234
- }, index) => {
244
+ }, slotProps?.axisLine)), xTicks.map((item, index) => {
245
+ const {
246
+ formattedValue,
247
+ offset: tickOffset,
248
+ labelOffset
249
+ } = item;
235
250
  const xTickLabel = labelOffset ?? 0;
236
251
  const yTickLabel = positionSign * (tickSize + 3);
237
252
  const showTick = instance.isPointInside({
238
- x: offset,
239
- y: -1
240
- }, {
241
- direction: 'x'
242
- });
243
- const showTickLabel = instance.isPointInside({
244
- x: offset + xTickLabel,
253
+ x: tickOffset,
245
254
  y: -1
246
255
  }, {
247
256
  direction: 'x'
248
257
  });
258
+ const showTickLabel = visibleLabels.has(item);
249
259
  return /*#__PURE__*/_jsxs("g", {
250
- transform: `translate(${offset}, 0)`,
260
+ transform: `translate(${tickOffset}, 0)`,
251
261
  className: classes.tickContainer,
252
262
  children: [!disableTicks && showTick && /*#__PURE__*/_jsx(Tick, _extends({
253
263
  y2: positionSign * tickSize,
254
264
  className: classes.tick
255
- }, slotProps?.axisTick)), formattedValue !== undefined && !skipLabel && showTickLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
265
+ }, slotProps?.axisTick)), formattedValue !== undefined && showTickLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
256
266
  x: xTickLabel,
257
267
  y: yTickLabel
258
268
  }, axisTickLabelProps, {
@@ -272,6 +282,7 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
272
282
  // | These PropTypes are generated from the TypeScript type definitions |
273
283
  // | To update them edit the TypeScript types and run "pnpm proptypes" |
274
284
  // ----------------------------------------------------------------------
285
+ axis: PropTypes.oneOf(['x']),
275
286
  /**
276
287
  * The id of the axis to render.
277
288
  * If undefined, it will be the first defined axis.
@@ -304,10 +315,6 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
304
315
  * The style applied to the axis label.
305
316
  */
306
317
  labelStyle: PropTypes.object,
307
- /**
308
- * Position of the axis.
309
- */
310
- position: PropTypes.oneOf(['bottom', 'top']),
311
318
  /**
312
319
  * The props used for each component slot.
313
320
  * @default {}
@@ -341,6 +348,12 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
341
348
  * @default 'auto'
342
349
  */
343
350
  tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
351
+ /**
352
+ * The minimum gap in pixels between two tick labels.
353
+ * If two tick labels are closer than this minimum gap, one of them will be hidden.
354
+ * @default 4
355
+ */
356
+ tickLabelMinGap: PropTypes.number,
344
357
  /**
345
358
  * The placement of ticks label. Can be the middle of the band, or the tick position.
346
359
  * Only used if scale is 'band'.