@mui/x-charts 6.0.0-alpha.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (423) hide show
  1. package/BarChart/BarChart.d.ts +19 -0
  2. package/BarChart/BarChart.js +262 -0
  3. package/BarChart/BarElement.d.ts +21 -0
  4. package/BarChart/BarElement.js +92 -0
  5. package/BarChart/BarPlot.d.ts +2 -0
  6. package/BarChart/BarPlot.js +76 -0
  7. package/BarChart/extremums.d.ts +3 -0
  8. package/BarChart/extremums.js +27 -0
  9. package/BarChart/formatter.d.ts +3 -0
  10. package/BarChart/formatter.js +54 -0
  11. package/BarChart/index.d.ts +2 -0
  12. package/BarChart/index.js +19 -0
  13. package/BarChart/package.json +6 -0
  14. package/CHANGELOG.md +3211 -0
  15. package/ChartContainer/index.d.ts +9 -0
  16. package/ChartContainer/index.js +61 -0
  17. package/ChartContainer/package.json +6 -0
  18. package/ChartsAxis/ChartsAxis.d.ts +33 -0
  19. package/ChartsAxis/ChartsAxis.js +152 -0
  20. package/ChartsAxis/axisClasses.d.ts +29 -0
  21. package/ChartsAxis/axisClasses.js +13 -0
  22. package/ChartsAxis/index.d.ts +2 -0
  23. package/ChartsAxis/index.js +27 -0
  24. package/ChartsAxis/package.json +6 -0
  25. package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +10 -0
  26. package/ChartsAxisHighlight/ChartsAxisHighlight.js +67 -0
  27. package/ChartsAxisHighlight/index.d.ts +1 -0
  28. package/ChartsAxisHighlight/index.js +16 -0
  29. package/ChartsAxisHighlight/package.json +6 -0
  30. package/ChartsClipPath/ChartsClipPath.d.ts +15 -0
  31. package/ChartsClipPath/ChartsClipPath.js +54 -0
  32. package/ChartsClipPath/index.d.ts +1 -0
  33. package/ChartsClipPath/index.js +16 -0
  34. package/ChartsClipPath/package.json +6 -0
  35. package/ChartsLegend/ChartsLegend.d.ts +44 -0
  36. package/ChartsLegend/ChartsLegend.js +202 -0
  37. package/ChartsLegend/chartsLegendClasses.d.ts +17 -0
  38. package/ChartsLegend/chartsLegendClasses.js +13 -0
  39. package/ChartsLegend/index.d.ts +2 -0
  40. package/ChartsLegend/index.js +27 -0
  41. package/ChartsLegend/package.json +6 -0
  42. package/ChartsLegend/utils.d.ts +14 -0
  43. package/ChartsLegend/utils.js +9 -0
  44. package/ChartsSurface.d.ts +21 -0
  45. package/ChartsSurface.js +58 -0
  46. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +40 -0
  47. package/ChartsTooltip/ChartsAxisTooltipContent.js +116 -0
  48. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +27 -0
  49. package/ChartsTooltip/ChartsItemTooltipContent.js +70 -0
  50. package/ChartsTooltip/ChartsTooltip.d.ts +32 -0
  51. package/ChartsTooltip/ChartsTooltip.js +104 -0
  52. package/ChartsTooltip/ChartsTooltipTable.d.ts +26 -0
  53. package/ChartsTooltip/ChartsTooltipTable.js +81 -0
  54. package/ChartsTooltip/index.d.ts +1 -0
  55. package/ChartsTooltip/index.js +16 -0
  56. package/ChartsTooltip/package.json +6 -0
  57. package/ChartsTooltip/tooltipClasses.d.ts +13 -0
  58. package/ChartsTooltip/tooltipClasses.js +13 -0
  59. package/ChartsTooltip/utils.d.ts +24 -0
  60. package/ChartsTooltip/utils.js +91 -0
  61. package/ChartsXAxis/ChartsXAxis.d.ts +7 -0
  62. package/ChartsXAxis/ChartsXAxis.js +191 -0
  63. package/ChartsXAxis/index.d.ts +1 -0
  64. package/ChartsXAxis/index.js +16 -0
  65. package/ChartsXAxis/package.json +6 -0
  66. package/ChartsYAxis/ChartsYAxis.d.ts +7 -0
  67. package/ChartsYAxis/ChartsYAxis.js +192 -0
  68. package/ChartsYAxis/index.d.ts +1 -0
  69. package/ChartsYAxis/index.js +16 -0
  70. package/ChartsYAxis/package.json +6 -0
  71. package/LICENSE +21 -0
  72. package/LineChart/AreaElement.d.ts +28 -0
  73. package/LineChart/AreaElement.js +115 -0
  74. package/LineChart/AreaPlot.d.ts +2 -0
  75. package/LineChart/AreaPlot.js +67 -0
  76. package/LineChart/LineChart.d.ts +19 -0
  77. package/LineChart/LineChart.js +266 -0
  78. package/LineChart/LineElement.d.ts +28 -0
  79. package/LineChart/LineElement.js +117 -0
  80. package/LineChart/LinePlot.d.ts +2 -0
  81. package/LineChart/LinePlot.js +67 -0
  82. package/LineChart/MarkElement.d.ts +38 -0
  83. package/LineChart/MarkElement.js +140 -0
  84. package/LineChart/MarkPlot.d.ts +2 -0
  85. package/LineChart/MarkPlot.js +86 -0
  86. package/LineChart/extremums.d.ts +3 -0
  87. package/LineChart/extremums.js +36 -0
  88. package/LineChart/formatter.d.ts +3 -0
  89. package/LineChart/formatter.js +55 -0
  90. package/LineChart/index.d.ts +7 -0
  91. package/LineChart/index.js +75 -0
  92. package/LineChart/package.json +6 -0
  93. package/README.md +5 -0
  94. package/ResponsiveChartContainer/index.d.ts +5 -0
  95. package/ResponsiveChartContainer/index.js +54 -0
  96. package/ResponsiveChartContainer/package.json +6 -0
  97. package/ScatterChart/Scatter.d.ts +15 -0
  98. package/ScatterChart/Scatter.js +114 -0
  99. package/ScatterChart/ScatterChart.d.ts +19 -0
  100. package/ScatterChart/ScatterChart.js +252 -0
  101. package/ScatterChart/ScatterPlot.d.ts +2 -0
  102. package/ScatterChart/ScatterPlot.js +52 -0
  103. package/ScatterChart/extremums.d.ts +3 -0
  104. package/ScatterChart/extremums.js +49 -0
  105. package/ScatterChart/formatter.d.ts +3 -0
  106. package/ScatterChart/formatter.js +19 -0
  107. package/ScatterChart/index.d.ts +3 -0
  108. package/ScatterChart/index.js +26 -0
  109. package/ScatterChart/package.json +6 -0
  110. package/colorPalettes/colorPalettes.d.ts +11 -0
  111. package/colorPalettes/colorPalettes.js +24 -0
  112. package/colorPalettes/index.d.ts +1 -0
  113. package/colorPalettes/index.js +16 -0
  114. package/colorPalettes/package.json +6 -0
  115. package/constants.d.ts +8 -0
  116. package/constants.js +17 -0
  117. package/context/CartesianContextProvider.d.ts +30 -0
  118. package/context/CartesianContextProvider.js +227 -0
  119. package/context/DrawingProvider.d.ts +22 -0
  120. package/context/DrawingProvider.js +64 -0
  121. package/context/HighlightProvider.d.ts +28 -0
  122. package/context/HighlightProvider.js +57 -0
  123. package/context/InteractionProvider.d.ts +34 -0
  124. package/context/InteractionProvider.js +62 -0
  125. package/context/SeriesContextProvider.d.ts +17 -0
  126. package/context/SeriesContextProvider.js +69 -0
  127. package/context/index.d.ts +3 -0
  128. package/context/index.js +19 -0
  129. package/context/package.json +6 -0
  130. package/esm/BarChart/BarChart.js +255 -0
  131. package/esm/BarChart/BarElement.js +80 -0
  132. package/esm/BarChart/BarPlot.js +70 -0
  133. package/esm/BarChart/extremums.js +20 -0
  134. package/esm/BarChart/formatter.js +46 -0
  135. package/esm/BarChart/index.js +2 -0
  136. package/esm/ChartContainer/index.js +53 -0
  137. package/esm/ChartsAxis/ChartsAxis.js +145 -0
  138. package/esm/ChartsAxis/axisClasses.js +5 -0
  139. package/esm/ChartsAxis/index.js +2 -0
  140. package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -0
  141. package/esm/ChartsAxisHighlight/index.js +1 -0
  142. package/esm/ChartsClipPath/ChartsClipPath.js +46 -0
  143. package/esm/ChartsClipPath/index.js +1 -0
  144. package/esm/ChartsLegend/ChartsLegend.js +189 -0
  145. package/esm/ChartsLegend/chartsLegendClasses.js +5 -0
  146. package/esm/ChartsLegend/index.js +2 -0
  147. package/esm/ChartsLegend/utils.js +3 -0
  148. package/esm/ChartsSurface.js +49 -0
  149. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +108 -0
  150. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +63 -0
  151. package/esm/ChartsTooltip/ChartsTooltip.js +96 -0
  152. package/esm/ChartsTooltip/ChartsTooltipTable.js +69 -0
  153. package/esm/ChartsTooltip/index.js +1 -0
  154. package/esm/ChartsTooltip/tooltipClasses.js +5 -0
  155. package/esm/ChartsTooltip/utils.js +81 -0
  156. package/esm/ChartsXAxis/ChartsXAxis.js +184 -0
  157. package/esm/ChartsXAxis/index.js +1 -0
  158. package/esm/ChartsYAxis/ChartsYAxis.js +185 -0
  159. package/esm/ChartsYAxis/index.js +1 -0
  160. package/esm/LineChart/AreaElement.js +104 -0
  161. package/esm/LineChart/AreaPlot.js +58 -0
  162. package/esm/LineChart/LineChart.js +259 -0
  163. package/esm/LineChart/LineElement.js +106 -0
  164. package/esm/LineChart/LinePlot.js +58 -0
  165. package/esm/LineChart/MarkElement.js +130 -0
  166. package/esm/LineChart/MarkPlot.js +78 -0
  167. package/esm/LineChart/extremums.js +29 -0
  168. package/esm/LineChart/formatter.js +48 -0
  169. package/esm/LineChart/index.js +7 -0
  170. package/esm/ResponsiveChartContainer/index.js +46 -0
  171. package/esm/ScatterChart/Scatter.js +106 -0
  172. package/esm/ScatterChart/ScatterChart.js +245 -0
  173. package/esm/ScatterChart/ScatterPlot.js +44 -0
  174. package/esm/ScatterChart/extremums.js +41 -0
  175. package/esm/ScatterChart/formatter.js +11 -0
  176. package/esm/ScatterChart/index.js +3 -0
  177. package/esm/colorPalettes/colorPalettes.js +9 -0
  178. package/esm/colorPalettes/index.js +1 -0
  179. package/esm/constants.js +8 -0
  180. package/esm/context/CartesianContextProvider.js +221 -0
  181. package/esm/context/DrawingProvider.js +52 -0
  182. package/esm/context/HighlightProvider.js +46 -0
  183. package/esm/context/InteractionProvider.js +51 -0
  184. package/esm/context/SeriesContextProvider.js +60 -0
  185. package/esm/context/index.js +2 -0
  186. package/esm/hooks/useAxisEvents.js +145 -0
  187. package/esm/hooks/useChartDimensions.js +14 -0
  188. package/esm/hooks/useInteractionItemProps.js +68 -0
  189. package/esm/hooks/useScale.js +33 -0
  190. package/esm/hooks/useTicks.js +46 -0
  191. package/esm/index.js +15 -0
  192. package/esm/internals/components/AxisSharedComponents.js +81 -0
  193. package/esm/internals/defaultizeColor.js +7 -0
  194. package/esm/internals/defaultizeValueFormatter.js +11 -0
  195. package/esm/internals/getCurve.js +39 -0
  196. package/esm/internals/stackSeries.js +93 -0
  197. package/esm/internals/utils.js +5 -0
  198. package/esm/models/axis.js +1 -0
  199. package/esm/models/helpers.js +1 -0
  200. package/esm/models/index.js +1 -0
  201. package/esm/models/layout.js +1 -0
  202. package/esm/models/seriesType/bar.js +1 -0
  203. package/esm/models/seriesType/common.js +1 -0
  204. package/esm/models/seriesType/config.js +1 -0
  205. package/esm/models/seriesType/index.js +12 -0
  206. package/esm/models/seriesType/line.js +1 -0
  207. package/esm/models/seriesType/pie.js +1 -0
  208. package/esm/models/seriesType/scatter.js +1 -0
  209. package/esm/themeAugmentation/index.js +3 -0
  210. package/hooks/useAxisEvents.d.ts +1 -0
  211. package/hooks/useAxisEvents.js +154 -0
  212. package/hooks/useChartDimensions.d.ts +8 -0
  213. package/hooks/useChartDimensions.js +24 -0
  214. package/hooks/useInteractionItemProps.d.ts +8 -0
  215. package/hooks/useInteractionItemProps.js +79 -0
  216. package/hooks/useScale.d.ts +13 -0
  217. package/hooks/useScale.js +41 -0
  218. package/hooks/useTicks.d.ts +23 -0
  219. package/hooks/useTicks.js +50 -0
  220. package/index.d.ts +15 -0
  221. package/index.js +177 -0
  222. package/internals/components/AxisSharedComponents.d.ts +6 -0
  223. package/internals/components/AxisSharedComponents.js +93 -0
  224. package/internals/defaultizeColor.d.ts +41 -0
  225. package/internals/defaultizeColor.js +14 -0
  226. package/internals/defaultizeValueFormatter.d.ts +8 -0
  227. package/internals/defaultizeValueFormatter.js +19 -0
  228. package/internals/getCurve.d.ts +2 -0
  229. package/internals/getCurve.js +45 -0
  230. package/internals/stackSeries.d.ts +29 -0
  231. package/internals/stackSeries.js +102 -0
  232. package/internals/utils.d.ts +2 -0
  233. package/internals/utils.js +11 -0
  234. package/legacy/BarChart/BarChart.js +260 -0
  235. package/legacy/BarChart/BarElement.js +78 -0
  236. package/legacy/BarChart/BarPlot.js +65 -0
  237. package/legacy/BarChart/extremums.js +25 -0
  238. package/legacy/BarChart/formatter.js +49 -0
  239. package/legacy/BarChart/index.js +2 -0
  240. package/legacy/ChartContainer/index.js +51 -0
  241. package/legacy/ChartsAxis/ChartsAxis.js +143 -0
  242. package/legacy/ChartsAxis/axisClasses.js +5 -0
  243. package/legacy/ChartsAxis/index.js +2 -0
  244. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +56 -0
  245. package/legacy/ChartsAxisHighlight/index.js +1 -0
  246. package/legacy/ChartsClipPath/ChartsClipPath.js +43 -0
  247. package/legacy/ChartsClipPath/index.js +1 -0
  248. package/legacy/ChartsLegend/ChartsLegend.js +186 -0
  249. package/legacy/ChartsLegend/chartsLegendClasses.js +5 -0
  250. package/legacy/ChartsLegend/index.js +2 -0
  251. package/legacy/ChartsLegend/utils.js +9 -0
  252. package/legacy/ChartsSurface.js +52 -0
  253. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +106 -0
  254. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +59 -0
  255. package/legacy/ChartsTooltip/ChartsTooltip.js +92 -0
  256. package/legacy/ChartsTooltip/ChartsTooltipTable.js +73 -0
  257. package/legacy/ChartsTooltip/index.js +1 -0
  258. package/legacy/ChartsTooltip/tooltipClasses.js +5 -0
  259. package/legacy/ChartsTooltip/utils.js +91 -0
  260. package/legacy/ChartsXAxis/ChartsXAxis.js +172 -0
  261. package/legacy/ChartsXAxis/index.js +1 -0
  262. package/legacy/ChartsYAxis/ChartsYAxis.js +173 -0
  263. package/legacy/ChartsYAxis/index.js +1 -0
  264. package/legacy/LineChart/AreaElement.js +102 -0
  265. package/legacy/LineChart/AreaPlot.js +62 -0
  266. package/legacy/LineChart/LineChart.js +265 -0
  267. package/legacy/LineChart/LineElement.js +104 -0
  268. package/legacy/LineChart/LinePlot.js +60 -0
  269. package/legacy/LineChart/MarkElement.js +128 -0
  270. package/legacy/LineChart/MarkPlot.js +75 -0
  271. package/legacy/LineChart/extremums.js +39 -0
  272. package/legacy/LineChart/formatter.js +51 -0
  273. package/legacy/LineChart/index.js +7 -0
  274. package/legacy/ResponsiveChartContainer/index.js +59 -0
  275. package/legacy/ScatterChart/Scatter.js +103 -0
  276. package/legacy/ScatterChart/ScatterChart.js +245 -0
  277. package/legacy/ScatterChart/ScatterPlot.js +39 -0
  278. package/legacy/ScatterChart/extremums.js +39 -0
  279. package/legacy/ScatterChart/formatter.js +12 -0
  280. package/legacy/ScatterChart/index.js +3 -0
  281. package/legacy/colorPalettes/colorPalettes.js +15 -0
  282. package/legacy/colorPalettes/index.js +1 -0
  283. package/legacy/constants.js +8 -0
  284. package/legacy/context/CartesianContextProvider.js +241 -0
  285. package/legacy/context/DrawingProvider.js +51 -0
  286. package/legacy/context/HighlightProvider.js +55 -0
  287. package/legacy/context/InteractionProvider.js +60 -0
  288. package/legacy/context/SeriesContextProvider.js +61 -0
  289. package/legacy/context/index.js +2 -0
  290. package/legacy/hooks/useAxisEvents.js +140 -0
  291. package/legacy/hooks/useChartDimensions.js +16 -0
  292. package/legacy/hooks/useInteractionItemProps.js +66 -0
  293. package/legacy/hooks/useScale.js +37 -0
  294. package/legacy/hooks/useTicks.js +46 -0
  295. package/legacy/index.js +22 -0
  296. package/legacy/internals/components/AxisSharedComponents.js +80 -0
  297. package/legacy/internals/defaultizeColor.js +8 -0
  298. package/legacy/internals/defaultizeValueFormatter.js +11 -0
  299. package/legacy/internals/getCurve.js +39 -0
  300. package/legacy/internals/stackSeries.js +90 -0
  301. package/legacy/internals/utils.js +5 -0
  302. package/legacy/models/axis.js +1 -0
  303. package/legacy/models/helpers.js +1 -0
  304. package/legacy/models/index.js +1 -0
  305. package/legacy/models/layout.js +1 -0
  306. package/legacy/models/seriesType/bar.js +1 -0
  307. package/legacy/models/seriesType/common.js +1 -0
  308. package/legacy/models/seriesType/config.js +1 -0
  309. package/legacy/models/seriesType/index.js +12 -0
  310. package/legacy/models/seriesType/line.js +1 -0
  311. package/legacy/models/seriesType/pie.js +1 -0
  312. package/legacy/models/seriesType/scatter.js +1 -0
  313. package/legacy/themeAugmentation/index.js +3 -0
  314. package/models/axis.d.ts +118 -0
  315. package/models/axis.js +5 -0
  316. package/models/helpers.d.ts +2 -0
  317. package/models/helpers.js +5 -0
  318. package/models/index.d.ts +1 -0
  319. package/models/index.js +16 -0
  320. package/models/layout.d.ts +10 -0
  321. package/models/layout.js +5 -0
  322. package/models/package.json +6 -0
  323. package/models/seriesType/bar.d.ts +18 -0
  324. package/models/seriesType/bar.js +5 -0
  325. package/models/seriesType/common.d.ts +26 -0
  326. package/models/seriesType/common.js +5 -0
  327. package/models/seriesType/config.d.ts +66 -0
  328. package/models/seriesType/config.js +5 -0
  329. package/models/seriesType/index.d.ts +13 -0
  330. package/models/seriesType/index.js +38 -0
  331. package/models/seriesType/line.d.ts +25 -0
  332. package/models/seriesType/line.js +5 -0
  333. package/models/seriesType/pie.d.ts +5 -0
  334. package/models/seriesType/pie.js +5 -0
  335. package/models/seriesType/scatter.d.ts +24 -0
  336. package/models/seriesType/scatter.js +5 -0
  337. package/modern/BarChart/BarChart.js +255 -0
  338. package/modern/BarChart/BarElement.js +80 -0
  339. package/modern/BarChart/BarPlot.js +68 -0
  340. package/modern/BarChart/extremums.js +19 -0
  341. package/modern/BarChart/formatter.js +46 -0
  342. package/modern/BarChart/index.js +2 -0
  343. package/modern/ChartContainer/index.js +53 -0
  344. package/modern/ChartsAxis/ChartsAxis.js +145 -0
  345. package/modern/ChartsAxis/axisClasses.js +5 -0
  346. package/modern/ChartsAxis/index.js +2 -0
  347. package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -0
  348. package/modern/ChartsAxisHighlight/index.js +1 -0
  349. package/modern/ChartsClipPath/ChartsClipPath.js +46 -0
  350. package/modern/ChartsClipPath/index.js +1 -0
  351. package/modern/ChartsLegend/ChartsLegend.js +189 -0
  352. package/modern/ChartsLegend/chartsLegendClasses.js +5 -0
  353. package/modern/ChartsLegend/index.js +2 -0
  354. package/modern/ChartsLegend/utils.js +3 -0
  355. package/modern/ChartsSurface.js +49 -0
  356. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +107 -0
  357. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +62 -0
  358. package/modern/ChartsTooltip/ChartsTooltip.js +96 -0
  359. package/modern/ChartsTooltip/ChartsTooltipTable.js +69 -0
  360. package/modern/ChartsTooltip/index.js +1 -0
  361. package/modern/ChartsTooltip/tooltipClasses.js +5 -0
  362. package/modern/ChartsTooltip/utils.js +81 -0
  363. package/modern/ChartsXAxis/ChartsXAxis.js +184 -0
  364. package/modern/ChartsXAxis/index.js +1 -0
  365. package/modern/ChartsYAxis/ChartsYAxis.js +185 -0
  366. package/modern/ChartsYAxis/index.js +1 -0
  367. package/modern/LineChart/AreaElement.js +104 -0
  368. package/modern/LineChart/AreaPlot.js +58 -0
  369. package/modern/LineChart/LineChart.js +259 -0
  370. package/modern/LineChart/LineElement.js +106 -0
  371. package/modern/LineChart/LinePlot.js +58 -0
  372. package/modern/LineChart/MarkElement.js +129 -0
  373. package/modern/LineChart/MarkPlot.js +78 -0
  374. package/modern/LineChart/extremums.js +28 -0
  375. package/modern/LineChart/formatter.js +48 -0
  376. package/modern/LineChart/index.js +7 -0
  377. package/modern/ResponsiveChartContainer/index.js +45 -0
  378. package/modern/ScatterChart/Scatter.js +106 -0
  379. package/modern/ScatterChart/ScatterChart.js +245 -0
  380. package/modern/ScatterChart/ScatterPlot.js +44 -0
  381. package/modern/ScatterChart/extremums.js +41 -0
  382. package/modern/ScatterChart/formatter.js +11 -0
  383. package/modern/ScatterChart/index.js +3 -0
  384. package/modern/colorPalettes/colorPalettes.js +9 -0
  385. package/modern/colorPalettes/index.js +1 -0
  386. package/modern/constants.js +8 -0
  387. package/modern/context/CartesianContextProvider.js +217 -0
  388. package/modern/context/DrawingProvider.js +52 -0
  389. package/modern/context/HighlightProvider.js +46 -0
  390. package/modern/context/InteractionProvider.js +51 -0
  391. package/modern/context/SeriesContextProvider.js +58 -0
  392. package/modern/context/index.js +2 -0
  393. package/modern/hooks/useAxisEvents.js +145 -0
  394. package/modern/hooks/useChartDimensions.js +14 -0
  395. package/modern/hooks/useInteractionItemProps.js +68 -0
  396. package/modern/hooks/useScale.js +33 -0
  397. package/modern/hooks/useTicks.js +40 -0
  398. package/modern/index.js +22 -0
  399. package/modern/internals/components/AxisSharedComponents.js +81 -0
  400. package/modern/internals/defaultizeColor.js +7 -0
  401. package/modern/internals/defaultizeValueFormatter.js +11 -0
  402. package/modern/internals/getCurve.js +39 -0
  403. package/modern/internals/stackSeries.js +93 -0
  404. package/modern/internals/utils.js +5 -0
  405. package/modern/models/axis.js +1 -0
  406. package/modern/models/helpers.js +1 -0
  407. package/modern/models/index.js +1 -0
  408. package/modern/models/layout.js +1 -0
  409. package/modern/models/seriesType/bar.js +1 -0
  410. package/modern/models/seriesType/common.js +1 -0
  411. package/modern/models/seriesType/config.js +1 -0
  412. package/modern/models/seriesType/index.js +12 -0
  413. package/modern/models/seriesType/line.js +1 -0
  414. package/modern/models/seriesType/pie.js +1 -0
  415. package/modern/models/seriesType/scatter.js +1 -0
  416. package/modern/themeAugmentation/index.js +3 -0
  417. package/package.json +57 -0
  418. package/themeAugmentation/components.d.ts +72 -0
  419. package/themeAugmentation/index.d.ts +3 -0
  420. package/themeAugmentation/index.js +38 -0
  421. package/themeAugmentation/overrides.d.ts +29 -0
  422. package/themeAugmentation/package.json +6 -0
  423. package/themeAugmentation/props.d.ts +43 -0
