@mui/x-charts 6.0.0-alpha.9 → 6.18.1

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 (325) hide show
  1. package/BarChart/BarChart.d.ts +26 -5
  2. package/BarChart/BarChart.js +93 -17
  3. package/BarChart/BarElement.d.ts +1319 -4
  4. package/BarChart/BarElement.js +10 -10
  5. package/BarChart/BarPlot.d.ts +17 -1
  6. package/BarChart/BarPlot.js +152 -66
  7. package/BarChart/formatter.js +2 -3
  8. package/BarChart/legend.js +1 -2
  9. package/CHANGELOG.md +797 -59
  10. package/ChartContainer/index.js +7 -5
  11. package/ChartsAxis/ChartsAxis.d.ts +9 -0
  12. package/ChartsAxis/ChartsAxis.js +33 -7
  13. package/ChartsAxis/axisClasses.d.ts +3 -3
  14. package/ChartsAxis/axisClasses.js +1 -2
  15. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +21 -0
  16. package/ChartsAxisHighlight/ChartsAxisHighlight.js +61 -22
  17. package/ChartsClipPath/ChartsClipPath.d.ts +5 -0
  18. package/ChartsClipPath/ChartsClipPath.js +7 -2
  19. package/ChartsLegend/ChartsLegend.d.ts +45 -24
  20. package/ChartsLegend/ChartsLegend.js +193 -151
  21. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  22. package/ChartsLegend/chartsLegendClasses.js +3 -4
  23. package/ChartsLegend/utils.d.ts +1 -6
  24. package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
  25. package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
  26. package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
  27. package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
  28. package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
  29. package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
  30. package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
  31. package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
  32. package/ChartsReferenceLine/common.d.ts +41 -0
  33. package/ChartsReferenceLine/common.js +27 -0
  34. package/ChartsReferenceLine/index.d.ts +2 -0
  35. package/ChartsReferenceLine/index.js +27 -0
  36. package/ChartsReferenceLine/package.json +6 -0
  37. package/ChartsSurface.d.ts +12 -1
  38. package/ChartsSurface.js +9 -18
  39. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -0
  40. package/ChartsTooltip/ChartsAxisTooltipContent.js +46 -32
  41. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +3 -2
  42. package/ChartsTooltip/ChartsItemTooltipContent.js +18 -9
  43. package/ChartsTooltip/ChartsTooltip.d.ts +32 -0
  44. package/ChartsTooltip/ChartsTooltip.js +62 -18
  45. package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -10
  46. package/ChartsTooltip/ChartsTooltipTable.js +22 -20
  47. package/ChartsTooltip/tooltipClasses.js +1 -2
  48. package/ChartsTooltip/utils.js +2 -2
  49. package/ChartsXAxis/ChartsXAxis.d.ts +9 -0
  50. package/ChartsXAxis/ChartsXAxis.js +170 -45
  51. package/ChartsYAxis/ChartsYAxis.d.ts +9 -0
  52. package/ChartsYAxis/ChartsYAxis.js +95 -38
  53. package/LineChart/AreaElement.d.ts +11 -1
  54. package/LineChart/AreaElement.js +14 -6
  55. package/LineChart/AreaPlot.d.ts +11 -0
  56. package/LineChart/AreaPlot.js +27 -8
  57. package/LineChart/LineChart.d.ts +23 -3
  58. package/LineChart/LineChart.js +89 -17
  59. package/LineChart/LineElement.d.ts +11 -1
  60. package/LineChart/LineElement.js +14 -6
  61. package/LineChart/LineHighlightElement.d.ts +10 -0
  62. package/LineChart/LineHighlightElement.js +13 -4
  63. package/LineChart/LineHighlightPlot.d.ts +10 -0
  64. package/LineChart/LineHighlightPlot.js +15 -4
  65. package/LineChart/LinePlot.d.ts +10 -0
  66. package/LineChart/LinePlot.js +25 -12
  67. package/LineChart/MarkElement.d.ts +10 -0
  68. package/LineChart/MarkElement.js +14 -5
  69. package/LineChart/MarkPlot.d.ts +10 -0
  70. package/LineChart/MarkPlot.js +42 -10
  71. package/LineChart/formatter.js +5 -5
  72. package/LineChart/legend.js +1 -2
  73. package/PieChart/PieArc.d.ts +11 -13
  74. package/PieChart/PieArc.js +28 -60
  75. package/PieChart/PieArcLabel.d.ts +8 -9
  76. package/PieChart/PieArcLabel.js +46 -38
  77. package/PieChart/PieArcLabelPlot.d.ts +28 -0
  78. package/PieChart/PieArcLabelPlot.js +99 -0
  79. package/PieChart/PieArcPlot.d.ts +35 -0
  80. package/PieChart/PieArcPlot.js +92 -0
  81. package/PieChart/PieChart.d.ts +19 -5
  82. package/PieChart/PieChart.js +95 -18
  83. package/PieChart/PiePlot.d.ts +15 -9
  84. package/PieChart/PiePlot.js +77 -55
  85. package/PieChart/dataTransform/transition.d.ts +4 -0
  86. package/PieChart/dataTransform/transition.js +136 -0
  87. package/PieChart/dataTransform/useTransformData.d.ts +15 -0
  88. package/PieChart/dataTransform/useTransformData.js +67 -0
  89. package/PieChart/formatter.js +1 -2
  90. package/PieChart/legend.js +1 -2
  91. package/README.md +8 -14
  92. package/ResponsiveChartContainer/index.d.ts +13 -3
  93. package/ResponsiveChartContainer/index.js +7 -8
  94. package/ScatterChart/Scatter.d.ts +10 -0
  95. package/ScatterChart/Scatter.js +12 -2
  96. package/ScatterChart/ScatterChart.d.ts +16 -3
  97. package/ScatterChart/ScatterChart.js +77 -16
  98. package/ScatterChart/ScatterPlot.d.ts +10 -0
  99. package/ScatterChart/ScatterPlot.js +12 -2
  100. package/ScatterChart/formatter.js +1 -2
  101. package/ScatterChart/legend.js +1 -2
  102. package/SparkLineChart/SparkLineChart.d.ts +12 -3
  103. package/SparkLineChart/SparkLineChart.js +50 -7
  104. package/colorPalettes/colorPalettes.js +6 -12
  105. package/constants.js +5 -8
  106. package/context/CartesianContextProvider.d.ts +26 -1
  107. package/context/CartesianContextProvider.js +42 -16
  108. package/context/DrawingProvider.d.ts +25 -0
  109. package/context/DrawingProvider.js +18 -6
  110. package/context/HighlightProvider.d.ts +17 -0
  111. package/context/HighlightProvider.js +3 -4
  112. package/context/InteractionProvider.d.ts +6 -0
  113. package/context/InteractionProvider.js +3 -4
  114. package/context/SeriesContextProvider.d.ts +5 -0
  115. package/context/SeriesContextProvider.js +3 -4
  116. package/esm/BarChart/BarChart.js +90 -13
  117. package/esm/BarChart/BarElement.js +7 -4
  118. package/esm/BarChart/BarPlot.js +152 -67
  119. package/esm/BarChart/formatter.js +1 -1
  120. package/esm/ChartContainer/index.js +3 -0
  121. package/esm/ChartsAxis/ChartsAxis.js +32 -5
  122. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
  123. package/esm/ChartsClipPath/ChartsClipPath.js +5 -0
  124. package/esm/ChartsLegend/ChartsLegend.js +190 -144
  125. package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
  126. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  127. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  128. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  129. package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  130. package/esm/ChartsReferenceLine/common.js +20 -0
  131. package/esm/ChartsReferenceLine/index.js +2 -0
  132. package/esm/ChartsSurface.js +4 -12
  133. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +44 -30
  134. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
  135. package/esm/ChartsTooltip/ChartsTooltip.js +59 -14
  136. package/esm/ChartsTooltip/ChartsTooltipTable.js +17 -10
  137. package/esm/ChartsXAxis/ChartsXAxis.js +168 -43
  138. package/esm/ChartsYAxis/ChartsYAxis.js +93 -36
  139. package/esm/LineChart/AreaElement.js +10 -0
  140. package/esm/LineChart/AreaPlot.js +26 -6
  141. package/esm/LineChart/LineChart.js +86 -13
  142. package/esm/LineChart/LineElement.js +10 -0
  143. package/esm/LineChart/LineHighlightElement.js +10 -0
  144. package/esm/LineChart/LineHighlightPlot.js +13 -2
  145. package/esm/LineChart/LinePlot.js +25 -14
  146. package/esm/LineChart/MarkElement.js +11 -1
  147. package/esm/LineChart/MarkPlot.js +40 -8
  148. package/esm/LineChart/formatter.js +7 -3
  149. package/esm/PieChart/PieArc.js +26 -58
  150. package/esm/PieChart/PieArcLabel.js +43 -34
  151. package/esm/PieChart/PieArcLabelPlot.js +92 -0
  152. package/esm/PieChart/PieArcPlot.js +84 -0
  153. package/esm/PieChart/PieChart.js +93 -16
  154. package/esm/PieChart/PiePlot.js +76 -57
  155. package/esm/PieChart/dataTransform/transition.js +130 -0
  156. package/esm/PieChart/dataTransform/useTransformData.js +59 -0
  157. package/esm/ResponsiveChartContainer/index.js +3 -3
  158. package/esm/ScatterChart/Scatter.js +10 -0
  159. package/esm/ScatterChart/ScatterChart.js +74 -12
  160. package/esm/ScatterChart/ScatterPlot.js +10 -0
  161. package/esm/SparkLineChart/SparkLineChart.js +47 -3
  162. package/esm/constants.js +1 -1
  163. package/esm/context/CartesianContextProvider.js +41 -14
  164. package/esm/context/DrawingProvider.js +14 -0
  165. package/esm/hooks/useChartDimensions.js +2 -0
  166. package/esm/hooks/useMounted.js +16 -0
  167. package/esm/hooks/useReducedMotion.js +27 -0
  168. package/esm/hooks/useTicks.js +15 -9
  169. package/esm/index.js +1 -0
  170. package/esm/internals/components/AxisSharedComponents.js +15 -70
  171. package/esm/internals/components/ChartsText.js +77 -0
  172. package/esm/internals/domUtils.js +113 -0
  173. package/esm/internals/geometry.js +36 -0
  174. package/hooks/useAxisEvents.js +2 -2
  175. package/hooks/useChartDimensions.d.ts +2 -0
  176. package/hooks/useChartDimensions.js +5 -4
  177. package/hooks/useDrawingArea.js +2 -2
  178. package/hooks/useInteractionItemProps.js +2 -2
  179. package/hooks/useMounted.d.ts +1 -0
  180. package/hooks/useMounted.js +25 -0
  181. package/hooks/useReducedMotion.d.ts +8 -0
  182. package/hooks/useReducedMotion.js +33 -0
  183. package/hooks/useScale.d.ts +2 -2
  184. package/hooks/useScale.js +2 -2
  185. package/hooks/useTicks.d.ts +19 -11
  186. package/hooks/useTicks.js +19 -14
  187. package/index.d.ts +1 -0
  188. package/index.js +12 -1
  189. package/internals/components/AxisSharedComponents.d.ts +0 -4
  190. package/internals/components/AxisSharedComponents.js +18 -78
  191. package/internals/components/ChartsText.d.ts +35 -0
  192. package/internals/components/ChartsText.js +87 -0
  193. package/internals/defaultizeColor.d.ts +7 -2
  194. package/internals/defaultizeValueFormatter.js +1 -2
  195. package/internals/domUtils.d.ts +13 -0
  196. package/internals/domUtils.js +122 -0
  197. package/internals/geometry.d.ts +9 -0
  198. package/internals/geometry.js +42 -0
  199. package/internals/isBandScale.d.ts +3 -1
  200. package/internals/stackSeries.js +2 -4
  201. package/internals/utils.d.ts +5 -0
  202. package/legacy/BarChart/BarChart.js +90 -13
  203. package/legacy/BarChart/BarElement.js +6 -3
  204. package/legacy/BarChart/BarPlot.js +151 -63
  205. package/legacy/BarChart/formatter.js +1 -1
  206. package/legacy/ChartContainer/index.js +3 -0
  207. package/legacy/ChartsAxis/ChartsAxis.js +32 -5
  208. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -20
  209. package/legacy/ChartsClipPath/ChartsClipPath.js +5 -0
  210. package/legacy/ChartsLegend/ChartsLegend.js +205 -142
  211. package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
  212. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  213. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  214. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  215. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  216. package/legacy/ChartsReferenceLine/common.js +20 -0
  217. package/legacy/ChartsReferenceLine/index.js +2 -0
  218. package/legacy/ChartsSurface.js +3 -12
  219. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +22 -10
  220. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
  221. package/legacy/ChartsTooltip/ChartsTooltip.js +62 -14
  222. package/legacy/ChartsTooltip/ChartsTooltipTable.js +34 -26
  223. package/legacy/ChartsXAxis/ChartsXAxis.js +176 -50
  224. package/legacy/ChartsYAxis/ChartsYAxis.js +97 -41
  225. package/legacy/LineChart/AreaElement.js +10 -0
  226. package/legacy/LineChart/AreaPlot.js +31 -7
  227. package/legacy/LineChart/LineChart.js +86 -13
  228. package/legacy/LineChart/LineElement.js +10 -0
  229. package/legacy/LineChart/LineHighlightElement.js +10 -0
  230. package/legacy/LineChart/LineHighlightPlot.js +13 -2
  231. package/legacy/LineChart/LinePlot.js +29 -12
  232. package/legacy/LineChart/MarkElement.js +11 -1
  233. package/legacy/LineChart/MarkPlot.js +39 -8
  234. package/legacy/LineChart/formatter.js +7 -3
  235. package/legacy/PieChart/PieArc.js +30 -62
  236. package/legacy/PieChart/PieArcLabel.js +48 -34
  237. package/legacy/PieChart/PieArcLabelPlot.js +93 -0
  238. package/legacy/PieChart/PieArcPlot.js +84 -0
  239. package/legacy/PieChart/PieChart.js +93 -16
  240. package/legacy/PieChart/PiePlot.js +76 -59
  241. package/legacy/PieChart/dataTransform/transition.js +142 -0
  242. package/legacy/PieChart/dataTransform/useTransformData.js +60 -0
  243. package/legacy/ResponsiveChartContainer/index.js +3 -3
  244. package/legacy/ScatterChart/Scatter.js +10 -0
  245. package/legacy/ScatterChart/ScatterChart.js +74 -12
  246. package/legacy/ScatterChart/ScatterPlot.js +10 -0
  247. package/legacy/SparkLineChart/SparkLineChart.js +47 -3
  248. package/legacy/constants.js +1 -1
  249. package/legacy/context/CartesianContextProvider.js +41 -14
  250. package/legacy/context/DrawingProvider.js +14 -0
  251. package/legacy/hooks/useChartDimensions.js +2 -0
  252. package/legacy/hooks/useMounted.js +21 -0
  253. package/legacy/hooks/useReducedMotion.js +27 -0
  254. package/legacy/hooks/useTicks.js +16 -9
  255. package/legacy/index.js +2 -1
  256. package/legacy/internals/components/AxisSharedComponents.js +11 -65
  257. package/legacy/internals/components/ChartsText.js +79 -0
  258. package/legacy/internals/domUtils.js +121 -0
  259. package/legacy/internals/geometry.js +37 -0
  260. package/models/axis.d.ts +58 -20
  261. package/models/layout.d.ts +13 -6
  262. package/models/seriesType/common.d.ts +16 -0
  263. package/models/seriesType/line.d.ts +8 -3
  264. package/models/seriesType/pie.d.ts +5 -1
  265. package/modern/BarChart/BarChart.js +90 -13
  266. package/modern/BarChart/BarElement.js +7 -4
  267. package/modern/BarChart/BarPlot.js +149 -65
  268. package/modern/BarChart/formatter.js +1 -1
  269. package/modern/ChartContainer/index.js +3 -0
  270. package/modern/ChartsAxis/ChartsAxis.js +31 -5
  271. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
  272. package/modern/ChartsClipPath/ChartsClipPath.js +5 -0
  273. package/modern/ChartsLegend/ChartsLegend.js +190 -144
  274. package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
  275. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  276. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
  277. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
  278. package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  279. package/modern/ChartsReferenceLine/common.js +20 -0
  280. package/modern/ChartsReferenceLine/index.js +2 -0
  281. package/modern/ChartsSurface.js +4 -12
  282. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +44 -30
  283. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
  284. package/modern/ChartsTooltip/ChartsTooltip.js +58 -14
  285. package/modern/ChartsTooltip/ChartsTooltipTable.js +17 -10
  286. package/modern/ChartsXAxis/ChartsXAxis.js +167 -42
  287. package/modern/ChartsYAxis/ChartsYAxis.js +92 -35
  288. package/modern/LineChart/AreaElement.js +10 -0
  289. package/modern/LineChart/AreaPlot.js +25 -6
  290. package/modern/LineChart/LineChart.js +86 -13
  291. package/modern/LineChart/LineElement.js +10 -0
  292. package/modern/LineChart/LineHighlightElement.js +10 -0
  293. package/modern/LineChart/LineHighlightPlot.js +13 -2
  294. package/modern/LineChart/LinePlot.js +23 -10
  295. package/modern/LineChart/MarkElement.js +11 -1
  296. package/modern/LineChart/MarkPlot.js +40 -8
  297. package/modern/LineChart/formatter.js +4 -3
  298. package/modern/PieChart/PieArc.js +26 -57
  299. package/modern/PieChart/PieArcLabel.js +43 -34
  300. package/modern/PieChart/PieArcLabelPlot.js +90 -0
  301. package/modern/PieChart/PieArcPlot.js +83 -0
  302. package/modern/PieChart/PieChart.js +93 -16
  303. package/modern/PieChart/PiePlot.js +76 -55
  304. package/modern/PieChart/dataTransform/transition.js +130 -0
  305. package/modern/PieChart/dataTransform/useTransformData.js +58 -0
  306. package/modern/ResponsiveChartContainer/index.js +3 -3
  307. package/modern/ScatterChart/Scatter.js +10 -0
  308. package/modern/ScatterChart/ScatterChart.js +74 -12
  309. package/modern/ScatterChart/ScatterPlot.js +10 -0
  310. package/modern/SparkLineChart/SparkLineChart.js +47 -3
  311. package/modern/constants.js +1 -1
  312. package/modern/context/CartesianContextProvider.js +40 -13
  313. package/modern/context/DrawingProvider.js +14 -0
  314. package/modern/hooks/useChartDimensions.js +2 -0
  315. package/modern/hooks/useMounted.js +16 -0
  316. package/modern/hooks/useReducedMotion.js +27 -0
  317. package/modern/hooks/useTicks.js +15 -9
  318. package/modern/index.js +2 -1
  319. package/modern/internals/components/AxisSharedComponents.js +15 -70
  320. package/modern/internals/components/ChartsText.js +77 -0
  321. package/modern/internals/domUtils.js +113 -0
  322. package/modern/internals/geometry.js +36 -0
  323. package/package.json +9 -6
  324. package/themeAugmentation/components.d.ts +1 -0
  325. package/themeAugmentation/overrides.d.ts +2 -0
