@mui/x-charts 7.0.0-beta.2 → 7.0.0-beta.4

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 (265) hide show
  1. package/BarChart/BarChart.d.ts +21 -5
  2. package/BarChart/BarChart.js +27 -7
  3. package/CHANGELOG.md +298 -23
  4. package/ChartsGrid/ChartsGrid.d.ts +30 -0
  5. package/ChartsGrid/ChartsGrid.js +128 -0
  6. package/ChartsGrid/chartsGridClasses.d.ts +13 -0
  7. package/ChartsGrid/chartsGridClasses.js +14 -0
  8. package/ChartsGrid/index.d.ts +2 -0
  9. package/ChartsGrid/index.js +27 -0
  10. package/ChartsGrid/package.json +6 -0
  11. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  12. package/ChartsSurface.js +6 -4
  13. package/ChartsTooltip/utils.js +1 -1
  14. package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
  15. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
  16. package/ChartsXAxis/ChartsXAxis.js +3 -3
  17. package/ChartsYAxis/ChartsYAxis.js +3 -3
  18. package/Gauge/Gauge.d.ts +13 -0
  19. package/Gauge/Gauge.js +154 -0
  20. package/Gauge/GaugeContainer.d.ts +17 -0
  21. package/Gauge/GaugeContainer.js +214 -0
  22. package/Gauge/GaugeProvider.d.ts +117 -0
  23. package/Gauge/GaugeProvider.js +99 -0
  24. package/Gauge/GaugeReferenceArc.d.ts +2 -0
  25. package/Gauge/GaugeReferenceArc.js +44 -0
  26. package/Gauge/GaugeValueArc.d.ts +2 -0
  27. package/Gauge/GaugeValueArc.js +51 -0
  28. package/Gauge/GaugeValueText.d.ts +15 -0
  29. package/Gauge/GaugeValueText.js +77 -0
  30. package/Gauge/gaugeClasses.d.ts +14 -0
  31. package/Gauge/gaugeClasses.js +15 -0
  32. package/Gauge/index.d.ts +7 -0
  33. package/Gauge/index.js +87 -0
  34. package/Gauge/package.json +6 -0
  35. package/Gauge/utils.d.ts +19 -0
  36. package/Gauge/utils.js +75 -0
  37. package/LineChart/LineChart.d.ts +24 -5
  38. package/LineChart/LineChart.js +31 -7
  39. package/PieChart/PieArc.d.ts +4 -4
  40. package/PieChart/PieArc.js +9 -9
  41. package/PieChart/PieArcLabelPlot.js +13 -13
  42. package/PieChart/PieChart.d.ts +22 -0
  43. package/PieChart/PieChart.js +22 -2
  44. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
  45. package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  46. package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
  47. package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
  48. package/ScatterChart/ScatterChart.d.ts +18 -0
  49. package/ScatterChart/ScatterChart.js +25 -3
  50. package/SparkLineChart/SparkLineChart.js +0 -2
  51. package/context/CartesianContextProvider.d.ts +0 -8
  52. package/context/CartesianContextProvider.js +4 -89
  53. package/context/DrawingProvider.d.ts +2 -11
  54. package/context/DrawingProvider.js +10 -35
  55. package/context/HighlightProvider.js +3 -0
  56. package/context/InteractionProvider.js +3 -0
  57. package/context/SeriesContextProvider.js +3 -0
  58. package/context/index.d.ts +0 -2
  59. package/context/index.js +1 -15
  60. package/esm/BarChart/BarChart.js +27 -7
  61. package/esm/ChartsGrid/ChartsGrid.js +121 -0
  62. package/esm/ChartsGrid/chartsGridClasses.js +6 -0
  63. package/esm/ChartsGrid/index.js +2 -0
  64. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  65. package/esm/ChartsSurface.js +6 -4
  66. package/esm/ChartsTooltip/utils.js +2 -2
  67. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  68. package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
  69. package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
  70. package/esm/Gauge/Gauge.js +147 -0
  71. package/esm/Gauge/GaugeContainer.js +209 -0
  72. package/esm/Gauge/GaugeProvider.js +88 -0
  73. package/esm/Gauge/GaugeReferenceArc.js +35 -0
  74. package/esm/Gauge/GaugeValueArc.js +42 -0
  75. package/esm/Gauge/GaugeValueText.js +69 -0
  76. package/esm/Gauge/gaugeClasses.js +7 -0
  77. package/esm/Gauge/index.js +7 -0
  78. package/esm/Gauge/utils.js +68 -0
  79. package/esm/LineChart/LineChart.js +31 -7
  80. package/esm/PieChart/PieArc.js +9 -9
  81. package/esm/PieChart/PieArcLabelPlot.js +13 -13
  82. package/esm/PieChart/PieChart.js +22 -2
  83. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  84. package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  85. package/esm/ScatterChart/ScatterChart.js +25 -3
  86. package/esm/SparkLineChart/SparkLineChart.js +0 -2
  87. package/esm/context/CartesianContextProvider.js +3 -88
  88. package/esm/context/DrawingProvider.js +10 -36
  89. package/esm/context/HighlightProvider.js +3 -0
  90. package/esm/context/InteractionProvider.js +3 -0
  91. package/esm/context/SeriesContextProvider.js +3 -0
  92. package/esm/context/index.js +1 -2
  93. package/esm/hooks/useAxisEvents.js +2 -2
  94. package/esm/hooks/useTicks.js +2 -3
  95. package/esm/index.js +2 -0
  96. package/hooks/useAxisEvents.js +1 -1
  97. package/hooks/useTicks.d.ts +2 -3
  98. package/hooks/useTicks.js +2 -3
  99. package/index.d.ts +2 -0
  100. package/index.js +23 -1
  101. package/modern/BarChart/BarChart.js +27 -7
  102. package/modern/ChartsGrid/ChartsGrid.js +121 -0
  103. package/modern/ChartsGrid/chartsGridClasses.js +6 -0
  104. package/modern/ChartsGrid/index.js +2 -0
  105. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  106. package/modern/ChartsSurface.js +6 -4
  107. package/modern/ChartsTooltip/utils.js +2 -2
  108. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  109. package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
  110. package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
  111. package/modern/Gauge/Gauge.js +147 -0
  112. package/modern/Gauge/GaugeContainer.js +206 -0
  113. package/modern/Gauge/GaugeProvider.js +88 -0
  114. package/modern/Gauge/GaugeReferenceArc.js +35 -0
  115. package/modern/Gauge/GaugeValueArc.js +42 -0
  116. package/modern/Gauge/GaugeValueText.js +69 -0
  117. package/modern/Gauge/gaugeClasses.js +7 -0
  118. package/modern/Gauge/index.js +7 -0
  119. package/modern/Gauge/utils.js +68 -0
  120. package/modern/LineChart/LineChart.js +31 -7
  121. package/modern/PieChart/PieArc.js +9 -9
  122. package/modern/PieChart/PieArcLabelPlot.js +13 -13
  123. package/modern/PieChart/PieChart.js +22 -2
  124. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
  125. package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  126. package/modern/ScatterChart/ScatterChart.js +25 -3
  127. package/modern/SparkLineChart/SparkLineChart.js +0 -2
  128. package/modern/context/CartesianContextProvider.js +3 -88
  129. package/modern/context/DrawingProvider.js +10 -36
  130. package/modern/context/HighlightProvider.js +3 -0
  131. package/modern/context/InteractionProvider.js +3 -0
  132. package/modern/context/SeriesContextProvider.js +3 -0
  133. package/modern/context/index.js +1 -2
  134. package/modern/hooks/useAxisEvents.js +2 -2
  135. package/modern/hooks/useTicks.js +2 -3
  136. package/modern/index.js +3 -1
  137. package/package.json +4 -4
  138. package/legacy/BarChart/BarChart.js +0 -418
  139. package/legacy/BarChart/BarElement.js +0 -119
  140. package/legacy/BarChart/BarPlot.js +0 -232
  141. package/legacy/BarChart/extremums.js +0 -45
  142. package/legacy/BarChart/formatter.js +0 -78
  143. package/legacy/BarChart/index.js +0 -3
  144. package/legacy/BarChart/legend.js +0 -15
  145. package/legacy/ChartContainer/ChartContainer.js +0 -189
  146. package/legacy/ChartContainer/index.js +0 -1
  147. package/legacy/ChartsAxis/ChartsAxis.js +0 -215
  148. package/legacy/ChartsAxis/axisClasses.js +0 -5
  149. package/legacy/ChartsAxis/index.js +0 -2
  150. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
  151. package/legacy/ChartsAxisHighlight/index.js +0 -1
  152. package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
  153. package/legacy/ChartsClipPath/index.js +0 -1
  154. package/legacy/ChartsLegend/ChartsLegend.js +0 -100
  155. package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
  156. package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
  157. package/legacy/ChartsLegend/index.js +0 -4
  158. package/legacy/ChartsLegend/utils.js +0 -15
  159. package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
  160. package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
  161. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
  162. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
  163. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
  164. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
  165. package/legacy/ChartsReferenceLine/common.js +0 -19
  166. package/legacy/ChartsReferenceLine/index.js +0 -2
  167. package/legacy/ChartsSurface.js +0 -76
  168. package/legacy/ChartsText/ChartsText.js +0 -95
  169. package/legacy/ChartsText/index.js +0 -1
  170. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
  171. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
  172. package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
  173. package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
  174. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
  175. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
  176. package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
  177. package/legacy/ChartsTooltip/index.js +0 -6
  178. package/legacy/ChartsTooltip/utils.js +0 -103
  179. package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
  180. package/legacy/ChartsVoronoiHandler/index.js +0 -1
  181. package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
  182. package/legacy/ChartsXAxis/index.js +0 -1
  183. package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
  184. package/legacy/ChartsYAxis/index.js +0 -1
  185. package/legacy/LineChart/AnimatedArea.js +0 -102
  186. package/legacy/LineChart/AnimatedLine.js +0 -104
  187. package/legacy/LineChart/AreaElement.js +0 -112
  188. package/legacy/LineChart/AreaPlot.js +0 -149
  189. package/legacy/LineChart/LineChart.js +0 -426
  190. package/legacy/LineChart/LineElement.js +0 -112
  191. package/legacy/LineChart/LineHighlightElement.js +0 -79
  192. package/legacy/LineChart/LineHighlightPlot.js +0 -97
  193. package/legacy/LineChart/LinePlot.js +0 -144
  194. package/legacy/LineChart/MarkElement.js +0 -153
  195. package/legacy/LineChart/MarkPlot.js +0 -178
  196. package/legacy/LineChart/extremums.js +0 -54
  197. package/legacy/LineChart/formatter.js +0 -82
  198. package/legacy/LineChart/index.js +0 -11
  199. package/legacy/LineChart/legend.js +0 -15
  200. package/legacy/PieChart/PieArc.js +0 -103
  201. package/legacy/PieChart/PieArcLabel.js +0 -112
  202. package/legacy/PieChart/PieArcLabelPlot.js +0 -193
  203. package/legacy/PieChart/PieArcPlot.js +0 -180
  204. package/legacy/PieChart/PieChart.js +0 -382
  205. package/legacy/PieChart/PiePlot.js +0 -137
  206. package/legacy/PieChart/dataTransform/transition.js +0 -149
  207. package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
  208. package/legacy/PieChart/formatter.js +0 -55
  209. package/legacy/PieChart/index.js +0 -6
  210. package/legacy/PieChart/legend.js +0 -16
  211. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -255
  212. package/legacy/ResponsiveChartContainer/index.js +0 -1
  213. package/legacy/ScatterChart/Scatter.js +0 -110
  214. package/legacy/ScatterChart/ScatterChart.js +0 -370
  215. package/legacy/ScatterChart/ScatterPlot.js +0 -80
  216. package/legacy/ScatterChart/extremums.js +0 -39
  217. package/legacy/ScatterChart/formatter.js +0 -12
  218. package/legacy/ScatterChart/index.js +0 -3
  219. package/legacy/ScatterChart/legend.js +0 -15
  220. package/legacy/SparkLineChart/SparkLineChart.js +0 -266
  221. package/legacy/SparkLineChart/index.js +0 -1
  222. package/legacy/colorPalettes/colorPalettes.js +0 -15
  223. package/legacy/colorPalettes/index.js +0 -1
  224. package/legacy/constants.js +0 -8
  225. package/legacy/context/CartesianContextProvider.js +0 -327
  226. package/legacy/context/DrawingProvider.js +0 -74
  227. package/legacy/context/HighlightProvider.js +0 -56
  228. package/legacy/context/InteractionProvider.js +0 -81
  229. package/legacy/context/SeriesContextProvider.js +0 -74
  230. package/legacy/context/index.js +0 -2
  231. package/legacy/hooks/index.js +0 -2
  232. package/legacy/hooks/useAxisEvents.js +0 -120
  233. package/legacy/hooks/useChartDimensions.js +0 -18
  234. package/legacy/hooks/useDrawingArea.js +0 -21
  235. package/legacy/hooks/useInteractionItemProps.js +0 -71
  236. package/legacy/hooks/useMounted.js +0 -21
  237. package/legacy/hooks/useReducedMotion.js +0 -27
  238. package/legacy/hooks/useScale.js +0 -33
  239. package/legacy/hooks/useTicks.js +0 -66
  240. package/legacy/index.js +0 -31
  241. package/legacy/internals/components/AxisSharedComponents.js +0 -25
  242. package/legacy/internals/defaultizeColor.js +0 -17
  243. package/legacy/internals/defaultizeValueFormatter.js +0 -12
  244. package/legacy/internals/domUtils.js +0 -121
  245. package/legacy/internals/geometry.js +0 -37
  246. package/legacy/internals/getCurve.js +0 -39
  247. package/legacy/internals/getScale.js +0 -17
  248. package/legacy/internals/getWordsByLines.js +0 -15
  249. package/legacy/internals/isBandScale.js +0 -3
  250. package/legacy/internals/stackSeries.js +0 -92
  251. package/legacy/internals/useAnimatedPath.js +0 -32
  252. package/legacy/internals/utils.js +0 -52
  253. package/legacy/models/axis.js +0 -6
  254. package/legacy/models/helpers.js +0 -1
  255. package/legacy/models/index.js +0 -4
  256. package/legacy/models/layout.js +0 -1
  257. package/legacy/models/seriesType/bar.js +0 -1
  258. package/legacy/models/seriesType/common.js +0 -1
  259. package/legacy/models/seriesType/config.js +0 -1
  260. package/legacy/models/seriesType/index.js +0 -5
  261. package/legacy/models/seriesType/line.js +0 -1
  262. package/legacy/models/seriesType/pie.js +0 -1
  263. package/legacy/models/seriesType/scatter.js +0 -1
  264. package/legacy/models/stacking.js +0 -1
  265. package/legacy/themeAugmentation/index.js +0 -3
