@mui/x-charts 7.0.0-beta.1 → 7.0.0-beta.3

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 (234) hide show
  1. package/BarChart/BarChart.d.ts +21 -5
  2. package/BarChart/BarChart.js +37 -13
  3. package/BarChart/BarElement.d.ts +20 -13
  4. package/BarChart/BarElement.js +1 -0
  5. package/BarChart/BarPlot.d.ts +3 -5
  6. package/BarChart/BarPlot.js +9 -10
  7. package/CHANGELOG.md +223 -1
  8. package/ChartContainer/ChartContainer.js +6 -4
  9. package/ChartsAxis/ChartsAxis.js +4 -4
  10. package/ChartsGrid/ChartsGrid.d.ts +30 -0
  11. package/ChartsGrid/ChartsGrid.js +128 -0
  12. package/ChartsGrid/chartsGridClasses.d.ts +13 -0
  13. package/ChartsGrid/chartsGridClasses.js +14 -0
  14. package/ChartsGrid/index.d.ts +2 -0
  15. package/ChartsGrid/index.js +27 -0
  16. package/ChartsGrid/package.json +6 -0
  17. package/ChartsLegend/ChartsLegend.d.ts +5 -54
  18. package/ChartsLegend/ChartsLegend.js +2 -307
  19. package/ChartsLegend/DefaultChartsLegend.d.ts +60 -0
  20. package/ChartsLegend/DefaultChartsLegend.js +294 -0
  21. package/ChartsLegend/index.d.ts +1 -0
  22. package/ChartsLegend/index.js +11 -0
  23. package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  24. package/ChartsReferenceLine/common.d.ts +2 -1
  25. package/ChartsSurface.js +6 -4
  26. package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  27. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
  28. package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  29. package/ChartsTooltip/utils.d.ts +1 -0
  30. package/ChartsTooltip/utils.js +7 -0
  31. package/ChartsXAxis/ChartsXAxis.js +15 -11
  32. package/ChartsYAxis/ChartsYAxis.js +3 -3
  33. package/Gauge/Gauge.d.ts +13 -0
  34. package/Gauge/Gauge.js +156 -0
  35. package/Gauge/GaugeContainer.d.ts +19 -0
  36. package/Gauge/GaugeContainer.js +216 -0
  37. package/Gauge/GaugeProvider.d.ts +117 -0
  38. package/Gauge/GaugeProvider.js +96 -0
  39. package/Gauge/GaugeReferenceArc.d.ts +2 -0
  40. package/Gauge/GaugeReferenceArc.js +44 -0
  41. package/Gauge/GaugeValueArc.d.ts +2 -0
  42. package/Gauge/GaugeValueArc.js +51 -0
  43. package/Gauge/GaugeValueText.d.ts +15 -0
  44. package/Gauge/GaugeValueText.js +77 -0
  45. package/Gauge/gaugeClasses.d.ts +14 -0
  46. package/Gauge/gaugeClasses.js +15 -0
  47. package/Gauge/index.d.ts +7 -0
  48. package/Gauge/index.js +87 -0
  49. package/Gauge/package.json +6 -0
  50. package/Gauge/utils.d.ts +19 -0
  51. package/Gauge/utils.js +75 -0
  52. package/LineChart/AnimatedArea.js +1 -1
  53. package/LineChart/AnimatedLine.js +1 -1
  54. package/LineChart/AreaElement.d.ts +2 -1
  55. package/LineChart/AreaElement.js +1 -1
  56. package/LineChart/LineChart.d.ts +24 -5
  57. package/LineChart/LineChart.js +41 -13
  58. package/LineChart/LineElement.d.ts +2 -1
  59. package/LineChart/LineElement.js +1 -1
  60. package/LineChart/LineHighlightElement.d.ts +3 -2
  61. package/LineChart/LineHighlightElement.js +2 -1
  62. package/LineChart/MarkElement.d.ts +3 -2
  63. package/LineChart/MarkElement.js +1 -0
  64. package/PieChart/PieArc.d.ts +7 -6
  65. package/PieChart/PieArc.js +10 -9
  66. package/PieChart/PieArcLabel.d.ts +3 -2
  67. package/PieChart/PieArcLabel.js +1 -0
  68. package/PieChart/PieArcLabelPlot.js +14 -14
  69. package/PieChart/PieArcPlot.js +1 -1
  70. package/PieChart/PieChart.d.ts +22 -0
  71. package/PieChart/PieChart.js +32 -8
  72. package/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -70
  73. package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
  74. package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
  75. package/ScatterChart/ScatterChart.d.ts +18 -0
  76. package/ScatterChart/ScatterChart.js +35 -8
  77. package/SparkLineChart/SparkLineChart.d.ts +1 -1
  78. package/SparkLineChart/SparkLineChart.js +5 -4
  79. package/context/CartesianContextProvider.js +8 -6
  80. package/esm/BarChart/BarChart.js +37 -13
  81. package/esm/BarChart/BarElement.js +1 -0
  82. package/esm/BarChart/BarPlot.js +8 -10
  83. package/esm/ChartContainer/ChartContainer.js +6 -4
  84. package/esm/ChartsAxis/ChartsAxis.js +4 -4
  85. package/esm/ChartsGrid/ChartsGrid.js +121 -0
  86. package/esm/ChartsGrid/chartsGridClasses.js +6 -0
  87. package/esm/ChartsGrid/index.js +2 -0
  88. package/esm/ChartsLegend/ChartsLegend.js +2 -307
  89. package/esm/ChartsLegend/DefaultChartsLegend.js +286 -0
  90. package/esm/ChartsLegend/index.js +1 -0
  91. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  92. package/esm/ChartsSurface.js +6 -4
  93. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  94. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
  95. package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  96. package/esm/ChartsTooltip/utils.js +6 -0
  97. package/esm/ChartsXAxis/ChartsXAxis.js +14 -10
  98. package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
  99. package/esm/Gauge/Gauge.js +149 -0
  100. package/esm/Gauge/GaugeContainer.js +211 -0
  101. package/esm/Gauge/GaugeProvider.js +85 -0
  102. package/esm/Gauge/GaugeReferenceArc.js +35 -0
  103. package/esm/Gauge/GaugeValueArc.js +42 -0
  104. package/esm/Gauge/GaugeValueText.js +69 -0
  105. package/esm/Gauge/gaugeClasses.js +7 -0
  106. package/esm/Gauge/index.js +7 -0
  107. package/esm/Gauge/utils.js +68 -0
  108. package/esm/LineChart/AnimatedArea.js +1 -1
  109. package/esm/LineChart/AnimatedLine.js +1 -1
  110. package/esm/LineChart/AreaElement.js +1 -1
  111. package/esm/LineChart/LineChart.js +41 -13
  112. package/esm/LineChart/LineElement.js +1 -1
  113. package/esm/LineChart/LineHighlightElement.js +2 -1
  114. package/esm/LineChart/MarkElement.js +1 -0
  115. package/esm/PieChart/PieArc.js +10 -9
  116. package/esm/PieChart/PieArcLabel.js +1 -0
  117. package/esm/PieChart/PieArcLabelPlot.js +14 -14
  118. package/esm/PieChart/PieArcPlot.js +1 -1
  119. package/esm/PieChart/PieChart.js +32 -8
  120. package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -70
  121. package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  122. package/esm/ScatterChart/ScatterChart.js +35 -8
  123. package/esm/SparkLineChart/SparkLineChart.js +5 -4
  124. package/esm/context/CartesianContextProvider.js +8 -6
  125. package/esm/hooks/useTicks.js +2 -3
  126. package/esm/index.js +2 -0
  127. package/hooks/useTicks.d.ts +1 -2
  128. package/hooks/useTicks.js +2 -3
  129. package/index.d.ts +2 -0
  130. package/index.js +23 -1
  131. package/internals/defaultizeColor.d.ts +16 -16
  132. package/internals/defaultizeValueFormatter.d.ts +4 -7
  133. package/internals/stackSeries.d.ts +4 -7
  134. package/legacy/BarChart/BarChart.js +37 -13
  135. package/legacy/BarChart/BarElement.js +1 -0
  136. package/legacy/BarChart/BarPlot.js +10 -10
  137. package/legacy/ChartContainer/ChartContainer.js +6 -4
  138. package/legacy/ChartsAxis/ChartsAxis.js +4 -4
  139. package/legacy/ChartsGrid/ChartsGrid.js +119 -0
  140. package/legacy/ChartsGrid/chartsGridClasses.js +6 -0
  141. package/legacy/ChartsGrid/index.js +2 -0
  142. package/legacy/ChartsLegend/ChartsLegend.js +2 -323
  143. package/legacy/ChartsLegend/DefaultChartsLegend.js +302 -0
  144. package/legacy/ChartsLegend/index.js +1 -0
  145. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  146. package/legacy/ChartsSurface.js +5 -3
  147. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  148. package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
  149. package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  150. package/legacy/ChartsTooltip/utils.js +6 -0
  151. package/legacy/ChartsXAxis/ChartsXAxis.js +13 -9
  152. package/legacy/ChartsYAxis/ChartsYAxis.js +2 -2
  153. package/legacy/Gauge/Gauge.js +146 -0
  154. package/legacy/Gauge/GaugeContainer.js +215 -0
  155. package/legacy/Gauge/GaugeProvider.js +87 -0
  156. package/legacy/Gauge/GaugeReferenceArc.js +37 -0
  157. package/legacy/Gauge/GaugeValueArc.js +44 -0
  158. package/legacy/Gauge/GaugeValueText.js +66 -0
  159. package/legacy/Gauge/gaugeClasses.js +7 -0
  160. package/legacy/Gauge/index.js +7 -0
  161. package/legacy/Gauge/utils.js +84 -0
  162. package/legacy/LineChart/AnimatedArea.js +1 -1
  163. package/legacy/LineChart/AnimatedLine.js +1 -1
  164. package/legacy/LineChart/AreaElement.js +1 -1
  165. package/legacy/LineChart/LineChart.js +41 -13
  166. package/legacy/LineChart/LineElement.js +1 -1
  167. package/legacy/LineChart/LineHighlightElement.js +2 -1
  168. package/legacy/LineChart/MarkElement.js +1 -0
  169. package/legacy/PieChart/PieArc.js +11 -10
  170. package/legacy/PieChart/PieArcLabel.js +1 -0
  171. package/legacy/PieChart/PieArcLabelPlot.js +15 -15
  172. package/legacy/PieChart/PieArcPlot.js +1 -1
  173. package/legacy/PieChart/PieChart.js +32 -8
  174. package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +13 -81
  175. package/legacy/ResponsiveChartContainer/useChartContainerDimensions.js +73 -0
  176. package/legacy/ScatterChart/ScatterChart.js +35 -8
  177. package/legacy/SparkLineChart/SparkLineChart.js +6 -5
  178. package/legacy/context/CartesianContextProvider.js +8 -6
  179. package/legacy/hooks/useTicks.js +2 -3
  180. package/legacy/index.js +3 -1
  181. package/models/axis.d.ts +7 -2
  182. package/models/seriesType/common.d.ts +2 -1
  183. package/models/seriesType/config.d.ts +7 -12
  184. package/models/seriesType/line.d.ts +2 -2
  185. package/models/seriesType/pie.d.ts +7 -3
  186. package/models/seriesType/scatter.d.ts +5 -2
  187. package/modern/BarChart/BarChart.js +37 -13
  188. package/modern/BarChart/BarElement.js +1 -0
  189. package/modern/BarChart/BarPlot.js +8 -10
  190. package/modern/ChartContainer/ChartContainer.js +6 -4
  191. package/modern/ChartsAxis/ChartsAxis.js +4 -4
  192. package/modern/ChartsGrid/ChartsGrid.js +121 -0
  193. package/modern/ChartsGrid/chartsGridClasses.js +6 -0
  194. package/modern/ChartsGrid/index.js +2 -0
  195. package/modern/ChartsLegend/ChartsLegend.js +2 -307
  196. package/modern/ChartsLegend/DefaultChartsLegend.js +286 -0
  197. package/modern/ChartsLegend/index.js +1 -0
  198. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
  199. package/modern/ChartsSurface.js +6 -4
  200. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
  201. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -2
  202. package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
  203. package/modern/ChartsTooltip/utils.js +6 -0
  204. package/modern/ChartsXAxis/ChartsXAxis.js +14 -10
  205. package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
  206. package/modern/Gauge/Gauge.js +149 -0
  207. package/modern/Gauge/GaugeContainer.js +208 -0
  208. package/modern/Gauge/GaugeProvider.js +85 -0
  209. package/modern/Gauge/GaugeReferenceArc.js +35 -0
  210. package/modern/Gauge/GaugeValueArc.js +42 -0
  211. package/modern/Gauge/GaugeValueText.js +69 -0
  212. package/modern/Gauge/gaugeClasses.js +7 -0
  213. package/modern/Gauge/index.js +7 -0
  214. package/modern/Gauge/utils.js +68 -0
  215. package/modern/LineChart/AnimatedArea.js +1 -1
  216. package/modern/LineChart/AnimatedLine.js +1 -1
  217. package/modern/LineChart/AreaElement.js +1 -1
  218. package/modern/LineChart/LineChart.js +41 -13
  219. package/modern/LineChart/LineElement.js +1 -1
  220. package/modern/LineChart/LineHighlightElement.js +2 -1
  221. package/modern/LineChart/MarkElement.js +1 -0
  222. package/modern/PieChart/PieArc.js +10 -9
  223. package/modern/PieChart/PieArcLabel.js +1 -0
  224. package/modern/PieChart/PieArcLabelPlot.js +14 -14
  225. package/modern/PieChart/PieArcPlot.js +1 -1
  226. package/modern/PieChart/PieChart.js +32 -8
  227. package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +8 -70
  228. package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
  229. package/modern/ScatterChart/ScatterChart.js +35 -8
  230. package/modern/SparkLineChart/SparkLineChart.js +5 -4
  231. package/modern/context/CartesianContextProvider.js +8 -6
  232. package/modern/hooks/useTicks.js +2 -3
  233. package/modern/index.js +3 -1
  234. package/package.json +4 -4