@@ -1,29 +1,37 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
- import Box from '@mui/material/Box';
3
- import Paper from '@mui/material/Paper';
2
+ import Box from '@mui/system/Box';
4
3
  import { styled } from '@mui/material/styles';
5
4
  import { tooltipClasses } from './tooltipClasses';
6
- export var ChartsTooltipPaper = styled(Paper, {
5
+ export var ChartsTooltipPaper = styled('div', {
7
6
  name: 'MuiChartsTooltip',
8
- slot: 'Table'
9
- })({});
7
+ slot: 'Container'
8
+ })(function (_ref) {
9
+ var theme = _ref.theme;
10
+ return {
11
+ backgroundColor: (theme.vars || theme).palette.background.paper,
12
+ color: (theme.vars || theme).palette.text.primary,
13
+ transition: theme.transitions.create('box-shadow'),
14
+ border: "1px solid ".concat((theme.vars || theme).palette.divider),
15
+ borderRadius: theme.shape.borderRadius
16
+ };
17
+ });
10
18
  export var ChartsTooltipTable = styled('table', {
11
19
  name: 'MuiChartsTooltip',
12
20
  slot: 'Table'
13
- })(function (_ref) {
14
- var theme = _ref.theme;
21
+ })(function (_ref2) {
22
+ var theme = _ref2.theme;
15
23
  return {
16
24
  borderSpacing: 0,
17
25
  '& thead td': {
18
- borderBottom: "solid ".concat(theme.palette.divider, " 1px")
26
+ borderBottom: "solid ".concat((theme.vars || theme).palette.divider, " 1px")
19
27
  }
20
28
  };
21
29
  });
