@mui/x-charts 7.0.0-beta.3 → 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 (218) hide show
  1. package/BarChart/BarChart.js +0 -2
  2. package/CHANGELOG.md +226 -15
  3. package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
  4. package/ChartsTooltip/utils.js +1 -1
  5. package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
  6. package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
  7. package/ChartsXAxis/ChartsXAxis.js +1 -1
  8. package/ChartsYAxis/ChartsYAxis.js +1 -1
  9. package/Gauge/Gauge.js +0 -2
  10. package/Gauge/GaugeContainer.d.ts +0 -2
  11. package/Gauge/GaugeContainer.js +0 -2
  12. package/Gauge/GaugeProvider.js +3 -0
  13. package/Gauge/GaugeValueText.js +1 -1
  14. package/LineChart/LineChart.js +0 -2
  15. package/PieChart/PieChart.js +0 -2
  16. package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
  17. package/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  18. package/ScatterChart/ScatterChart.js +0 -3
  19. package/SparkLineChart/SparkLineChart.js +0 -2
  20. package/context/CartesianContextProvider.d.ts +0 -8
  21. package/context/CartesianContextProvider.js +4 -89
  22. package/context/DrawingProvider.d.ts +2 -11
  23. package/context/DrawingProvider.js +10 -35
  24. package/context/HighlightProvider.js +3 -0
  25. package/context/InteractionProvider.js +3 -0
  26. package/context/SeriesContextProvider.js +3 -0
  27. package/context/index.d.ts +0 -2
  28. package/context/index.js +1 -15
  29. package/esm/BarChart/BarChart.js +0 -2
  30. package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  31. package/esm/ChartsTooltip/utils.js +2 -2
  32. package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  33. package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
  34. package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
  35. package/esm/Gauge/Gauge.js +0 -2
  36. package/esm/Gauge/GaugeContainer.js +0 -2
  37. package/esm/Gauge/GaugeProvider.js +3 -0
  38. package/esm/Gauge/GaugeValueText.js +1 -1
  39. package/esm/LineChart/LineChart.js +0 -2
  40. package/esm/PieChart/PieChart.js +0 -2
  41. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  42. package/esm/ScatterChart/ScatterChart.js +0 -3
  43. package/esm/SparkLineChart/SparkLineChart.js +0 -2
  44. package/esm/context/CartesianContextProvider.js +3 -88
  45. package/esm/context/DrawingProvider.js +10 -36
  46. package/esm/context/HighlightProvider.js +3 -0
  47. package/esm/context/InteractionProvider.js +3 -0
  48. package/esm/context/SeriesContextProvider.js +3 -0
  49. package/esm/context/index.js +1 -2
  50. package/esm/hooks/useAxisEvents.js +2 -2
  51. package/hooks/useAxisEvents.js +1 -1
  52. package/hooks/useTicks.d.ts +1 -1
  53. package/index.js +1 -1
  54. package/modern/BarChart/BarChart.js +0 -2
  55. package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
  56. package/modern/ChartsTooltip/utils.js +2 -2
  57. package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
  58. package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
  59. package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
  60. package/modern/Gauge/Gauge.js +0 -2
  61. package/modern/Gauge/GaugeContainer.js +0 -2
  62. package/modern/Gauge/GaugeProvider.js +3 -0
  63. package/modern/Gauge/GaugeValueText.js +1 -1
  64. package/modern/LineChart/LineChart.js +0 -2
  65. package/modern/PieChart/PieChart.js +0 -2
  66. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
  67. package/modern/ScatterChart/ScatterChart.js +0 -3
  68. package/modern/SparkLineChart/SparkLineChart.js +0 -2
  69. package/modern/context/CartesianContextProvider.js +3 -88
  70. package/modern/context/DrawingProvider.js +10 -36
  71. package/modern/context/HighlightProvider.js +3 -0
  72. package/modern/context/InteractionProvider.js +3 -0
  73. package/modern/context/SeriesContextProvider.js +3 -0
  74. package/modern/context/index.js +1 -2
  75. package/modern/hooks/useAxisEvents.js +2 -2
  76. package/modern/index.js +1 -1
  77. package/package.json +1 -1
  78. package/legacy/BarChart/BarChart.js +0 -440
  79. package/legacy/BarChart/BarElement.js +0 -119
  80. package/legacy/BarChart/BarPlot.js +0 -232
  81. package/legacy/BarChart/extremums.js +0 -45
  82. package/legacy/BarChart/formatter.js +0 -78
  83. package/legacy/BarChart/index.js +0 -3
  84. package/legacy/BarChart/legend.js +0 -15
  85. package/legacy/ChartContainer/ChartContainer.js +0 -189
  86. package/legacy/ChartContainer/index.js +0 -1
  87. package/legacy/ChartsAxis/ChartsAxis.js +0 -215
  88. package/legacy/ChartsAxis/axisClasses.js +0 -5
  89. package/legacy/ChartsAxis/index.js +0 -2
  90. package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
  91. package/legacy/ChartsAxisHighlight/index.js +0 -1
  92. package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
  93. package/legacy/ChartsClipPath/index.js +0 -1
  94. package/legacy/ChartsGrid/ChartsGrid.js +0 -119
  95. package/legacy/ChartsGrid/chartsGridClasses.js +0 -6
  96. package/legacy/ChartsGrid/index.js +0 -2
  97. package/legacy/ChartsLegend/ChartsLegend.js +0 -100
  98. package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
  99. package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
  100. package/legacy/ChartsLegend/index.js +0 -4
  101. package/legacy/ChartsLegend/utils.js +0 -15
  102. package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
  103. package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
  104. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
  105. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
  106. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
  107. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
  108. package/legacy/ChartsReferenceLine/common.js +0 -19
  109. package/legacy/ChartsReferenceLine/index.js +0 -2
  110. package/legacy/ChartsSurface.js +0 -78
  111. package/legacy/ChartsText/ChartsText.js +0 -95
  112. package/legacy/ChartsText/index.js +0 -1
  113. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
  114. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
  115. package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
  116. package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
  117. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
  118. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
  119. package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
  120. package/legacy/ChartsTooltip/index.js +0 -6
  121. package/legacy/ChartsTooltip/utils.js +0 -103
  122. package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
  123. package/legacy/ChartsVoronoiHandler/index.js +0 -1
  124. package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
  125. package/legacy/ChartsXAxis/index.js +0 -1
  126. package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
  127. package/legacy/ChartsYAxis/index.js +0 -1
  128. package/legacy/Gauge/Gauge.js +0 -146
  129. package/legacy/Gauge/GaugeContainer.js +0 -215
  130. package/legacy/Gauge/GaugeProvider.js +0 -87
  131. package/legacy/Gauge/GaugeReferenceArc.js +0 -37
  132. package/legacy/Gauge/GaugeValueArc.js +0 -44
  133. package/legacy/Gauge/GaugeValueText.js +0 -66
  134. package/legacy/Gauge/gaugeClasses.js +0 -7
  135. package/legacy/Gauge/index.js +0 -7
  136. package/legacy/Gauge/utils.js +0 -84
  137. package/legacy/LineChart/AnimatedArea.js +0 -102
  138. package/legacy/LineChart/AnimatedLine.js +0 -104
  139. package/legacy/LineChart/AreaElement.js +0 -112
  140. package/legacy/LineChart/AreaPlot.js +0 -149
  141. package/legacy/LineChart/LineChart.js +0 -452
  142. package/legacy/LineChart/LineElement.js +0 -112
  143. package/legacy/LineChart/LineHighlightElement.js +0 -79
  144. package/legacy/LineChart/LineHighlightPlot.js +0 -97
  145. package/legacy/LineChart/LinePlot.js +0 -144
  146. package/legacy/LineChart/MarkElement.js +0 -153
  147. package/legacy/LineChart/MarkPlot.js +0 -178
  148. package/legacy/LineChart/extremums.js +0 -54
  149. package/legacy/LineChart/formatter.js +0 -82
  150. package/legacy/LineChart/index.js +0 -11
  151. package/legacy/LineChart/legend.js +0 -15
  152. package/legacy/PieChart/PieArc.js +0 -103
  153. package/legacy/PieChart/PieArcLabel.js +0 -112
  154. package/legacy/PieChart/PieArcLabelPlot.js +0 -193
  155. package/legacy/PieChart/PieArcPlot.js +0 -180
  156. package/legacy/PieChart/PieChart.js +0 -404
  157. package/legacy/PieChart/PiePlot.js +0 -137
  158. package/legacy/PieChart/dataTransform/transition.js +0 -149
  159. package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
  160. package/legacy/PieChart/formatter.js +0 -55
  161. package/legacy/PieChart/index.js +0 -6
  162. package/legacy/PieChart/legend.js +0 -16
  163. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -185
  164. package/legacy/ResponsiveChartContainer/index.js +0 -1
  165. package/legacy/ResponsiveChartContainer/useChartContainerDimensions.js +0 -73
  166. package/legacy/ScatterChart/Scatter.js +0 -110
  167. package/legacy/ScatterChart/ScatterChart.js +0 -395
  168. package/legacy/ScatterChart/ScatterPlot.js +0 -80
  169. package/legacy/ScatterChart/extremums.js +0 -39
  170. package/legacy/ScatterChart/formatter.js +0 -12
  171. package/legacy/ScatterChart/index.js +0 -3
  172. package/legacy/ScatterChart/legend.js +0 -15
  173. package/legacy/SparkLineChart/SparkLineChart.js +0 -266
  174. package/legacy/SparkLineChart/index.js +0 -1
  175. package/legacy/colorPalettes/colorPalettes.js +0 -15
  176. package/legacy/colorPalettes/index.js +0 -1
  177. package/legacy/constants.js +0 -8
  178. package/legacy/context/CartesianContextProvider.js +0 -327
  179. package/legacy/context/DrawingProvider.js +0 -74
  180. package/legacy/context/HighlightProvider.js +0 -56
  181. package/legacy/context/InteractionProvider.js +0 -81
  182. package/legacy/context/SeriesContextProvider.js +0 -74
  183. package/legacy/context/index.js +0 -2
  184. package/legacy/hooks/index.js +0 -2
  185. package/legacy/hooks/useAxisEvents.js +0 -120
  186. package/legacy/hooks/useChartDimensions.js +0 -18
  187. package/legacy/hooks/useDrawingArea.js +0 -21
  188. package/legacy/hooks/useInteractionItemProps.js +0 -71
  189. package/legacy/hooks/useMounted.js +0 -21
  190. package/legacy/hooks/useReducedMotion.js +0 -27
  191. package/legacy/hooks/useScale.js +0 -33
  192. package/legacy/hooks/useTicks.js +0 -65
  193. package/legacy/index.js +0 -33
  194. package/legacy/internals/components/AxisSharedComponents.js +0 -25
  195. package/legacy/internals/defaultizeColor.js +0 -17
  196. package/legacy/internals/defaultizeValueFormatter.js +0 -12
  197. package/legacy/internals/domUtils.js +0 -121
  198. package/legacy/internals/geometry.js +0 -37
  199. package/legacy/internals/getCurve.js +0 -39
  200. package/legacy/internals/getScale.js +0 -17
  201. package/legacy/internals/getWordsByLines.js +0 -15
  202. package/legacy/internals/isBandScale.js +0 -3
  203. package/legacy/internals/stackSeries.js +0 -92
  204. package/legacy/internals/useAnimatedPath.js +0 -32
  205. package/legacy/internals/utils.js +0 -52
  206. package/legacy/models/axis.js +0 -6
  207. package/legacy/models/helpers.js +0 -1
  208. package/legacy/models/index.js +0 -4
  209. package/legacy/models/layout.js +0 -1
  210. package/legacy/models/seriesType/bar.js +0 -1
  211. package/legacy/models/seriesType/common.js +0 -1
  212. package/legacy/models/seriesType/config.js +0 -1
  213. package/legacy/models/seriesType/index.js +0 -5
  214. package/legacy/models/seriesType/line.js +0 -1
  215. package/legacy/models/seriesType/pie.js +0 -1
  216. package/legacy/models/seriesType/scatter.js +0 -1
  217. package/legacy/models/stacking.js +0 -1
  218. 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,119 +0,0 @@