@@ -0,0 +1,44 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import * as React from 'react';
3
+ import { arc as d3Arc } from 'd3-shape';
4
+ import { styled } from '@mui/material/styles';
5
+ import { useGaugeState } from './GaugeProvider';
6
+ import { jsx as _jsx } from "react/jsx-runtime";
7
+ var StyledPath = styled('path', {
8
+ name: 'MuiGauge',
9
+ slot: 'ReferenceArc',
10
+ overridesResolver: function overridesResolver(props, styles) {
11
+ return styles.referenceArc;
12
+ }
13
+ })(function (_ref) {
14
+ var theme = _ref.theme;
15
+ return {
16
+ fill: (theme.vars || theme).palette.primary.main
17
+ };
18
+ });
19
+ export function GaugeValueArc(props) {
20
+ var _useGaugeState = useGaugeState(),
21
+ value = _useGaugeState.value,
22
+ valueMin = _useGaugeState.valueMin,
23
+ valueMax = _useGaugeState.valueMax,
24
+ startAngle = _useGaugeState.startAngle,
25
+ endAngle = _useGaugeState.endAngle,
26
+ outerRadius = _useGaugeState.outerRadius,
27
+ innerRadius = _useGaugeState.innerRadius,
28
+ cornerRadius = _useGaugeState.cornerRadius,
29
+ cx = _useGaugeState.cx,
30
+ cy = _useGaugeState.cy;
31
+ if (value === null) {
32
+ return null;
33
+ }
34
+ var valueAngle = startAngle + (value - valueMin) / (valueMax - valueMin) * (endAngle - startAngle);
35
+ return /*#__PURE__*/_jsx(StyledPath, _extends({
36
+ transform: "translate(".concat(cx, ", ").concat(cy, ")"),
37
+ d: d3Arc().cornerRadius(cornerRadius)({
38
+ startAngle: startAngle,
39
+ endAngle: valueAngle,
40
+ innerRadius: innerRadius,
41
+ outerRadius: outerRadius
42
+ })
43
+ }, props));
44
+ }
@@ -0,0 +1,66 @@
1
+ import _extends from "@babel/runtime/helpers/esm/extends";
2
+ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
+ var _excluded = ["text", "className"];
4
+ import * as React from 'react';
5
+ import PropTypes from 'prop-types';
6
+ import { useGaugeState } from './GaugeProvider';
7
+ import { ChartsText } from '../ChartsText';
8
+ import { jsx as _jsx } from "react/jsx-runtime";
9
+ function defaultFormatter(_ref) {
10
+ var value = _ref.value;
11
+ return value === null ? 'NaN' : value.toLocaleString();
12
+ }
13
+ function GaugeValueText(props) {
14
+ var _props$text = props.text,
15
+ text = _props$text === void 0 ? defaultFormatter : _props$text,
16
+ className = props.className,
17
+ other = _objectWithoutProperties(props, _excluded);
18
+ var _useGaugeState = useGaugeState(),
19
+ value = _useGaugeState.value,
20
+ valueMin = _useGaugeState.valueMin,
21
+ valueMax = _useGaugeState.valueMax,
22
+ cx = _useGaugeState.cx,
23
+ cy = _useGaugeState.cy;
24
+ var formattedText = typeof text === 'function' ? text({
25
+ value: value,
26
+ valueMin: valueMin,
27
+ valueMax: valueMax
28
+ }) : text;
29
+ if (formattedText === null) {
30
+ return null;
31
+ }
32
+ return /*#__PURE__*/_jsx("g", {
33
+ className: className,
34
+ children: /*#__PURE__*/_jsx(ChartsText, _extends({
35
+ x: cx,
36
+ y: cy,
37
+ text: formattedText,
38
+ style: {
39
+ textAnchor: 'middle',
40
+ dominantBaseline: 'central'
41
+ }
42
+ }, other))
43
+ });
44
+ }
45
+ process.env.NODE_ENV !== "production" ? GaugeValueText.propTypes = {
46
+ // ----------------------------- Warning --------------------------------
47
+ // | These PropTypes are generated from the TypeScript type definitions |
48
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
49
+ // ----------------------------------------------------------------------
50
+ /**
51
+ * Height of a text line (in `em`).
52
+ */
53
+ lineHeight: PropTypes.number,
54
+ /**
55
+ * If `true`, the line width is computed.
56
+ * @default false
57
+ */
58
+ needsComputation: PropTypes.bool,
59
+ ownerState: PropTypes.any,
60
+ /**
61
+ * Style applied to text elements.
62
+ */
63
+ style: PropTypes.object,
64
+ text: PropTypes.oneOfType([PropTypes.func, PropTypes.string])
65
+ } : void 0;
66
+ export { GaugeValueText };
@@ -0,0 +1,7 @@
1
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
2
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
3
+ export function getGaugeUtilityClass(slot) {
4
+ return generateUtilityClass('MuiGauge', slot);
5
+ }
6
+ export var gaugeClasses = generateUtilityClasses('MuiGauge', ['root', 'valueArc', 'referenceArc', 'valueText']);
7
+ export default gaugeClasses;
@@ -0,0 +1,7 @@
1
+ export * from './Gauge';
2
+ export * from './GaugeContainer';
3
+ export * from './GaugeValueText';
4
+ export * from './GaugeValueArc';
5
+ export * from './GaugeReferenceArc';
6
+ export * from './gaugeClasses';
7
+ export { useGaugeState } from './GaugeProvider';
@@ -0,0 +1,84 @@
1
+ import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
2
+ import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
3
+ function deg2rad(angle) {
4
+ return Math.PI * angle / 180;
5
+ }
6
+ function getPoint(angle) {
7
+ var radAngle = deg2rad(angle);
8
+ return [Math.sin(radAngle), -Math.cos(radAngle)];
9
+ }
10
+
11
+ /**
12
+ * Retruns the ratio of the arc bounding box and its center.
13
+ * @param startAngle The start angle (in deg)
14
+ * @param endAngle The end angle (in deg)
15
+ */
16
+ export function getArcRatios(startAngle, endAngle) {
17
+ // Set the start, end and center point.
18
+ var points = [[0, 0], getPoint(startAngle), getPoint(endAngle)];
19
+
20
+ // Add cardinal points included in the arc
21
+ var minAngle = Math.min(startAngle, endAngle);
22
+ var maxAngle = Math.max(startAngle, endAngle);
23
+ var initialAngle = Math.floor(minAngle / 90) * 90;
24
+ for (var step = 1; step <= 4; step += 1) {
25
+ var cartinalAngle = initialAngle + step * 90;
26
+ if (cartinalAngle < maxAngle) {
27
+ points.push(getPoint(cartinalAngle));
28
+ }
29
+ }
30
+ var minX = Math.min.apply(Math, _toConsumableArray(points.map(function (_ref) {
31
+ var _ref2 = _slicedToArray(_ref, 1),
32
+ x = _ref2[0];
33
+ return x;
34
+ })));
35
+ var maxX = Math.max.apply(Math, _toConsumableArray(points.map(function (_ref3) {
36
+ var _ref4 = _slicedToArray(_ref3, 1),
37
+ x = _ref4[0];
38
+ return x;
39
+ })));
40
+ var minY = Math.min.apply(Math, _toConsumableArray(points.map(function (_ref5) {
41
+ var _ref6 = _slicedToArray(_ref5, 2),
42
+ y = _ref6[1];
43
+ return y;
44
+ })));
45
+ var maxY = Math.max.apply(Math, _toConsumableArray(points.map(function (_ref7) {
46
+ var _ref8 = _slicedToArray(_ref7, 2),
47
+ y = _ref8[1];
48
+ return y;
49
+ })));
50
+ return {
51
+ cx: -minX / (maxX - minX),
52
+ cy: -minY / (maxY - minY),
53
+ minX: minX,
54
+ maxX: maxX,
55
+ minY: minY,
56
+ maxY: maxY
57
+ };
58
+ }
59
+ export function getAvailableRadius(cx, cy, width, height, _ref9) {
60
+ var minX = _ref9.minX,
61
+ maxX = _ref9.maxX,
62
+ minY = _ref9.minY,
63
+ maxY = _ref9.maxY;
64
+ return Math.min.apply(Math, _toConsumableArray([{
65
+ ratio: Math.abs(minX),
66
+ space: cx
67
+ }, {
68
+ ratio: Math.abs(maxX),
69
+ space: width - cx
70
+ }, {
71
+ ratio: Math.abs(minY),
72
+ space: cy
73
+ }, {
74
+ ratio: Math.abs(maxY),
75
+ space: height - cy
76
+ }].map(function (_ref10) {
77
+ var ratio = _ref10.ratio,
78
+ space = _ref10.space;
79
+ if (ratio < 0.00001) {
80
+ return Infinity;
81
+ }
82
+ return space / ratio;
83
+ })));
84
+ }
@@ -89,7 +89,7 @@ process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
89
89
  ownerState: PropTypes.shape({
90
90
  classes: PropTypes.object,
91
91
  color: PropTypes.string.isRequired,
92
- id: PropTypes.string.isRequired,
92
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
93
93
  isFaded: PropTypes.bool.isRequired,
94
94
  isHighlighted: PropTypes.bool.isRequired
95
95
  }).isRequired,