22
30
  export var ChartsTooltipRow = styled('tr', {
23
31
  name: 'MuiChartsTooltip',
24
32
  slot: 'Row'
25
- })(function (_ref2) {
26
- var theme = _ref2.theme;
33
+ })(function (_ref3) {
34
+ var theme = _ref3.theme;
27
35
  return {
28
36
  'tr:first-of-type& td': {
29
37
  paddingTop: theme.spacing(1)
@@ -36,36 +44,36 @@ export var ChartsTooltipRow = styled('tr', {
36
44
  export var ChartsTooltipCell = styled('td', {
37
45
  name: 'MuiChartsTooltip',
38
46
  slot: 'Cell'
39
- })(function (_ref3) {
40
- var _ref4;
41
- var theme = _ref3.theme;
42
- return _ref4 = {
47
+ })(function (_ref4) {
48
+ var _ref5;
49
+ var theme = _ref4.theme;
50
+ return _ref5 = {
43
51
  verticalAlign: 'middle',
44
- color: theme.palette.text.secondary
45
- }, _defineProperty(_ref4, "&.".concat(tooltipClasses.labelCell), {
52
+ color: (theme.vars || theme).palette.text.secondary
53
+ }, _defineProperty(_ref5, "&.".concat(tooltipClasses.labelCell), {
46
54
  paddingLeft: theme.spacing(1)
47
- }), _defineProperty(_ref4, "&.".concat(tooltipClasses.valueCell), {
55
+ }), _defineProperty(_ref5, "&.".concat(tooltipClasses.valueCell), {
48
56
  paddingLeft: theme.spacing(4),
49
- color: theme.palette.text.primary
50
- }), _defineProperty(_ref4, 'td:first-of-type&', {
57
+ color: (theme.vars || theme).palette.text.primary
58
+ }), _defineProperty(_ref5, 'td:first-of-type&', {
51
59
  paddingLeft: theme.spacing(2)
52
- }), _defineProperty(_ref4, 'td:last-of-type&', {
60
+ }), _defineProperty(_ref5, 'td:last-of-type&', {
53
61
  paddingRight: theme.spacing(2)
54
- }), _ref4;
62
+ }), _ref5;
55
63
  });
56
64
  export var ChartsTooltipMark = styled(Box, {
57
65
  name: 'MuiChartsTooltip',
58
66
  slot: 'Mark'
59
- })(function (_ref5) {
60
- var theme = _ref5.theme,
61
- ownerState = _ref5.ownerState;
67
+ })(function (_ref6) {
68
+ var theme = _ref6.theme,
69
+ ownerState = _ref6.ownerState;
62
70
  return {
63
71
  width: theme.spacing(1),
64
72
  height: theme.spacing(1),
65
73
  borderRadius: '50%',
66
74
  backgroundColor: ownerState.color,
67
- borderColor: theme.palette.background.paper,
68
- border: "solid ".concat(theme.palette.background.paper, " ").concat(theme.spacing(0.25)),
75
+ borderColor: (theme.vars || theme).palette.background.paper,
76
+ border: "solid ".concat((theme.vars || theme).palette.background.paper, " ").concat(theme.spacing(0.25)),
69
77
  boxSizing: 'content-box'
70
78
  };
71
79
  });
@@ -1,15 +1,20 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
2
3
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- var _excluded = ["scale", "ticksNumber"];
4
+ var _excluded = ["scale", "tickNumber"];
4
5
  import * as React from 'react';
5
6
  import PropTypes from 'prop-types';
7
+ import { useSlotProps } from '@mui/base/utils';
6
8
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
7
9
  import { useThemeProps, useTheme } from '@mui/material/styles';
8
10
  import { CartesianContext } from '../context/CartesianContextProvider';
9
11
  import { DrawingContext } from '../context/DrawingProvider';
10
12
  import useTicks from '../hooks/useTicks';
11
13
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
12
- import { ChartsLine, ChartsTick, ChartsTickLabel, ChartsLabel, AxisRoot } from '../internals/components/AxisSharedComponents';
14
+ import { AxisRoot } from '../internals/components/AxisSharedComponents';
15
+ import { ChartsText, getWordsByLines } from '../internals/components/ChartsText';
16
+ import { getMinXTranslation } from '../internals/geometry';
17
+ import { useMounted } from '../hooks/useMounted';
13
18
  import { jsx as _jsx } from "react/jsx-runtime";
14
19
  import { jsxs as _jsxs } from "react/jsx-runtime";
15
20
  var useUtilityClasses = function useUtilityClasses(ownerState) {
@@ -25,60 +30,162 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
25
30
  };
26
31
  return composeClasses(slots, getAxisUtilityClass, classes);
27
32
  };
33
+ function addLabelDimension(xTicks, _ref) {
34
+ var style = _ref.tickLabelStyle,
35
+ tickLabelInterval = _ref.tickLabelInterval,
36
+ isMounted = _ref.isMounted;
37
+ var withDimension = xTicks.map(function (tick) {
38
+ if (!isMounted || tick.formattedValue === undefined) {
39
+ return _extends({}, tick, {
40
+ width: 0,
41
+ height: 0
42
+ });
43
+ }
44
+ var tickSizes = getWordsByLines({
45
+ style: style,
46
+ needsComputation: true,
47
+ text: tick.formattedValue
48
+ });
49
+ return _extends({}, tick, {
50
+ width: Math.max.apply(Math, _toConsumableArray(tickSizes.map(function (size) {
51
+ return size.width;
52
+ }))),
53
+ height: Math.max(tickSizes.length * tickSizes[0].height)
54
+ });
55
+ });
56
+ if (typeof tickLabelInterval === 'function') {
57
+ return withDimension.map(function (item, index) {
58
+ return _extends({}, item, {
59
+ skipLabel: !tickLabelInterval(item.value, index)
60
+ });
61
+ });
62
+ }
63
+
64
+ // Filter label to avoid overlap
65
+ var textStart = 0;
66
+ var textEnd = 0;
67
+ return withDimension.map(function (item, labelIndex) {
68
+ var width = item.width,
69
+ offset = item.offset,
70
+ labelOffset = item.labelOffset,
71
+ height = item.height;
72
+ var distance = getMinXTranslation(width, height, style == null ? void 0 : style.angle);
73
+ var textPosition = offset + labelOffset;
74
+ var gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
75
+
76
+ textStart = textPosition - gapRatio * distance / 2;
77
+ if (labelIndex > 0 && textStart < textEnd) {
78
+ // Except for the first label, we skip all label that overlap with the last accepted.
79
+ // Notice that the early return prevents `textEnd` from being updated.
80
+ return _extends({}, item, {
81
+ skipLabel: true
82
+ });
83
+ }
84
+ textEnd = textPosition + gapRatio * distance / 2;
85
+ return item;
86
+ });
87
+ }
28
88
  var defaultProps = {
29
89
  position: 'bottom',
30
90
  disableLine: false,
31
91
  disableTicks: false,
32
- tickFontSize: 12,
33
- labelFontSize: 14,
34
92
  tickSize: 6
35
93
  };
94
+
95
+ /**
96
+ * Demos:
97
+ *
98
+ * - [Axis](https://mui.com/x/react-charts/axis/)
99
+ *
100
+ * API:
101
+ *
102
+ * - [ChartsXAxis API](https://mui.com/x/api/charts/charts-x-axis/)
103
+ */
36
104
  function ChartsXAxis(inProps) {
37
- var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
105
+ var _props$axisId, _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
38
106
  var props = useThemeProps({
39
107
  props: _extends({}, defaultProps, inProps),
40
108
  name: 'MuiChartsXAxis'
41
109
  });
42
110
  var _React$useContext = React.useContext(CartesianContext),
43
- _React$useContext$xAx = _React$useContext.xAxis[props.axisId],
44
- xScale = _React$useContext$xAx.scale,
45
- ticksNumber = _React$useContext$xAx.ticksNumber,
46
- settings = _objectWithoutProperties(_React$useContext$xAx, _excluded);
111
+ xAxisIds = _React$useContext.xAxisIds;
112
+ var _React$useContext2 = React.useContext(CartesianContext),
113
+ _React$useContext2$xA = _React$useContext2.xAxis[(_props$axisId = props.axisId) != null ? _props$axisId : xAxisIds[0]],
114
+ xScale = _React$useContext2$xA.scale,
115
+ tickNumber = _React$useContext2$xA.tickNumber,
116
+ settings = _objectWithoutProperties(_React$useContext2$xA, _excluded);
117
+ var isMounted = useMounted();
47
118
  var defaultizedProps = _extends({}, defaultProps, settings, props);
48
119
  var position = defaultizedProps.position,
49
120
  disableLine = defaultizedProps.disableLine,
50
121
  disableTicks = defaultizedProps.disableTicks,
51
- tickFontSize = defaultizedProps.tickFontSize,
122
+ tickLabelStyle = defaultizedProps.tickLabelStyle,
52
123
  label = defaultizedProps.label,
124
+ labelStyle = defaultizedProps.labelStyle,
125
+ tickFontSize = defaultizedProps.tickFontSize,
53
126
  labelFontSize = defaultizedProps.labelFontSize,
54
127
  tickSizeProp = defaultizedProps.tickSize,
55
128
  valueFormatter = defaultizedProps.valueFormatter,
56
129
  slots = defaultizedProps.slots,
57
- slotProps = defaultizedProps.slotProps;
130
+ slotProps = defaultizedProps.slotProps,
131
+ tickInterval = defaultizedProps.tickInterval,
132
+ tickLabelInterval = defaultizedProps.tickLabelInterval;
58
133
  var theme = useTheme();
59
134
  var classes = useUtilityClasses(_extends({}, defaultizedProps, {
60
135
  theme: theme
61
136
  }));
62
- var _React$useContext2 = React.useContext(DrawingContext),
63
- left = _React$useContext2.left,
64
- top = _React$useContext2.top,
65
- width = _React$useContext2.width,
66
- height = _React$useContext2.height;
137
+ var _React$useContext3 = React.useContext(DrawingContext),
138
+ left = _React$useContext3.left,
139
+ top = _React$useContext3.top,
140
+ width = _React$useContext3.width,
141
+ height = _React$useContext3.height;
67
142
  var tickSize = disableTicks ? 4 : tickSizeProp;
143
+ var positionSign = position === 'bottom' ? 1 : -1;
144
+ var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : 'line';
145
+ var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : 'line';
146
+ var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsText;
147
+ var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsText;
148
+ var axisTickLabelProps = useSlotProps({
149
+ elementType: TickLabel,
150
+ externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
151
+ additionalProps: {
152
+ style: _extends({
153
+ textAnchor: 'middle',
154
+ dominantBaseline: position === 'bottom' ? 'hanging' : 'auto',
155
+ fontSize: tickFontSize != null ? tickFontSize : 12
156
+ }, tickLabelStyle),
157
+ className: classes.tickLabel
158
+ },
159
+ className: classes.tickLabel,
160
+ ownerState: {}
161
+ });
68
162
  var xTicks = useTicks({
69
163
  scale: xScale,
70
- ticksNumber: ticksNumber,
71
- valueFormatter: valueFormatter
164
+ tickNumber: tickNumber,
165
+ valueFormatter: valueFormatter,
166
+ tickInterval: tickInterval
167
+ });
168
+ var xTicksWithDimension = addLabelDimension(xTicks, {
169
+ tickLabelStyle: axisTickLabelProps.style,
170
+ tickLabelInterval: tickLabelInterval,
171
+ isMounted: isMounted
72
172
  });
73
- var positionSigne = position === 'bottom' ? 1 : -1;
74
173
  var labelRefPoint = {
75
174
  x: left + width / 2,
76
- y: positionSigne * (tickFontSize + tickSize + 10)
175
+ y: positionSign * (tickSize + 22)
77
176
  };
78
- var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
79
- var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
80
- var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
81
- var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
177
+ var axisLabelProps = useSlotProps({
178
+ elementType: Label,
179
+ externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
180
+ additionalProps: {
181
+ style: _extends({
182
+ fontSize: labelFontSize != null ? labelFontSize : 14,
183
+ textAnchor: 'middle',
184
+ dominantBaseline: position === 'bottom' ? 'hanging' : 'auto'
185
+ }, labelStyle)
186
+ },
187
+ ownerState: {}
188
+ });
82
189
  return /*#__PURE__*/_jsxs(AxisRoot, {
83
190
  transform: "translate(0, ".concat(position === 'bottom' ? top + height : top, ")"),
84
191
  className: classes.root,
@@ -86,39 +193,32 @@ function ChartsXAxis(inProps) {
86
193
  x1: xScale.range()[0],
87
194
  x2: xScale.range()[1],
88
195
  className: classes.line
89
- }, slotProps == null ? void 0 : slotProps.axisLine)), xTicks.map(function (_ref, index) {
90
- var formattedValue = _ref.formattedValue,
91
- offset = _ref.offset,
92
- labelOffset = _ref.labelOffset;
196
+ }, slotProps == null ? void 0 : slotProps.axisLine)), xTicksWithDimension.map(function (_ref2, index) {
197
+ var formattedValue = _ref2.formattedValue,
198
+ offset = _ref2.offset,
199
+ labelOffset = _ref2.labelOffset,
200
+ skipLabel = _ref2.skipLabel;
93
201
  var xTickLabel = labelOffset != null ? labelOffset : 0;
94
- var yTickLabel = positionSigne * (tickSize + 3);
202
+ var yTickLabel = positionSign * (tickSize + 3);
95
203
  return /*#__PURE__*/_jsxs("g", {
96
204
  transform: "translate(".concat(offset, ", 0)"),
97
205
  className: classes.tickContainer,
98
206
  children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
99
- y2: positionSigne * tickSize,
207
+ y2: positionSign * tickSize,
100
208
  className: classes.tick
101
- }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
209
+ }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
102
210
  x: xTickLabel,
103
- y: yTickLabel,
104
- "transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
105
- sx: {
106
- fontSize: tickFontSize
107
- },
108
- className: classes.tickLabel
109
- }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
110
- children: formattedValue
211
+ y: yTickLabel
212
+ }, axisTickLabelProps, {
213
+ text: formattedValue.toString()
111
214
  }))]
112
215
  }, index);