1
- import _extends from "@babel/runtime/helpers/esm/extends";
2
- import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
4
- var _excluded = ["vertical", "horizontal"];
5
- import * as React from 'react';
6
- import PropTypes from 'prop-types';
7
- import composeClasses from '@mui/utils/composeClasses';
8
- import { styled } from '@mui/material/styles';
9
- import { CartesianContext } from '../context/CartesianContextProvider';
10
- import { useTicks } from '../hooks/useTicks';
11
- import { getChartsGridUtilityClass, chartsGridClasses } from './chartsGridClasses';
12
- import { jsx as _jsx } from "react/jsx-runtime";
13
- import { jsxs as _jsxs } from "react/jsx-runtime";
14
- var GridRoot = styled('g', {
15
- name: 'MuiChartsGrid',
16
- slot: 'Root',
17
- overridesResolver: function overridesResolver(props, styles) {
18
- return styles.root;
19
- }
20
- })(function (_ref) {
21
- var theme = _ref.theme;
22
- return _defineProperty({}, "& .".concat(chartsGridClasses.line), {
23
- stroke: (theme.vars || theme).palette.divider,
24
- shapeRendering: 'crispEdges',
25
- strokeWidth: 1
26
- });
27
- });
28
- var useUtilityClasses = function useUtilityClasses(_ref3) {
29
- var classes = _ref3.classes;
30
- var slots = {
31
- root: ['root'],
32
- verticalLine: ['line', 'verticalLine'],
33
- horizontalLine: ['line', 'horizontalLine']
34
- };
35
- return composeClasses(slots, getChartsGridUtilityClass, classes);
36
- };
37
- /**
38
- * Demos:
39
- *
40
- * - [Axis](https://mui.com/x/react-charts/axis/)
41
- *
42
- * API:
43
- *
44
- * - [ChartsGrid API](https://mui.com/x/api/charts/charts-axis/)
45
- */
46
- function ChartsGrid(props) {
47
- var vertical = props.vertical,
48
- horizontal = props.horizontal,
49
- other = _objectWithoutProperties(props, _excluded);
50
- var _React$useContext = React.useContext(CartesianContext),
51
- xAxis = _React$useContext.xAxis,
52
- xAxisIds = _React$useContext.xAxisIds,
53
- yAxis = _React$useContext.yAxis,
54
- yAxisIds = _React$useContext.yAxisIds;
55
- var classes = useUtilityClasses(props);
56
- var horizontalAxisId = yAxisIds[0];
57
- var verticalAxisId = xAxisIds[0];
58
- var _xAxis$verticalAxisId = xAxis[verticalAxisId],
59
- xScale = _xAxis$verticalAxisId.scale,
60
- xTickNumber = _xAxis$verticalAxisId.tickNumber,
61
- xTickInterval = _xAxis$verticalAxisId.tickInterval;
62
- var _yAxis$horizontalAxis = yAxis[horizontalAxisId],
63
- yScale = _yAxis$horizontalAxis.scale,
64
- yTickNumber = _yAxis$horizontalAxis.tickNumber,
65
- yTickInterval = _yAxis$horizontalAxis.tickInterval;
66
- var xTicks = useTicks({
67
- scale: xScale,
68
- tickNumber: xTickNumber,
69
- tickInterval: xTickInterval
70
- });
71
- var yTicks = useTicks({
72
- scale: yScale,
73
- tickNumber: yTickNumber,
74
- tickInterval: yTickInterval
75
- });
76
- return /*#__PURE__*/_jsxs(GridRoot, _extends({}, other, {
77
- className: classes.root,
78
- children: [vertical && xTicks.map(function (_ref4) {
79
- var formattedValue = _ref4.formattedValue,
80
- offset = _ref4.offset;
81
- return /*#__PURE__*/_jsx("line", {
82
- y1: yScale.range()[0],
83
- y2: yScale.range()[1],
84
- x1: offset,
85
- x2: offset,
86
- className: classes.verticalLine
87
- }, formattedValue);
88
- }), horizontal && yTicks.map(function (_ref5) {
89
- var formattedValue = _ref5.formattedValue,
90
- offset = _ref5.offset;
91
- return /*#__PURE__*/_jsx("line", {
92
- y1: offset,
93
- y2: offset,
94
- x1: xScale.range()[0],
95
- x2: xScale.range()[1],
96
- className: classes.horizontalLine
97
- }, formattedValue);
98
- })]
99
- }));
100
- }
101
- process.env.NODE_ENV !== "production" ? ChartsGrid.propTypes = {
102
- // ----------------------------- Warning --------------------------------
103
- // | These PropTypes are generated from the TypeScript type definitions |
104
- // | To update them edit the TypeScript types and run "yarn proptypes" |
105
- // ----------------------------------------------------------------------
106
- /**
107
- * Override or extend the styles applied to the component.
108
- */
109
- classes: PropTypes.object,
110
- /**
111
- * Displays horizontal grid.
112
- */
113
- horizontal: PropTypes.bool,
114
- /**
115
- * Displays vertical grid.
116
- */
117
- vertical: PropTypes.bool
118
- } : void 0;
119
- export { ChartsGrid };
@@ -1,6 +0,0 @@
1
- import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
- import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
- export function getChartsGridUtilityClass(slot) {
4
- return generateUtilityClass('MuiChartsGrid', slot);
5
- }
6
- export var chartsGridClasses = generateUtilityClasses('MuiChartsGrid', ['root', 'line', 'horizontalLine', 'verticalLine']);
@@ -1,2 +0,0 @@
1
- export * from './ChartsGrid';
2
- export * from './chartsGridClasses';
@@ -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 };