@@ -91,7 +91,7 @@ process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
91
91
  ownerState: PropTypes.shape({
92
92
  classes: PropTypes.object,
93
93
  color: PropTypes.string.isRequired,
94
- id: PropTypes.string.isRequired,
94
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
95
95
  isFaded: PropTypes.bool.isRequired,
96
96
  isHighlighted: PropTypes.bool.isRequired
97
97
  }).isRequired,
@@ -92,7 +92,7 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
92
92
  faded: PropTypes.oneOf(['global', 'none', 'series']),
93
93
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
94
94
  }),
95
- id: PropTypes.string.isRequired,
95
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
96
96
  /**
97
97
  * If `true`, animations are skipped.
98
98
  * @default false
@@ -14,6 +14,7 @@ import { ChartsLegend } from '../ChartsLegend';
14
14
  import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
15
15
  import { ChartsClipPath } from '../ChartsClipPath';
16
16
  import { LineHighlightPlot } from './LineHighlightPlot';
17
+ import { ChartsGrid } from '../ChartsGrid';
17
18
  import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
18
19
  import { jsx as _jsx } from "react/jsx-runtime";
19
20
  import { jsxs as _jsxs } from "react/jsx-runtime";
@@ -48,6 +49,7 @@ var LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
48
49
  } : _props$axisHighlight,
49
50
  disableLineItemHighlight = props.disableLineItemHighlight,
50
51
  legend = props.legend,
52
+ grid = props.grid,
51
53
  topAxis = props.topAxis,
52
54
  leftAxis = props.leftAxis,
53
55
  rightAxis = props.rightAxis,
@@ -88,6 +90,9 @@ var LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
88
90
  disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none' && !onAxisClick,
89
91
  children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
90
92
  onAxisClick: onAxisClick
93
+ }), grid && /*#__PURE__*/_jsx(ChartsGrid, {
94
+ vertical: grid.vertical,
95
+ horizontal: grid.horizontal
91
96
  }), /*#__PURE__*/_jsxs("g", {
92
97
  clipPath: "url(#".concat(clipPathId, ")"),
93
98
  children: [/*#__PURE__*/_jsx(AreaPlot, {
@@ -133,11 +138,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
133
138
  // | To update them edit the TypeScript types and run "yarn proptypes" |
134
139
  // ----------------------------------------------------------------------
135
140
  /**
136
- * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
137
- * The two properties accept the following values:
138
- * - 'none': display nothing.
139
- * - 'line': display a line at the current mouse position.
140
- * - 'band': display a band at the current mouse position. Only available with band scale.
141
+ * The configuration of axes highlight.
142
+ * @see See {@link https://mui.com/x/react-charts/tooltip/#highlights highlight docs} for more details.
141
143
  * @default { x: 'line' }
142
144
  */
143
145
  axisHighlight: PropTypes.shape({
@@ -150,7 +152,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
150
152
  * @default xAxisIds[0] The id of the first provided axis
151
153
  */
152
154
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
153
- axisId: PropTypes.string,
155
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
154
156
  classes: PropTypes.object,
155
157
  disableLine: PropTypes.bool,
156
158
  disableTicks: PropTypes.bool,
@@ -193,6 +195,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
193
195
  * If `true`, render the line highlight item.
194
196
  */
195
197
  disableLineItemHighlight: PropTypes.bool,
198
+ /**
199
+ * Option to display a cartesian grid in the background.
200
+ */
201
+ grid: PropTypes.shape({
202
+ horizontal: PropTypes.bool,
203
+ vertical: PropTypes.bool
204
+ }),
196
205
  /**
197
206
  * The height of the chart in px. If not defined, it takes the height of the parent element.
198
207
  * @default undefined
@@ -204,7 +213,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
204
213
  * @default yAxisIds[0] The id of the first provided axis
205
214
  */
206
215
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
207
- axisId: PropTypes.string,
216
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
208
217
  classes: PropTypes.object,
209
218
  disableLine: PropTypes.bool,
210
219
  disableTicks: PropTypes.bool,
@@ -251,6 +260,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
251
260
  right: PropTypes.number,
252
261
  top: PropTypes.number
253
262
  }),
263
+ /**
264
+ * Callback fired when an area element is clicked.
265
+ */
254
266
  onAreaClick: PropTypes.func,
255
267
  /**
256
268
  * The function called for onClick events.
@@ -259,7 +271,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
259
271
  * @param {null | AxisData} data The data about the clicked axis and items associated with it.
260
272
  */
261
273
  onAxisClick: PropTypes.func,
274
+ /**
275
+ * Callback fired when a line element is clicked.
276
+ */
262
277
  onLineClick: PropTypes.func,
278
+ /**
279
+ * Callback fired when a mark element is clicked.
280
+ */
263
281
  onMarkClick: PropTypes.func,
264
282
  /**
265
283
  * Indicate which axis to display the right of the charts.
@@ -267,7 +285,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
267
285
  * @default null
268
286
  */
269
287
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
270
- axisId: PropTypes.string,
288
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
271
289
  classes: PropTypes.object,
272
290
  disableLine: PropTypes.bool,
273
291
  disableTicks: PropTypes.bool,
@@ -288,6 +306,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
288
306
  tickNumber: PropTypes.number,
289
307
  tickSize: PropTypes.number
290
308
  }), PropTypes.string]),
309
+ /**
310
+ * The series to display in the line chart.
311
+ */
291
312
  series: PropTypes.arrayOf(PropTypes.object).isRequired,
292
313
  /**
293
314
  * If `true`, animations are skipped.
@@ -306,6 +327,11 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
306
327
  slots: PropTypes.object,
307
328
  sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
308
329
  title: PropTypes.string,
330
+ /**
331
+ * The configuration of the tooltip.
332
+ * @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
333
+ * @default { trigger: 'item' }
334
+ */
309
335
  tooltip: PropTypes.shape({
310
336
  axisContent: PropTypes.elementType,
311
337
  classes: PropTypes.object,
@@ -320,7 +346,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
320
346
  * @default null
321
347
  */
322
348
  topAxis: PropTypes.oneOfType([PropTypes.shape({
323
- axisId: PropTypes.string,
349
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
324
350
  classes: PropTypes.object,
325
351
  disableLine: PropTypes.bool,
326
352
  disableTicks: PropTypes.bool,
@@ -357,7 +383,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
357
383
  * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
358
384
  */
359
385
  xAxis: PropTypes.arrayOf(PropTypes.shape({
360
- axisId: PropTypes.string,
386
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
361
387
  classes: PropTypes.object,
362
388
  data: PropTypes.array,
363
389
  dataKey: PropTypes.string,
@@ -365,13 +391,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
365
391
  disableTicks: PropTypes.bool,
366
392
  fill: PropTypes.string,
367
393
  hideTooltip: PropTypes.bool,
368
- id: PropTypes.string,
394
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
369
395
  label: PropTypes.string,
370
396
  labelFontSize: PropTypes.number,
371
397
  labelStyle: PropTypes.object,
372
398
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
373
399
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
374
400
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
401
+ reverse: PropTypes.bool,
375
402
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
376
403
  slotProps: PropTypes.object,
377
404
  slots: PropTypes.object,
@@ -391,7 +418,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
391
418
  * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
392
419
  */
393
420
  yAxis: PropTypes.arrayOf(PropTypes.shape({
394
- axisId: PropTypes.string,
421
+ axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
395
422
  classes: PropTypes.object,
396
423
  data: PropTypes.array,
397
424
  dataKey: PropTypes.string,
@@ -399,13 +426,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
399
426
  disableTicks: PropTypes.bool,
400
427
  fill: PropTypes.string,
401
428
  hideTooltip: PropTypes.bool,
402
- id: PropTypes.string,
429
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
403
430
  label: PropTypes.string,
404
431
  labelFontSize: PropTypes.number,
405
432
  labelStyle: PropTypes.object,
406
433
  max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
407
434
  min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
408
435
  position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
436
+ reverse: PropTypes.bool,
409
437
  scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
410
438
  slotProps: PropTypes.object,
411
439
  slots: PropTypes.object,
@@ -92,7 +92,7 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
92
92
  faded: PropTypes.oneOf(['global', 'none', 'series']),
93
93
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
94
94
  }),
95
- id: PropTypes.string.isRequired,
95
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
96
96
  /**
97
97
  * If `true`, animations are skipped.
98
98
  * @default false
@@ -73,6 +73,7 @@ process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
73
73
  // | These PropTypes are generated from the TypeScript type definitions |
74
74
  // | To update them edit the TypeScript types and run "yarn proptypes" |
75
75
  // ----------------------------------------------------------------------
76
- classes: PropTypes.object
76
+ classes: PropTypes.object,
77
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
77
78
  } : void 0;
78
79
  export { LineHighlightElement };
@@ -139,6 +139,7 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
139
139
  faded: PropTypes.oneOf(['global', 'none', 'series']),
140
140
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
141
141
  }),
142
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
142
143
  /**
143
144
  * The shape of the marker.
144
145
  */
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "onClick", "isFaded", "isHighlighted", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
3
+ var _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "highlightScope", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle"];
4
4
  import * as React from 'react';
5
5
  import PropTypes from 'prop-types';
6
6
  import { arc as d3Arc } from 'd3-shape';
@@ -40,20 +40,20 @@ var PieArcRoot = styled(animated.path, {
40
40
  };
41
41
  });
42
42
  function PieArc(props) {
43
- var id = props.id,
44
- dataIndex = props.dataIndex,
45
- innerClasses = props.classes,
43
+ var innerClasses = props.classes,
46
44
  color = props.color,
45
+ cornerRadius = props.cornerRadius,
46
+ dataIndex = props.dataIndex,
47
+ endAngle = props.endAngle,
47
48
  highlightScope = props.highlightScope,
48
- onClick = props.onClick,
49
+ id = props.id,
50
+ innerRadius = props.innerRadius,
49
51
  isFaded = props.isFaded,
50
52
  isHighlighted = props.isHighlighted,
51
- startAngle = props.startAngle,
52
- endAngle = props.endAngle,
53
- paddingAngle = props.paddingAngle,
54
- innerRadius = props.innerRadius,
53
+ onClick = props.onClick,
55
54
  outerRadius = props.outerRadius,
56
- cornerRadius = props.cornerRadius,
55
+ paddingAngle = props.paddingAngle,
56
+ startAngle = props.startAngle,
57
57
  other = _objectWithoutProperties(props, _excluded);
58
58
  var ownerState = {
59
59
  id: id,
@@ -96,6 +96,7 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
96
96
  faded: PropTypes.oneOf(['global', 'none', 'series']),
97
97
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
98
98
  }),
99
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
99
100
  isFaded: PropTypes.bool.isRequired,
100
101
  isHighlighted: PropTypes.bool.isRequired
101
102
  } : void 0;
@@ -105,6 +105,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
105
105
  // ----------------------------------------------------------------------
106
106
  classes: PropTypes.object,
107
107
  formattedArcLabel: PropTypes.string,
108
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
108
109
  isFaded: PropTypes.bool.isRequired,
109
110
  isHighlighted: PropTypes.bool.isRequired
110
111
  } : void 0;
@@ -1,6 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
- var _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
3
+ var _excluded = ["arcLabel", "arcLabelMinAngle", "arcLabelRadius", "cornerRadius", "data", "faded", "highlighted", "highlightScope", "id", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation", "slotProps", "slots"],
4
4
  _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
5
5
  import * as React from 'react';
6
6
  import PropTypes from 'prop-types';
@@ -26,27 +26,27 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
26
26
  }
27
27
  function PieArcLabelPlot(props) {
28
28
  var _slots$pieArcLabel;
29
- var slots = props.slots,
30
- slotProps = props.slotProps,
31
- innerRadius = props.innerRadius,
32
- outerRadius = props.outerRadius,
29
+ var arcLabel = props.arcLabel,
30
+ _props$arcLabelMinAng = props.arcLabelMinAngle,
31
+ arcLabelMinAngle = _props$arcLabelMinAng === void 0 ? 0 : _props$arcLabelMinAng,
33
32
  arcLabelRadius = props.arcLabelRadius,
34
33
  _props$cornerRadius = props.cornerRadius,
35
34
  cornerRadius = _props$cornerRadius === void 0 ? 0 : _props$cornerRadius,
36
- _props$paddingAngle = props.paddingAngle,
37
- paddingAngle = _props$paddingAngle === void 0 ? 0 : _props$paddingAngle,
38
- id = props.id,
39
- highlightScope = props.highlightScope,
40
- highlighted = props.highlighted,
35
+ data = props.data,
41
36
  _props$faded = props.faded,
42
37
  faded = _props$faded === void 0 ? {
43
38
  additionalRadius: -5
44
39
  } : _props$faded,
45
- data = props.data,
46
- arcLabel = props.arcLabel,
47
- _props$arcLabelMinAng = props.arcLabelMinAngle,
48
- arcLabelMinAngle = _props$arcLabelMinAng === void 0 ? 0 : _props$arcLabelMinAng,
40
+ highlighted = props.highlighted,
41
+ highlightScope = props.highlightScope,
42
+ id = props.id,
43
+ innerRadius = props.innerRadius,
44
+ outerRadius = props.outerRadius,
45
+ _props$paddingAngle = props.paddingAngle,
46
+ paddingAngle = _props$paddingAngle === void 0 ? 0 : _props$paddingAngle,
49
47
  skipAnimation = props.skipAnimation,
48
+ slotProps = props.slotProps,
49
+ slots = props.slots,
50
50
  other = _objectWithoutProperties(props, _excluded);
51
51
  var transformedData = useTransformData({
52
52
  innerRadius: innerRadius,
@@ -159,7 +159,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
159
159
  faded: PropTypes.oneOf(['global', 'none', 'series']),
160
160
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
161
161
  }),
162
- id: PropTypes.string.isRequired,
162
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
163
163
  /**
164
164
  * The radius between circle center and the begining of the arc.
165
165
  * @default 0
@@ -139,7 +139,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
139
139
  faded: PropTypes.oneOf(['global', 'none', 'series']),
140
140
  highlighted: PropTypes.oneOf(['item', 'none', 'series'])
141
141
  }),
142
- id: PropTypes.string.isRequired,
142
+ id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
143
143
  /**
144
144
  * The radius between circle center and the begining of the arc.
145
145
  * @default 0