113
- }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
114
- sx: {
115
- fontSize: labelFontSize,
116
- transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
117
- },
118
- className: classes.label
119
- }, slotProps == null ? void 0 : slotProps.axisLabel, {
120
- children: label
121
- }))]
216
+ }), label && /*#__PURE__*/_jsx("g", {
217
+ className: classes.label,
218
+ children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
219
+ text: label
220
+ }))
221
+ })]
122
222
  });
123
223
  }
124
224
  process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
@@ -127,9 +227,10 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
127
227
  // | To update them edit the TypeScript types and run "yarn proptypes" |
128
228
  // ----------------------------------------------------------------------
129
229
  /**
130
- * Id of the axis to render.
230
+ * The id of the axis to render.
231
+ * If undefined, it will be the first defined axis.
131
232
  */
132
- axisId: PropTypes.string.isRequired,
233
+ axisId: PropTypes.string,
133
234
  /**
134
235
  * Override or extend the styles applied to the component.
135
236
  */
@@ -156,8 +257,13 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
156
257
  /**
157
258
  * The font size of the axis label.
158
259
  * @default 14
260
+ * @deprecated Consider using `labelStyle.fontSize` instead.
159
261
  */
160
262
  labelFontSize: PropTypes.number,
263
+ /**
264
+ * The style applied to the axis label.
265
+ */
266
+ labelStyle: PropTypes.object,
161
267
  /**
162
268
  * Position of the axis.
163
269
  */