@@ -1,215 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _typeof from "@babel/runtime/helpers/esm/typeof";
3
- import * as React from 'react';
4
- import PropTypes from 'prop-types';
5
- import { CartesianContext } from '../context/CartesianContextProvider';
6
- import { ChartsXAxis } from '../ChartsXAxis';
7
- import { ChartsYAxis } from '../ChartsYAxis';
8
- import { jsx as _jsx } from "react/jsx-runtime";
9
- import { jsxs as _jsxs } from "react/jsx-runtime";
10
- var getAxisId = function getAxisId(propsValue) {
11
- if (propsValue == null) {
12
- return null;
13
- }
14
- if (_typeof(propsValue) === 'object') {
15
- var _propsValue$axisId;
16
- return (_propsValue$axisId = propsValue.axisId) != null ? _propsValue$axisId : null;
17
- }
18
- return propsValue;
19
- };
20
- var mergeProps = function mergeProps(axisConfig, slots, slotProps) {
21
- return _typeof(axisConfig) === 'object' ? _extends({}, axisConfig, {
22
- slots: _extends({}, slots, axisConfig == null ? void 0 : axisConfig.slots),
23
- slotProps: _extends({}, slotProps, axisConfig == null ? void 0 : axisConfig.slotProps)
24
- }) : {
25
- slots: slots,
26
- slotProps: slotProps
27
- };
28
- };
29
-
30
- /**
31
- * Demos:
32
- *
33
- * - [Axis](https://mui.com/x/react-charts/axis/)
34
- *
35
- * API:
36
- *
37
- * - [ChartsAxis API](https://mui.com/x/api/charts/charts-axis/)
38
- */
39
- function ChartsAxis(props) {
40
- var topAxis = props.topAxis,
41
- leftAxis = props.leftAxis,
42
- rightAxis = props.rightAxis,
43
- bottomAxis = props.bottomAxis,
44
- slots = props.slots,
45
- slotProps = props.slotProps;
46
- var _React$useContext = React.useContext(CartesianContext),
47
- xAxis = _React$useContext.xAxis,
48
- xAxisIds = _React$useContext.xAxisIds,
49
- yAxis = _React$useContext.yAxis,
50
- yAxisIds = _React$useContext.yAxisIds;
51
-
52
- // TODO: use for plotting line without ticks or any thing
53
- // const drawingArea = React.useContext(DrawingContext);
54
-
55
- var leftId = getAxisId(leftAxis === undefined ? yAxisIds[0] : leftAxis);
56
- var bottomId = getAxisId(bottomAxis === undefined ? xAxisIds[0] : bottomAxis);
57
- var topId = getAxisId(topAxis);
58
- var rightId = getAxisId(rightAxis);
59
- if (topId !== null && !xAxis[topId]) {
60
- throw Error(["MUI X Charts: id used for top axis \"".concat(topId, "\" is not defined."), "Available ids are: ".concat(xAxisIds.join(', '), ".")].join('\n'));
61
- }
62
- if (leftId !== null && !yAxis[leftId]) {
63
- throw Error(["MUI X Charts: id used for left axis \"".concat(leftId, "\" is not defined."), "Available ids are: ".concat(yAxisIds.join(', '), ".")].join('\n'));
64
- }
65
- if (rightId !== null && !yAxis[rightId]) {
66
- throw Error(["MUI X Charts: id used for right axis \"".concat(rightId, "\" is not defined."), "Available ids are: ".concat(yAxisIds.join(', '), ".")].join('\n'));
67
- }
68
- if (bottomId !== null && !xAxis[bottomId]) {
69
- throw Error(["MUI X Charts: id used for bottom axis \"".concat(bottomId, "\" is not defined."), "Available ids are: ".concat(xAxisIds.join(', '), ".")].join('\n'));
70
- }
71
- var topAxisProps = mergeProps(topAxis, slots, slotProps);
72
- var bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
73
- var leftAxisProps = mergeProps(leftAxis, slots, slotProps);
74
- var rightAxisProps = mergeProps(rightAxis, slots, slotProps);
75
- 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
- }))]
89
- });
90
- }
91
- process.env.NODE_ENV !== "production" ? ChartsAxis.propTypes = {
92
- // ----------------------------- Warning --------------------------------
93
- // | These PropTypes are generated from the TypeScript type definitions |
94
- // | To update them edit the TypeScript types and run "yarn proptypes" |
95
- // ----------------------------------------------------------------------
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.shape({
102
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
103
- classes: PropTypes.object,
104
- disableLine: PropTypes.bool,
105
- disableTicks: PropTypes.bool,
106
- fill: PropTypes.string,
107
- label: PropTypes.string,
108
- labelFontSize: PropTypes.number,
109
- labelStyle: PropTypes.object,
110
- position: PropTypes.oneOf(['bottom', 'top']),
111
- slotProps: PropTypes.object,
112
- slots: PropTypes.object,
113
- stroke: PropTypes.string,
114
- tickFontSize: PropTypes.number,
115
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
116
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
117
- tickLabelStyle: PropTypes.object,
118
- tickMaxStep: PropTypes.number,
119
- tickMinStep: PropTypes.number,
120
- tickNumber: PropTypes.number,
121
- tickSize: PropTypes.number
122
- }), PropTypes.string]),
123
- /**
124
- * Indicate which axis to display the left of the charts.
125
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
126
- * @default yAxisIds[0] The id of the first provided axis
127
- */
128
- leftAxis: PropTypes.oneOfType([PropTypes.shape({
129
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
130
- classes: PropTypes.object,
131
- disableLine: PropTypes.bool,
132
- disableTicks: PropTypes.bool,
133
- fill: PropTypes.string,
134
- label: PropTypes.string,
135
- labelFontSize: PropTypes.number,
136
- labelStyle: PropTypes.object,
137
- position: PropTypes.oneOf(['left', 'right']),
138
- slotProps: PropTypes.object,
139
- slots: PropTypes.object,
140
- stroke: PropTypes.string,
141
- tickFontSize: PropTypes.number,
142
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
143
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
144
- tickLabelStyle: PropTypes.object,
145
- tickMaxStep: PropTypes.number,
146
- tickMinStep: PropTypes.number,
147
- tickNumber: PropTypes.number,
148
- tickSize: PropTypes.number
149
- }), PropTypes.string]),
150
- /**
151
- * Indicate which axis to display the right of the charts.
152
- * Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
153
- * @default null
154
- */
155
- rightAxis: PropTypes.oneOfType([PropTypes.shape({
156
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
157
- classes: PropTypes.object,
158
- disableLine: PropTypes.bool,
159
- disableTicks: PropTypes.bool,
160
- fill: PropTypes.string,
161
- label: PropTypes.string,
162
- labelFontSize: PropTypes.number,
163
- labelStyle: PropTypes.object,
164
- position: PropTypes.oneOf(['left', 'right']),
165
- slotProps: PropTypes.object,
166
- slots: PropTypes.object,
167
- stroke: PropTypes.string,
168
- tickFontSize: PropTypes.number,
169
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
170
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
171
- tickLabelStyle: PropTypes.object,
172
- tickMaxStep: PropTypes.number,
173
- tickMinStep: PropTypes.number,
174
- tickNumber: PropTypes.number,
175
- tickSize: PropTypes.number
176
- }), PropTypes.string]),
177
- /**
178
- * The props used for each component slot.
179
- * @default {}
180
- */
181
- slotProps: PropTypes.object,
182
- /**
183
- * Overridable component slots.
184
- * @default {}
185
- */
186
- slots: PropTypes.object,
187
- /**
188
- * Indicate which axis to display the top of the charts.
189
- * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
190
- * @default null
191
- */
192
- topAxis: PropTypes.oneOfType([PropTypes.shape({
193
- axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
194
- classes: PropTypes.object,
195
- disableLine: PropTypes.bool,
196
- disableTicks: PropTypes.bool,
197
- fill: PropTypes.string,
198
- label: PropTypes.string,
199
- labelFontSize: PropTypes.number,
200
- labelStyle: PropTypes.object,
201
- position: PropTypes.oneOf(['bottom', 'top']),
202
- slotProps: PropTypes.object,
203
- slots: PropTypes.object,
204
- stroke: PropTypes.string,
205
- tickFontSize: PropTypes.number,
206
- tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
207
- tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
208
- tickLabelStyle: PropTypes.object,
209
- tickMaxStep: PropTypes.number,
210
- tickMinStep: PropTypes.number,
211
- tickNumber: PropTypes.number,
212
- tickSize: PropTypes.number
213
- }), PropTypes.string])
214
- } : void 0;
215
- export { ChartsAxis };
@@ -1,5 +0,0 @@
1
- import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
- export function getAxisUtilityClass(slot) {
3
- return generateUtilityClass('MuiChartsAxis', slot);
4
- }
5
- export var axisClasses = generateUtilityClasses('MuiChartsAxis', ['root', 'line', 'tickContainer', 'tick', 'tickLabel', 'label', 'directionX', 'directionY', 'top', 'bottom', 'left', 'right']);
@@ -1,2 +0,0 @@
1
- export * from './ChartsAxis';
2
- export * from './axisClasses';
@@ -1,105 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import * as React from 'react';
3
- import PropTypes from 'prop-types';
4
- import composeClasses from '@mui/utils/composeClasses';
5
- import generateUtilityClass from '@mui/utils/generateUtilityClass';
6
- import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
7
- import { styled } from '@mui/material/styles';
8
- import { InteractionContext } from '../context/InteractionProvider';
9
- import { CartesianContext } from '../context/CartesianContextProvider';
10
- import { getValueToPositionMapper } from '../hooks/useScale';
11
- import { isBandScale } from '../internals/isBandScale';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
- export function getAxisHighlightUtilityClass(slot) {
15
- return generateUtilityClass('MuiChartsAxisHighlight', slot);
16
- }
17
- export var chartsAxisHighlightClasses = generateUtilityClasses('MuiChartsAxisHighlight', ['root']);
18
- var useUtilityClasses = function useUtilityClasses() {
19
- var slots = {
20
- root: ['root']
21
- };
22
- return composeClasses(slots, getAxisHighlightUtilityClass);
23
- };
24
- export var ChartsAxisHighlightPath = styled('path', {
25
- name: 'MuiChartsAxisHighlight',
26
- slot: 'Root',
27
- overridesResolver: function overridesResolver(_, styles) {
28
- return styles.root;
29
- }
30
- })(function (_ref) {
31
- var ownerState = _ref.ownerState,
32
- theme = _ref.theme;
33
- return _extends({
34
- pointerEvents: 'none'
35
- }, ownerState.axisHighlight === 'band' && {
36
- fill: theme.palette.mode === 'light' ? 'gray' : 'white',
37
- fillOpacity: 0.1
38
- }, ownerState.axisHighlight === 'line' && {
39
- strokeDasharray: '5 2',
40
- stroke: theme.palette.mode === 'light' ? '#000000' : '#ffffff'
41
- });
42
- });
43
- /**
44
- * Demos:
45
- *
46
- * - [Custom components](https://mui.com/x/react-charts/components/)
47
- *
48
- * API:
49
- *
50
- * - [ChartsAxisHighlight API](https://mui.com/x/api/charts/charts-axis-highlight/)
51
- */
52
- function ChartsAxisHighlight(props) {
53
- var xAxisHighlight = props.x,
54
- yAxisHighlight = props.y;
55
- var _React$useContext = React.useContext(CartesianContext),
56
- xAxisIds = _React$useContext.xAxisIds,
57
- xAxis = _React$useContext.xAxis,
58
- yAxisIds = _React$useContext.yAxisIds,
59
- yAxis = _React$useContext.yAxis;
60
- var classes = useUtilityClasses();
61
- var USED_X_AXIS_ID = xAxisIds[0];
62
- var USED_Y_AXIS_ID = yAxisIds[0];
63
- var xScale = xAxis[USED_X_AXIS_ID].scale;
64
- var yScale = yAxis[USED_Y_AXIS_ID].scale;
65
- var _React$useContext2 = React.useContext(InteractionContext),
66
- axis = _React$useContext2.axis;
67
- var getXPosition = getValueToPositionMapper(xScale);
68
- var getYPosition = getValueToPositionMapper(yScale);
69
- return /*#__PURE__*/_jsxs(React.Fragment, {
70
- children: [xAxisHighlight === 'band' && axis.x !== null && isBandScale(xScale) && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
71
- d: "M ".concat(xScale(axis.x.value) - (xScale.step() - xScale.bandwidth()) / 2, " ").concat(yScale.range()[0], " l ").concat(xScale.step(), " 0 l 0 ").concat(yScale.range()[1] - yScale.range()[0], " l ").concat(-xScale.step(), " 0 Z"),
72
- className: classes.root,
73
- ownerState: {
74
- axisHighlight: 'band'
75
- }
76
- }), yAxisHighlight === 'band' && axis.y !== null && isBandScale(yScale) && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
77
- d: "M ".concat(xScale.range()[0], " ").concat(yScale(axis.y.value) - (yScale.step() - yScale.bandwidth()) / 2, " l 0 ").concat(yScale.step(), " l ").concat(xScale.range()[1] - xScale.range()[0], " 0 l 0 ").concat(-yScale.step(), " Z"),
78
- className: classes.root,
79
- ownerState: {
80
- axisHighlight: 'band'
81
- }
82
- }), xAxisHighlight === 'line' && axis.x !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
83
- d: "M ".concat(getXPosition(axis.x.value), " ").concat(yScale.range()[0], " L ").concat(getXPosition(axis.x.value), " ").concat(yScale.range()[1]),
84
- className: classes.root,
85
- ownerState: {
86
- axisHighlight: 'line'
87
- }
88
- }), yAxisHighlight === 'line' && axis.y !== null && /*#__PURE__*/_jsx(ChartsAxisHighlightPath, {
89
- d: "M ".concat(xScale.range()[0], " ").concat(getYPosition(axis.y.value), " L ").concat(xScale.range()[1], " ").concat(getYPosition(axis.y.value)),
90
- className: classes.root,
91
- ownerState: {
92
- axisHighlight: 'line'
93
- }
94
- })]
95
- });
96
- }
97
- process.env.NODE_ENV !== "production" ? ChartsAxisHighlight.propTypes = {
98
- // ----------------------------- Warning --------------------------------
99
- // | These PropTypes are generated from the TypeScript type definitions |
100
- // | To update them edit the TypeScript types and run "yarn proptypes" |
101
- // ----------------------------------------------------------------------
102
- x: PropTypes.oneOf(['band', 'line', 'none']),
103
- y: PropTypes.oneOf(['band', 'line', 'none'])
104
- } : void 0;
105
- export { ChartsAxisHighlight };
@@ -1 +0,0 @@
1
- export * from './ChartsAxisHighlight';
@@ -1,48 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import * as React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { DrawingContext } from '../context/DrawingProvider';
5
- import { jsx as _jsx } from "react/jsx-runtime";
6
- /**
7
- * API:
8
- *
9
- * - [ChartsClipPath API](https://mui.com/x/api/charts/charts-clip-path/)
10
- */
11
- function ChartsClipPath(props) {
12
- var id = props.id,
13
- offsetProps = props.offset;
14
- var _React$useContext = React.useContext(DrawingContext),
15
- left = _React$useContext.left,
16
- top = _React$useContext.top,
17
- width = _React$useContext.width,
18
- height = _React$useContext.height;
19
- var offset = _extends({
20
- top: 0,
21
- right: 0,
22
- bottom: 0,
23
- left: 0
24
- }, offsetProps);
25
- return /*#__PURE__*/_jsx("clipPath", {
26
- id: id,
27
- children: /*#__PURE__*/_jsx("rect", {
28
- x: left - offset.left,
29
- y: top - offset.top,
30
- width: width + offset.left + offset.right,
31
- height: height + offset.top + offset.bottom
32
- })
33
- });
34
- }
35
- process.env.NODE_ENV !== "production" ? ChartsClipPath.propTypes = {
36
- // ----------------------------- Warning --------------------------------
37
- // | These PropTypes are generated from the TypeScript type definitions |
38
- // | To update them edit the TypeScript types and run "yarn proptypes" |
39
- // ----------------------------------------------------------------------
40
- id: PropTypes.string.isRequired,
41
- offset: PropTypes.shape({
42
- bottom: PropTypes.number,
43
- left: PropTypes.number,
44
- right: PropTypes.number,
45
- top: PropTypes.number
46
- })
47
- } : void 0;
48
- export { ChartsClipPath };
@@ -1 +0,0 @@
1
- export * from './ChartsClipPath';
@@ -1,100 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import * as React from 'react';
3
- import PropTypes from 'prop-types';
4
- import { useSlotProps } from '@mui/base/utils';
5
- import { unstable_composeClasses as composeClasses } from '@mui/utils';
6
- import { useThemeProps, useTheme } from '@mui/material/styles';
7
- import { DrawingContext } from '../context/DrawingProvider';
8
- import { getSeriesToDisplay } from './utils';
9
- import { SeriesContext } from '../context/SeriesContextProvider';
10
- import { getLegendUtilityClass } from './chartsLegendClasses';
11
- import { DefaultChartsLegend } from './DefaultChartsLegend';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- var useUtilityClasses = function useUtilityClasses(ownerState) {
14
- var classes = ownerState.classes,
15
- direction = ownerState.direction;
16
- var slots = {
17
- root: ['root', direction],
18
- mark: ['mark'],
19
- label: ['label'],
20
- series: ['series']
21
- };
22
- return composeClasses(slots, getLegendUtilityClass, classes);
23
- };
24
- var defaultProps = {
25
- position: {
26
- horizontal: 'middle',
27
- vertical: 'top'
28
- },
29
- direction: 'row'
30
- };
31
- function ChartsLegend(inProps) {
32
- var _slots$legend;
33
- var props = useThemeProps({
34
- props: _extends({}, defaultProps, inProps),
35
- name: 'MuiChartsLegend'
36
- });
37
- var position = props.position,
38
- direction = props.direction,
39
- hidden = props.hidden,
40
- slots = props.slots,
41
- slotProps = props.slotProps;
42
- var theme = useTheme();
43
- var classes = useUtilityClasses(_extends({}, props, {
44
- theme: theme
45
- }));
46
- var drawingArea = React.useContext(DrawingContext);
47
- var series = React.useContext(SeriesContext);
48
- var seriesToDisplay = getSeriesToDisplay(series);
49
- var ChartLegendRender = (_slots$legend = slots == null ? void 0 : slots.legend) != null ? _slots$legend : DefaultChartsLegend;
50
- var chartLegendRenderProps = useSlotProps({
51
- elementType: ChartLegendRender,
52
- externalSlotProps: slotProps == null ? void 0 : slotProps.legend,
53
- additionalProps: {
54
- position: position,
55
- direction: direction,
56
- classes: classes,
57
- drawingArea: drawingArea,
58
- series: series,
59
- hidden: hidden,
60
- seriesToDisplay: seriesToDisplay
61
- },
62
- ownerState: {}
63
- });
64
- return /*#__PURE__*/_jsx(ChartLegendRender, _extends({}, chartLegendRenderProps));
65
- }
66
- process.env.NODE_ENV !== "production" ? ChartsLegend.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
- * Override or extend the styles applied to the component.
73
- */
74
- classes: PropTypes.object,
75
- /**
76
- * The direction of the legend layout.
77
- * The default depends on the chart.
78
- */
79
- direction: PropTypes.oneOf(['column', 'row']),
80
- /**
81
- * Set to true to hide the legend.
82
- * @default false
83
- */
84
- hidden: PropTypes.bool,
85
- position: PropTypes.shape({
86
- horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
87
- vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
88
- }),
89
- /**
90
- * The props used for each component slot.
91
- * @default {}
92
- */
93
- slotProps: PropTypes.object,
94
- /**
95
- * Overridable component slots.
96
- * @default {}
97
- */
98
- slots: PropTypes.object
99
- } : void 0;
100
- export { ChartsLegend };