@@ -0,0 +1,59 @@
1
+ import * as React from 'react';
2
+ import { SeriesContext } from '../context/SeriesContextProvider';
3
+ import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ import { jsxs as _jsxs } from "react/jsx-runtime";
6
+ export function DefaultChartsItemContent(props) {
7
+ var _series$label;
8
+ var series = props.series,
9
+ itemData = props.itemData,
10
+ sx = props.sx,
11
+ classes = props.classes;
12
+ if (itemData.dataIndex === undefined) {
13
+ return null;
14
+ }
15
+ var displayedLabel = (_series$label = series.label) != null ? _series$label : null;
16
+ var color = series.color;
17
+ // TODO: Manage to let TS understand series.data and series.valueFormatter are coherent
18
+ // @ts-ignore
19
+ var formattedValue = series.valueFormatter(series.data[itemData.dataIndex]);
20
+ return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
21
+ sx: sx,
22
+ variant: "outlined",
23
+ className: classes.root,
24
+ children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
25
+ children: /*#__PURE__*/_jsx("tbody", {
26
+ children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
27
+ children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
28
+ className: classes.markCell,
29
+ children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
30
+ ownerState: {
31
+ color: color
32
+ }
33
+ })
34
+ }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
35
+ className: classes.labelCell,
36
+ children: displayedLabel
37
+ }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
38
+ className: classes.valueCell,
39
+ children: formattedValue
40
+ })]
41
+ })
42
+ })
43
+ })
44
+ });
45
+ }
46
+ export function ChartsItemTooltipContent(props) {
47
+ var content = props.content,
48
+ itemData = props.itemData,
49
+ sx = props.sx,
50
+ classes = props.classes;
51
+ var series = React.useContext(SeriesContext)[itemData.type].series[itemData.seriesId];
52
+ var Content = content != null ? content : DefaultChartsItemContent;
53
+ return /*#__PURE__*/_jsx(Content, {
54
+ itemData: itemData,
55
+ series: series,
56
+ sx: sx,
57
+ classes: classes
58
+ });
59
+ }
@@ -0,0 +1,92 @@
1
+ import * as React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { unstable_composeClasses as composeClasses } from '@mui/utils';
4
+ import Popper from '@mui/material/Popper';
5
+ import NoSsr from '@mui/material/NoSsr';
6
+ import { InteractionContext } from '../context/InteractionProvider';
7
+ import { generateVirtualElement, useMouseTracker, getTootipHasData } from './utils';
8
+ import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
9
+ import { ChartsAxisTooltipContent } from './ChartsAxisTooltipContent';
10
+ import { getTooltipUtilityClass } from './tooltipClasses';
11
+ import { jsx as _jsx } from "react/jsx-runtime";
12
+ var useUtilityClasses = function useUtilityClasses(ownerState) {
13
+ var classes = ownerState.classes;
14
+ var slots = {
15
+ root: ['root'],
16
+ markCell: ['markCell'],
17
+ labelCell: ['labelCell'],
18
+ valueCell: ['valueCell']
19
+ };
20
+ return composeClasses(slots, getTooltipUtilityClass, classes);
21
+ };
22
+ function ChartsTooltip(props) {
23
+ var _props$trigger = props.trigger,
24
+ trigger = _props$trigger === void 0 ? 'axis' : _props$trigger,
25
+ itemContent = props.itemContent,
26
+ axisContent = props.axisContent;
27
+ var mousePosition = useMouseTracker();
28
+ var _React$useContext = React.useContext(InteractionContext),
29
+ item = _React$useContext.item,
30
+ axis = _React$useContext.axis;
31
+ var displayedData = trigger === 'item' ? item : axis;
32
+ var tooltipHasData = getTootipHasData(trigger, displayedData);
33
+ var popperOpen = mousePosition !== null && tooltipHasData;
34
+ var classes = useUtilityClasses({
35
+ classes: props.classes
36
+ });
37
+ if (trigger === 'none') {
38
+ return null;
39
+ }
40
+ return /*#__PURE__*/_jsx(NoSsr, {
41
+ children: popperOpen && /*#__PURE__*/_jsx(Popper, {
42
+ open: popperOpen,
43
+ placement: "right-start",
44
+ anchorEl: generateVirtualElement(mousePosition),
45
+ style: {
46
+ pointerEvents: 'none'
47
+ },
48
+ children: trigger === 'item' ? /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
49
+ itemData: displayedData,
50
+ content: itemContent,
51
+ sx: {
52
+ mx: 2
53
+ },
54
+ classes: classes
55
+ }) : /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
56
+ axisData: displayedData,
57
+ content: axisContent,
58
+ sx: {
59
+ mx: 2
60
+ },
61
+ classes: classes
62
+ })
63
+ })
64
+ });
65
+ }
66
+ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
67
+ // ----------------------------- Warning --------------------------------
68
+ // | These PropTypes are generated from the TypeScript type definitions |
69
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
70
+ // ----------------------------------------------------------------------
71
+ /**
72
+ * Component to override the tooltip content when triger is set to 'axis'.
73
+ */
74
+ axisContent: PropTypes.elementType,
75
+ /**
76
+ * Override or extend the styles applied to the component.
77
+ */
78
+ classes: PropTypes.object,
79
+ /**
80
+ * Component to override the tooltip content when triger is set to 'item'.
81
+ */
82
+ itemContent: PropTypes.elementType,
83
+ /**
84
+ * Select the kind of tooltip to display
85
+ * - 'item': Shows data about the item below the mouse.
86
+ * - 'axis': Shows values associated with the hovered x value
87
+ * - 'none': Does not display tooltip
88
+ * @default 'item'
89
+ */
90
+ trigger: PropTypes.oneOf(['axis', 'item', 'none'])
91
+ } : void 0;
92
+ export { ChartsTooltip };
@@ -0,0 +1,73 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import Box from '@mui/material/Box';
3
+ import Paper from '@mui/material/Paper';
4
+ import { styled } from '@mui/material/styles';
5
+ import { tooltipClasses } from './tooltipClasses';
6
+ export var ChartsTooltipPaper = styled(Paper, {
7
+ name: 'MuiChartsTooltip',
8
+ slot: 'Table'
9
+ })({});
10
+ export var ChartsTooltipTable = styled('table', {
11
+ name: 'MuiChartsTooltip',
12
+ slot: 'Table'
13
+ })(function (_ref) {
14
+ var theme = _ref.theme;
15
+ return {
16
+ borderSpacing: 0,
17
+ '& thead td': {
18
+ borderBottom: "solid ".concat(theme.palette.divider, " 1px")
19
+ }
20
+ };
21
+ });
22
+ export var ChartsTooltipRow = styled('tr', {
23
+ name: 'MuiChartsTooltip',
24
+ slot: 'Row'
25
+ })(function (_ref2) {
26
+ var theme = _ref2.theme;
27
+ return {
28
+ '&:first-child td': {
29
+ paddingTop: theme.spacing(1)
30
+ },
31
+ '&:last-child td': {
32
+ paddingBottom: theme.spacing(1)
33
+ }
34
+ };
35
+ });
36
+ export var ChartsTooltipCell = styled('td', {
37
+ name: 'MuiChartsTooltip',
38
+ slot: 'Cell'
39
+ })(function (_ref3) {
40
+ var _ref4;
41
+ var theme = _ref3.theme;
42
+ return _ref4 = {
43
+ verticalAlign: 'middle',
44
+ color: theme.palette.text.secondary,
45
+ '&:first-child': {
46
+ paddingLeft: theme.spacing(2)
47
+ },
48
+ '&:last-child': {
49
+ paddingRight: theme.spacing(2)
50
+ }
51
+ }, _defineProperty(_ref4, "&.".concat(tooltipClasses.labelCell), {
52
+ paddingLeft: theme.spacing(1)
53
+ }), _defineProperty(_ref4, "&.".concat(tooltipClasses.valueCell), {
54
+ paddingLeft: theme.spacing(4),
55
+ color: theme.palette.text.primary
56
+ }), _ref4;
57
+ });
58
+ export var ChartsTooltipMark = styled(Box, {
59
+ name: 'MuiChartsTooltip',
60
+ slot: 'Mark'
61
+ })(function (_ref5) {
62
+ var theme = _ref5.theme,
63
+ ownerState = _ref5.ownerState;
64
+ return {
65
+ width: theme.spacing(1),
66
+ height: theme.spacing(1),
67
+ borderRadius: '50%',
68
+ backgroundColor: ownerState.color,
69
+ borderColor: theme.palette.background.paper,
70
+ border: "solid ".concat(theme.palette.background.paper, " ").concat(theme.spacing(0.25)),
71
+ boxSizing: 'content-box'
72
+ };
73
+ });
@@ -0,0 +1 @@
1
+ export * from './ChartsTooltip';
@@ -0,0 +1,5 @@
1
+ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
+ export function getTooltipUtilityClass(slot) {
3
+ return generateUtilityClass('MuiChartsTooltip', slot);
4
+ }
5
+ export var tooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
@@ -0,0 +1,91 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import * as React from 'react';
3
+ import { SVGContext } from '../context/DrawingProvider';
4
+ export function generateVirtualElement(mousePosition) {
5
+ if (mousePosition === null) {
6
+ return {
7
+ getBoundingClientRect: function getBoundingClientRect() {
8
+ return {
9
+ width: 0,
10
+ height: 0,
11
+ x: 0,
12
+ y: 0,
13
+ top: 0,
14
+ right: 0,
15
+ bottom: 0,
16
+ left: 0,
17
+ toJSON: function toJSON() {
18
+ return '';
19
+ }
20
+ };
21
+ }
22
+ };
23
+ }
24
+ var x = mousePosition.x,
25
+ y = mousePosition.y;
26
+ return {
27
+ getBoundingClientRect: function getBoundingClientRect() {
28
+ return {
29
+ width: 0,
30
+ height: 0,
31
+ x: x,
32
+ y: y,
33
+ top: y,
34
+ right: x,
35
+ bottom: y,
36
+ left: x,
37
+ toJSON: function toJSON() {
38
+ return JSON.stringify({
39
+ width: 0,
40
+ height: 0,
41
+ x: x,
42
+ y: y,
43
+ top: y,
44
+ right: x,
45
+ bottom: y,
46
+ left: x
47
+ });
48
+ }
49
+ };
50
+ }
51
+ };
52
+ }
53
+ export function useMouseTracker() {
54
+ var svgRef = React.useContext(SVGContext);
55
+
56
+ // Use a ref to avoid rerendering on every mousemove event.
57
+ var _React$useState = React.useState(null),
58
+ _React$useState2 = _slicedToArray(_React$useState, 2),
59
+ mousePosition = _React$useState2[0],
60
+ setMousePosition = _React$useState2[1];
61
+ React.useEffect(function () {
62
+ var element = svgRef.current;
63
+ if (element === null) {
64
+ return function () {};
65
+ }
66
+ var handleMouseOut = function handleMouseOut() {
67
+ setMousePosition(null);
68
+ };
69
+ var handleMouseMove = function handleMouseMove(event) {
70
+ setMousePosition({
71
+ x: event.clientX,
72
+ y: event.clientY
73
+ });
74
+ };
75
+ element.addEventListener('mouseout', handleMouseOut);
76
+ element.addEventListener('mousemove', handleMouseMove);
77
+ return function () {
78
+ element.removeEventListener('mouseout', handleMouseOut);
79
+ element.removeEventListener('mousemove', handleMouseMove);
80
+ };
81
+ }, [svgRef]);
82
+ return mousePosition;
83
+ }
84
+ export function getTootipHasData(trigger, displayedData) {
85
+ if (trigger === 'item') {
86
+ return displayedData !== null;
87
+ }
88
+ var hasAxisXData = displayedData.x !== null;
89
+ var hasAxisYData = displayedData.y !== null;
90
+ return hasAxisXData || hasAxisYData;
91
+ }
@@ -0,0 +1,172 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ var _excluded = ["scale", "ticksNumber"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { unstable_composeClasses as composeClasses } from '@mui/utils';
7
+ import { useThemeProps, useTheme } from '@mui/material/styles';
8
+ import { CartesianContext } from '../context/CartesianContextProvider';
9
+ import { DrawingContext } from '../context/DrawingProvider';
10
+ import useTicks from '../hooks/useTicks';
11
+ import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
12
+ import { Line, Tick, TickLabel, Label, AxisRoot } from '../internals/components/AxisSharedComponents';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ var useUtilityClasses = function useUtilityClasses(ownerState) {
16
+ var classes = ownerState.classes,
17
+ position = ownerState.position;
18
+ var slots = {
19
+ root: ['root', 'directionX', position],
20
+ line: ['line'],
21
+ tickContainer: ['tickContainer'],
22
+ tick: ['tick'],
23
+ tickLabel: ['tickLabel'],
24
+ label: ['label']
25
+ };
26
+ return composeClasses(slots, getAxisUtilityClass, classes);
27
+ };
28
+ var defaultProps = {
29
+ position: 'bottom',
30
+ disableLine: false,
31
+ disableTicks: false,
32
+ tickFontSize: 12,
33
+ labelFontSize: 14,
34
+ tickSize: 6
35
+ };
36
+ function ChartsXAxis(inProps) {
37
+ var props = useThemeProps({
38
+ props: _extends({}, defaultProps, inProps),
39
+ name: 'MuiChartsXAxis'
40
+ });
41
+ var _React$useContext = React.useContext(CartesianContext),
42
+ _React$useContext$xAx = _React$useContext.xAxis[props.axisId],
43
+ xScale = _React$useContext$xAx.scale,
44
+ ticksNumber = _React$useContext$xAx.ticksNumber,
45
+ settings = _objectWithoutProperties(_React$useContext$xAx, _excluded);
46
+ var defaultizedProps = _extends({}, defaultProps, settings, props);
47
+ var position = defaultizedProps.position,
48
+ disableLine = defaultizedProps.disableLine,
49
+ disableTicks = defaultizedProps.disableTicks,
50
+ tickFontSize = defaultizedProps.tickFontSize,
51
+ label = defaultizedProps.label,
52
+ labelFontSize = defaultizedProps.labelFontSize,
53
+ tickSizeProp = defaultizedProps.tickSize,
54
+ valueFormatter = defaultizedProps.valueFormatter;
55
+ var theme = useTheme();
56
+ var classes = useUtilityClasses(_extends({}, defaultizedProps, {
57
+ theme: theme
58
+ }));
59
+ var _React$useContext2 = React.useContext(DrawingContext),
60
+ left = _React$useContext2.left,
61
+ top = _React$useContext2.top,
62
+ width = _React$useContext2.width,
63
+ height = _React$useContext2.height;
64
+ var tickSize = disableTicks ? 4 : tickSizeProp;
65
+ var xTicks = useTicks({
66
+ scale: xScale,
67
+ ticksNumber: ticksNumber,
68
+ valueFormatter: valueFormatter
69
+ });
70
+ var positionSigne = position === 'bottom' ? 1 : -1;
71
+ var labelRefPoint = {
72
+ x: left + width / 2,
73
+ y: positionSigne * (tickFontSize + tickSize + 10)
74
+ };
75
+ return /*#__PURE__*/_jsxs(AxisRoot, {
76
+ transform: "translate(0, ".concat(position === 'bottom' ? top + height : top, ")"),
77
+ className: classes.root,
78
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, {
79
+ x1: xScale.range()[0],
80
+ x2: xScale.range()[1],
81
+ className: classes.line
82
+ }), xTicks.map(function (_ref, index) {
83
+ var formattedValue = _ref.formattedValue,
84
+ offset = _ref.offset,
85
+ labelOffset = _ref.labelOffset;
86
+ var xTickLabel = labelOffset != null ? labelOffset : 0;
87
+ var yTickLabel = positionSigne * (tickSize + 3);
88
+ return /*#__PURE__*/_jsxs("g", {
89
+ transform: "translate(".concat(offset, ", 0)"),
90
+ className: classes.tickContainer,
91
+ children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
92
+ y2: positionSigne * tickSize,
93
+ className: classes.tick
94
+ }), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
95
+ x: xTickLabel,
96
+ y: yTickLabel,
97
+ "transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
98
+ sx: {
99
+ fontSize: tickFontSize
100
+ },
101
+ className: classes.tickLabel,
102
+ children: formattedValue
103
+ })]
104
+ }, index);
105
+ }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
106
+ sx: {
107
+ fontSize: labelFontSize,
108
+ transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
109
+ },
110
+ className: classes.label,
111
+ children: label
112
+ }))]
113
+ });
114
+ }
115
+ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
116
+ // ----------------------------- Warning --------------------------------
117
+ // | These PropTypes are generated from the TypeScript type definitions |
118
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
119
+ // ----------------------------------------------------------------------
120
+ /**
121
+ * Id of the axis to render.
122
+ */
123
+ axisId: PropTypes.string.isRequired,
124
+ /**
125
+ * Override or extend the styles applied to the component.
126
+ */
127
+ classes: PropTypes.object,
128
+ /**
129
+ * If true, the axis line is disabled.
130
+ * @default false
131
+ */
132
+ disableLine: PropTypes.bool,
133
+ /**
134
+ * If true, the ticks are disabled.
135
+ * @default false
136
+ */
137
+ disableTicks: PropTypes.bool,
138
+ /**
139
+ * The fill color of the axis text.
140
+ * @default 'currentColor'
141
+ */
142
+ fill: PropTypes.string,
143
+ /**
144
+ * The label of the axis.
145
+ */
146
+ label: PropTypes.string,
147
+ /**
148
+ * The font size of the axis label.
149
+ * @default 14
150
+ */
151
+ labelFontSize: PropTypes.number,
152
+ /**
153
+ * Position of the axis.
154
+ */
155
+ position: PropTypes.oneOf(['bottom', 'top']),
156
+ /**
157
+ * The stroke color of the axis line.
158
+ * @default 'currentColor'
159
+ */
160
+ stroke: PropTypes.string,
161
+ /**
162
+ * The font size of the axis ticks text.
163
+ * @default 12
164
+ */
165
+ tickFontSize: PropTypes.number,
166
+ /**
167
+ * The size of the ticks.
168
+ * @default 6
169
+ */
170
+ tickSize: PropTypes.number
171
+ } : void 0;
172
+ export { ChartsXAxis };
@@ -0,0 +1 @@
1
+ export * from './ChartsXAxis';
@@ -0,0 +1,173 @@
1
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ var _excluded = ["scale", "ticksNumber"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { unstable_composeClasses as composeClasses } from '@mui/utils';
7
+ import { useThemeProps, useTheme } from '@mui/material/styles';
8
+ import { CartesianContext } from '../context/CartesianContextProvider';
9
+ import { DrawingContext } from '../context/DrawingProvider';
10
+ import useTicks from '../hooks/useTicks';
11
+ import { Line, Tick, TickLabel, Label, AxisRoot } from '../internals/components/AxisSharedComponents';
12
+ import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
13
+ import { jsx as _jsx } from "react/jsx-runtime";
14
+ import { jsxs as _jsxs } from "react/jsx-runtime";
15
+ var useUtilityClasses = function useUtilityClasses(ownerState) {
16
+ var classes = ownerState.classes,
17
+ position = ownerState.position;
18
+ var slots = {
19
+ root: ['root', 'directionY', position],
20
+ line: ['line'],
21
+ tickContainer: ['tickContainer'],
22
+ tick: ['tick'],
23
+ tickLabel: ['tickLabel'],
24
+ label: ['label']
25
+ };
26
+ return composeClasses(slots, getAxisUtilityClass, classes);
27
+ };
28
+ var defaultProps = {
29
+ position: 'left',
30
+ disableLine: false,
31
+ disableTicks: false,
32
+ tickFontSize: 12,
33
+ labelFontSize: 14,
34
+ tickSize: 6
35
+ };
36
+ function ChartsYAxis(inProps) {
37
+ var props = useThemeProps({
38
+ props: _extends({}, defaultProps, inProps),
39
+ name: 'MuiChartsYAxis'
40
+ });
41
+ var _React$useContext = React.useContext(CartesianContext),
42
+ _React$useContext$yAx = _React$useContext.yAxis[props.axisId],
43
+ yScale = _React$useContext$yAx.scale,
44
+ ticksNumber = _React$useContext$yAx.ticksNumber,
45
+ settings = _objectWithoutProperties(_React$useContext$yAx, _excluded);
46
+ var defaultizedProps = _extends({}, defaultProps, settings, props);
47
+ var position = defaultizedProps.position,
48
+ disableLine = defaultizedProps.disableLine,
49
+ disableTicks = defaultizedProps.disableTicks,
50
+ tickFontSize = defaultizedProps.tickFontSize,
51
+ label = defaultizedProps.label,
52
+ labelFontSize = defaultizedProps.labelFontSize,
53
+ tickSizeProp = defaultizedProps.tickSize,
54
+ valueFormatter = defaultizedProps.valueFormatter;
55
+ var theme = useTheme();
56
+ var classes = useUtilityClasses(_extends({}, defaultizedProps, {
57
+ theme: theme
58
+ }));
59
+ var _React$useContext2 = React.useContext(DrawingContext),
60
+ left = _React$useContext2.left,
61
+ top = _React$useContext2.top,
62
+ width = _React$useContext2.width,
63
+ height = _React$useContext2.height;
64
+ var tickSize = disableTicks ? 4 : tickSizeProp;
65
+ var yTicks = useTicks({
66
+ scale: yScale,
67
+ ticksNumber: ticksNumber,
68
+ valueFormatter: valueFormatter
69
+ });
70
+ var positionSigne = position === 'right' ? 1 : -1;
71
+ var labelRefPoint = {
72
+ x: positionSigne * (tickFontSize + tickSize + 10),
73
+ y: top + height / 2
74
+ };
75
+ return /*#__PURE__*/_jsxs(AxisRoot, {
76
+ transform: "translate(".concat(position === 'right' ? left + width : left, ", 0)"),
77
+ className: classes.root,
78
+ children: [!disableLine && /*#__PURE__*/_jsx(Line, {
79
+ y1: yScale.range()[0],
80
+ y2: yScale.range()[1],
81
+ className: classes.line
82
+ }), yTicks.map(function (_ref, index) {
83
+ var formattedValue = _ref.formattedValue,
84
+ offset = _ref.offset,
85
+ labelOffset = _ref.labelOffset;
86
+ var xTickLabel = positionSigne * (tickSize + 2);
87
+ var yTickLabel = labelOffset;
88
+ return /*#__PURE__*/_jsxs("g", {
89
+ transform: "translate(0, ".concat(offset, ")"),
90
+ className: classes.tickContainer,
91
+ children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
92
+ x2: positionSigne * tickSize,
93
+ className: classes.tick
94
+ }), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
95
+ x: xTickLabel,
96
+ y: yTickLabel,
97
+ "transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
98
+ sx: {
99
+ fontSize: tickFontSize
100
+ },
101
+ className: classes.tickLabel,
102
+ children: formattedValue.toLocaleString()
103
+ })]
104
+ }, index);
105
+ }), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
106
+ sx: {
107
+ fontSize: labelFontSize,
108
+ transform: "rotate(".concat(positionSigne * 90, "deg)"),
109
+ transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
110
+ },
111
+ className: classes.label,
112
+ children: label
113
+ }))]
114
+ });
115
+ }
116
+ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
117
+ // ----------------------------- Warning --------------------------------
118
+ // | These PropTypes are generated from the TypeScript type definitions |
119
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
120
+ // ----------------------------------------------------------------------
121
+ /**
122
+ * Id of the axis to render.
123
+ */
124
+ axisId: PropTypes.string.isRequired,
125
+ /**
126
+ * Override or extend the styles applied to the component.
127
+ */
128
+ classes: PropTypes.object,
129
+ /**
130
+ * If true, the axis line is disabled.
131
+ * @default false
132
+ */
133
+ disableLine: PropTypes.bool,
134
+ /**
135
+ * If true, the ticks are disabled.
136
+ * @default false
137
+ */
138
+ disableTicks: PropTypes.bool,
139
+ /**
140
+ * The fill color of the axis text.
141
+ * @default 'currentColor'
142
+ */
143
+ fill: PropTypes.string,
144
+ /**
145
+ * The label of the axis.
146
+ */
147
+ label: PropTypes.string,
148
+ /**
149
+ * The font size of the axis label.
150
+ * @default 14
151
+ */
152
+ labelFontSize: PropTypes.number,
153
+ /**
154
+ * Position of the axis.
155
+ */
156
+ position: PropTypes.oneOf(['left', 'right']),
157
+ /**
158
+ * The stroke color of the axis line.
159
+ * @default 'currentColor'
160
+ */
161
+ stroke: PropTypes.string,
162
+ /**
163
+ * The font size of the axis ticks text.
164
+ * @default 12
165
+ */
166
+ tickFontSize: PropTypes.number,
167
+ /**
168
+ * The size of the ticks.
169
+ * @default 6
170
+ */
171
+ tickSize: PropTypes.number
172
+ } : void 0;
173
+ export { ChartsYAxis };
@@ -0,0 +1 @@
1
+ export * from './ChartsYAxis';