@@ -180,8 +286,28 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
180
286
  /**
181
287
  * The font size of the axis ticks text.
182
288
  * @default 12
289
+ * @deprecated Consider using `tickLabelStyle.fontSize` instead.
183
290
  */
184
291
  tickFontSize: PropTypes.number,
292
+ /**
293
+ * Defines which ticks are displayed. Its value can be:
294
+ * - 'auto' In such case the ticks are computed based on axis scale and other parameters.
295
+ * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
296
+ * - an array containing the values where ticks should be displayed.
297
+ * @default 'auto'
298
+ */
299
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
300
+ /**
301
+ * Defines which ticks get its label displayed. Its value can be:
302
+ * - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
303
+ * - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
304
+ * @default 'auto'
305
+ */
306
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
307
+ /**
308
+ * The style applied to ticks text.
309
+ */
310
+ tickLabelStyle: PropTypes.object,
185
311
  /**
186
312
  * Maximal step between two ticks.
187
313
  * When using time data, the value is assumed to be in ms.
@@ -1,14 +1,16 @@
1
1
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
2
  import _extends from "@babel/runtime/helpers/esm/extends";
3
- var _excluded = ["scale", "ticksNumber"];
3
+ var _excluded = ["scale", "tickNumber"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
+ import { useSlotProps } from '@mui/base/utils';
6
7
  import { unstable_composeClasses as composeClasses } from '@mui/utils';
7
8
  import { useThemeProps, useTheme } from '@mui/material/styles';
8
9
  import { CartesianContext } from '../context/CartesianContextProvider';
9
10
  import { DrawingContext } from '../context/DrawingProvider';
10
11
  import useTicks from '../hooks/useTicks';
11
- import { ChartsLine, ChartsTick, ChartsTickLabel, ChartsLabel, AxisRoot } from '../internals/components/AxisSharedComponents';
12
+ import { AxisRoot } from '../internals/components/AxisSharedComponents';
13
+ import { ChartsText } from '../internals/components/ChartsText';
12
14
  import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
13
15
  import { jsx as _jsx } from "react/jsx-runtime";
14
16
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -33,17 +35,29 @@ var defaultProps = {
33
35
  labelFontSize: 14,
34
36
  tickSize: 6
35
37
  };
38
+
39
+ /**
40
+ * Demos:
41
+ *
42
+ * - [Axis](https://mui.com/x/react-charts/axis/)
43
+ *
44
+ * API:
45
+ *
46
+ * - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
47
+ */
36
48
  function ChartsYAxis(inProps) {
37
- var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
49
+ var _props$axisId, _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
38
50
  var props = useThemeProps({
39
51
  props: _extends({}, defaultProps, inProps),
40
52
  name: 'MuiChartsYAxis'
41
53
  });
42
54
  var _React$useContext = React.useContext(CartesianContext),
43
- _React$useContext$yAx = _React$useContext.yAxis[props.axisId],
44
- yScale = _React$useContext$yAx.scale,
45
- ticksNumber = _React$useContext$yAx.ticksNumber,
46
- settings = _objectWithoutProperties(_React$useContext$yAx, _excluded);
55
+ yAxisIds = _React$useContext.yAxisIds;
56
+ var _React$useContext2 = React.useContext(CartesianContext),
57
+ _React$useContext2$yA = _React$useContext2.yAxis[(_props$axisId = props.axisId) != null ? _props$axisId : yAxisIds[0]],
58
+ yScale = _React$useContext2$yA.scale,
59
+ tickNumber = _React$useContext2$yA.tickNumber,
60
+ settings = _objectWithoutProperties(_React$useContext2$yA, _excluded);
47
61
  var defaultizedProps = _extends({}, defaultProps, settings, props);
48
62
  var position = defaultizedProps.position,
49
63
  disableLine = defaultizedProps.disableLine,
@@ -59,26 +73,52 @@ function ChartsYAxis(inProps) {
59
73
  var classes = useUtilityClasses(_extends({}, defaultizedProps, {
60
74
  theme: theme
61
75
  }));
62
- var _React$useContext2 = React.useContext(DrawingContext),
63
- left = _React$useContext2.left,
64
- top = _React$useContext2.top,
65
- width = _React$useContext2.width,
66
- height = _React$useContext2.height;
76
+ var _React$useContext3 = React.useContext(DrawingContext),
77
+ left = _React$useContext3.left,
78
+ top = _React$useContext3.top,
79
+ width = _React$useContext3.width,
80
+ height = _React$useContext3.height;
67
81
  var tickSize = disableTicks ? 4 : tickSizeProp;
68
82
  var yTicks = useTicks({
69
83
  scale: yScale,
70
- ticksNumber: ticksNumber,
84
+ tickNumber: tickNumber,
71
85
  valueFormatter: valueFormatter
72
86
  });
73
- var positionSigne = position === 'right' ? 1 : -1;
87
+ var positionSign = position === 'right' ? 1 : -1;
74
88
  var labelRefPoint = {
75
- x: positionSigne * (tickFontSize + tickSize + 10),
89
+ x: positionSign * (tickFontSize + tickSize + 10),
76
90
  y: top + height / 2
77
91
  };
78
- var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
79
- var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
80
- var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
81
- var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
92
+ var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : 'line';
93
+ var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : 'line';
94
+ var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsText;
95
+ var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsText;
96
+ var axisTickLabelProps = useSlotProps({
97
+ elementType: TickLabel,
98
+ externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
99
+ additionalProps: {
100
+ style: {
101
+ fontSize: tickFontSize,
102
+ textAnchor: position === 'right' ? 'start' : 'end',
103
+ dominantBaseline: 'central'
104
+ },
105
+ className: classes.tickLabel
106
+ },
107
+ ownerState: {}
108
+ });
109
+ var axisLabelProps = useSlotProps({
110
+ elementType: Label,
111
+ externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
112
+ additionalProps: {
113
+ style: {
114
+ fontSize: labelFontSize,
115
+ angle: positionSign * 90,
116
+ textAnchor: 'middle',
117
+ dominantBaseline: 'auto'
118
+ }
119
+ },
120
+ ownerState: {}
121
+ });
82
122
  return /*#__PURE__*/_jsxs(AxisRoot, {
83
123
  transform: "translate(".concat(position === 'right' ? left + width : left, ", 0)"),
84
124
  className: classes.root,
@@ -90,36 +130,26 @@ function ChartsYAxis(inProps) {
90
130
  var formattedValue = _ref.formattedValue,
91
131
  offset = _ref.offset,
92
132
  labelOffset = _ref.labelOffset;
93
- var xTickLabel = positionSigne * (tickSize + 2);
133
+ var xTickLabel = positionSign * (tickSize + 2);
94
134
  var yTickLabel = labelOffset;
95
135
  return /*#__PURE__*/_jsxs("g", {
96
136
  transform: "translate(0, ".concat(offset, ")"),
97
137
  className: classes.tickContainer,
98
138
  children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
99
- x2: positionSigne * tickSize,
139
+ x2: positionSign * tickSize,
100
140
  className: classes.tick
101
141
  }, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
102
142
  x: xTickLabel,
103
143
  y: yTickLabel,
104
- "transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
105
- sx: {
106
- fontSize: tickFontSize
107
- },
108
- className: classes.tickLabel
109
- }, slotProps == null ? void 0 : slotProps.axisTickLabel, {
110
- children: formattedValue.toLocaleString()
111
- }))]
144
+ text: formattedValue.toString()
145
+ }, axisTickLabelProps))]
112
146
  }, index);
113
- }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
114
- sx: {
115
- fontSize: labelFontSize,
116
- transform: "rotate(".concat(positionSigne * 90, "deg)"),
117
- transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
118
- },
119
- className: classes.label
120
- }, slotProps == null ? void 0 : slotProps.axisLabel, {
121
- children: label
122
- }))]
147
+ }), label && /*#__PURE__*/_jsx("g", {
148
+ className: classes.label,
149
+ children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
150
+ text: label
151
+ }))
152
+ })]
123
153
  });
124
154
  }
125
155
  process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
@@ -128,9 +158,10 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
128
158
  // | To update them edit the TypeScript types and run "yarn proptypes" |
129
159
  // ----------------------------------------------------------------------
130
160
  /**
131
- * Id of the axis to render.
161
+ * The id of the axis to render.
162
+ * If undefined, it will be the first defined axis.
132
163
  */
133
- axisId: PropTypes.string.isRequired,
164
+ axisId: PropTypes.string,
134
165
  /**
135
166
  * Override or extend the styles applied to the component.
136
167
  */
@@ -157,8 +188,13 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
157
188
  /**
158
189
  * The font size of the axis label.
159
190
  * @default 14
191
+ * @deprecated Consider using `labelStyle.fontSize` instead.
160
192
  */
161
193
  labelFontSize: PropTypes.number,
194
+ /**
195
+ * The style applied to the axis label.
196
+ */
197
+ labelStyle: PropTypes.object,
162
198
  /**
163
199
  * Position of the axis.
164
200
  */
@@ -181,8 +217,28 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
181
217
  /**
182
218
  * The font size of the axis ticks text.
183
219
  * @default 12
220
+ * @deprecated Consider using `tickLabelStyle.fontSize` instead.
184
221
  */
185
222
  tickFontSize: PropTypes.number,
223
+ /**
224
+ * Defines which ticks are displayed. Its value can be:
225
+ * - 'auto' In such case the ticks are computed based on axis scale and other parameters.
226
+ * - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
227
+ * - an array containing the values where ticks should be displayed.
228
+ * @default 'auto'
229
+ */
230
+ tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
231
+ /**
232
+ * Defines which ticks get its label displayed. Its value can be:
233
+ * - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
234
+ * - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
235
+ * @default 'auto'
236
+ */
237
+ tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
238
+ /**
239
+ * The style applied to ticks text.
240
+ */
241
+ tickLabelStyle: PropTypes.object,
186
242
  /**
187
243
  * Maximal step between two ticks.
188
244
  * When using time data, the value is assumed to be in ms.
@@ -56,6 +56,16 @@ AreaElementPath.propTypes = {
56
56
  }).isRequired,
57
57
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
58
58
  };
59
+ /**
60
+ * Demos:
61
+ *
62
+ * - [Lines](https://mui.com/x/react-charts/lines/)
63
+ * - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
64
+ *
65
+ * API:
66
+ *
67
+ * - [AreaElement API](https://mui.com/x/api/charts/area-element/)
68
+ */
59
69
  function AreaElement(props) {
60
70
  var _slots$area;
61
71
  var id = props.id,