@mui/x-charts 6.18.0 → 6.18.2

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 (182) hide show
  1. package/BarChart/BarChart.d.ts +7 -0
  2. package/BarChart/BarChart.js +41 -4
  3. package/CHANGELOG.md +116 -5
  4. package/ChartsAxis/ChartsAxis.js +5 -5
  5. package/ChartsAxis/axisClasses.d.ts +2 -2
  6. package/ChartsLegend/ChartsLegend.d.ts +1 -0
  7. package/ChartsLegend/ChartsLegend.js +1 -1
  8. package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
  9. package/ChartsLegend/chartsLegendClasses.js +2 -2
  10. package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
  11. package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
  12. package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
  13. package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
  14. package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
  15. package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
  16. package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
  17. package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
  18. package/ChartsReferenceLine/common.d.ts +41 -0
  19. package/ChartsReferenceLine/common.js +27 -0
  20. package/ChartsReferenceLine/index.d.ts +2 -0
  21. package/ChartsReferenceLine/index.js +27 -0
  22. package/ChartsReferenceLine/package.json +6 -0
  23. package/ChartsSurface.d.ts +11 -0
  24. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
  25. package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  26. package/ChartsTooltip/ChartsItemTooltipContent.d.ts +1 -1
  27. package/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  28. package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
  29. package/ChartsTooltip/ChartsTooltip.js +13 -5
  30. package/ChartsTooltip/ChartsTooltipTable.js +3 -3
  31. package/ChartsTooltip/chartsTooltipClasses.d.ts +21 -0
  32. package/ChartsTooltip/chartsTooltipClasses.js +12 -0
  33. package/ChartsTooltip/index.d.ts +1 -0
  34. package/ChartsTooltip/index.js +11 -0
  35. package/ChartsTooltip/utils.d.ts +1 -1
  36. package/ChartsTooltip/utils.js +2 -2
  37. package/ChartsXAxis/ChartsXAxis.js +9 -5
  38. package/ChartsYAxis/ChartsYAxis.js +9 -5
  39. package/LineChart/LineChart.d.ts +7 -0
  40. package/LineChart/LineChart.js +41 -4
  41. package/LineChart/LineHighlightPlot.js +1 -1
  42. package/LineChart/MarkPlot.js +2 -1
  43. package/PieChart/PieArc.d.ts +5 -2
  44. package/PieChart/PieArc.js +17 -2
  45. package/PieChart/PieArcLabel.d.ts +1 -1
  46. package/PieChart/PieArcLabel.js +5 -10
  47. package/PieChart/PieArcLabelPlot.js +2 -2
  48. package/PieChart/PieArcPlot.js +2 -2
  49. package/PieChart/PieChart.js +34 -4
  50. package/PieChart/index.d.ts +4 -2
  51. package/PieChart/index.js +37 -27
  52. package/ResponsiveChartContainer/index.d.ts +13 -3
  53. package/ScatterChart/ScatterChart.js +34 -4
  54. package/SparkLineChart/SparkLineChart.js +22 -0
  55. package/context/CartesianContextProvider.d.ts +21 -1
  56. package/context/CartesianContextProvider.js +11 -0
  57. package/context/DrawingProvider.d.ts +18 -0
  58. package/context/DrawingProvider.js +6 -0
  59. package/context/HighlightProvider.d.ts +17 -0
  60. package/context/InteractionProvider.d.ts +6 -0
  61. package/context/SeriesContextProvider.d.ts +5 -0
  62. package/esm/BarChart/BarChart.js +41 -4
  63. package/esm/ChartsAxis/ChartsAxis.js +6 -5
  64. package/esm/ChartsLegend/ChartsLegend.js +2 -2
  65. package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
  66. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  67. package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  68. package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  69. package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  70. package/esm/ChartsReferenceLine/common.js +20 -0
  71. package/esm/ChartsReferenceLine/index.js +2 -0
  72. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  73. package/esm/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  74. package/esm/ChartsTooltip/ChartsTooltip.js +15 -7
  75. package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -3
  76. package/esm/ChartsTooltip/chartsTooltipClasses.js +5 -0
  77. package/esm/ChartsTooltip/index.js +2 -1
  78. package/esm/ChartsTooltip/utils.js +1 -1
  79. package/esm/ChartsXAxis/ChartsXAxis.js +10 -6
  80. package/esm/ChartsYAxis/ChartsYAxis.js +10 -6
  81. package/esm/LineChart/LineChart.js +41 -4
  82. package/esm/LineChart/LineHighlightPlot.js +1 -1
  83. package/esm/LineChart/MarkPlot.js +2 -1
  84. package/esm/PieChart/PieArc.js +18 -2
  85. package/esm/PieChart/PieArcLabel.js +7 -11
  86. package/esm/PieChart/PieArcLabelPlot.js +1 -1
  87. package/esm/PieChart/PieArcPlot.js +1 -1
  88. package/esm/PieChart/PieChart.js +34 -4
  89. package/esm/PieChart/index.js +2 -2
  90. package/esm/ScatterChart/ScatterChart.js +34 -4
  91. package/esm/SparkLineChart/SparkLineChart.js +22 -0
  92. package/esm/context/CartesianContextProvider.js +11 -0
  93. package/esm/context/DrawingProvider.js +6 -0
  94. package/esm/index.js +1 -0
  95. package/esm/internals/geometry.js +2 -2
  96. package/hooks/useScale.d.ts +2 -2
  97. package/index.d.ts +1 -0
  98. package/index.js +12 -1
  99. package/internals/components/ChartsText.d.ts +1 -1
  100. package/internals/geometry.d.ts +2 -2
  101. package/internals/geometry.js +2 -2
  102. package/internals/isBandScale.d.ts +3 -1
  103. package/internals/utils.d.ts +5 -0
  104. package/legacy/BarChart/BarChart.js +41 -4
  105. package/legacy/ChartsAxis/ChartsAxis.js +6 -5
  106. package/legacy/ChartsLegend/ChartsLegend.js +2 -2
  107. package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
  108. package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  109. package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
  110. package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
  111. package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  112. package/legacy/ChartsReferenceLine/common.js +20 -0
  113. package/legacy/ChartsReferenceLine/index.js +2 -0
  114. package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  115. package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  116. package/legacy/ChartsTooltip/ChartsTooltip.js +20 -12
  117. package/legacy/ChartsTooltip/ChartsTooltipTable.js +3 -3
  118. package/legacy/ChartsTooltip/chartsTooltipClasses.js +5 -0
  119. package/legacy/ChartsTooltip/index.js +2 -1
  120. package/legacy/ChartsTooltip/utils.js +1 -1
  121. package/legacy/ChartsXAxis/ChartsXAxis.js +15 -12
  122. package/legacy/ChartsYAxis/ChartsYAxis.js +15 -12
  123. package/legacy/LineChart/LineChart.js +41 -4
  124. package/legacy/LineChart/LineHighlightPlot.js +1 -1
  125. package/legacy/LineChart/MarkPlot.js +2 -1
  126. package/legacy/PieChart/PieArc.js +18 -2
  127. package/legacy/PieChart/PieArcLabel.js +7 -11
  128. package/legacy/PieChart/PieArcLabelPlot.js +1 -1
  129. package/legacy/PieChart/PieArcPlot.js +1 -1
  130. package/legacy/PieChart/PieChart.js +34 -4
  131. package/legacy/PieChart/index.js +2 -2
  132. package/legacy/ScatterChart/ScatterChart.js +34 -4
  133. package/legacy/SparkLineChart/SparkLineChart.js +22 -0
  134. package/legacy/context/CartesianContextProvider.js +11 -0
  135. package/legacy/context/DrawingProvider.js +6 -0
  136. package/legacy/index.js +2 -1
  137. package/legacy/internals/geometry.js +2 -2
  138. package/models/axis.d.ts +33 -13
  139. package/models/layout.d.ts +6 -0
  140. package/models/seriesType/common.d.ts +16 -0
  141. package/modern/BarChart/BarChart.js +41 -4
  142. package/modern/ChartsAxis/ChartsAxis.js +5 -5
  143. package/modern/ChartsLegend/ChartsLegend.js +2 -2
  144. package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
  145. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
  146. package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
  147. package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
  148. package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
  149. package/modern/ChartsReferenceLine/common.js +20 -0
  150. package/modern/ChartsReferenceLine/index.js +2 -0
  151. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -4
  152. package/modern/ChartsTooltip/ChartsItemTooltipContent.js +8 -4
  153. package/modern/ChartsTooltip/ChartsTooltip.js +15 -7
  154. package/modern/ChartsTooltip/ChartsTooltipTable.js +3 -3
  155. package/modern/ChartsTooltip/chartsTooltipClasses.js +5 -0
  156. package/modern/ChartsTooltip/index.js +2 -1
  157. package/modern/ChartsTooltip/utils.js +1 -1
  158. package/modern/ChartsXAxis/ChartsXAxis.js +9 -5
  159. package/modern/ChartsYAxis/ChartsYAxis.js +9 -5
  160. package/modern/LineChart/LineChart.js +41 -4
  161. package/modern/LineChart/LineHighlightPlot.js +1 -1
  162. package/modern/LineChart/MarkPlot.js +2 -1
  163. package/modern/PieChart/PieArc.js +18 -2
  164. package/modern/PieChart/PieArcLabel.js +7 -11
  165. package/modern/PieChart/PieArcLabelPlot.js +1 -1
  166. package/modern/PieChart/PieArcPlot.js +1 -1
  167. package/modern/PieChart/PieChart.js +34 -4
  168. package/modern/PieChart/index.js +2 -2
  169. package/modern/ScatterChart/ScatterChart.js +34 -4
  170. package/modern/SparkLineChart/SparkLineChart.js +22 -0
  171. package/modern/context/CartesianContextProvider.js +11 -0
  172. package/modern/context/DrawingProvider.js +6 -0
  173. package/modern/index.js +2 -1
  174. package/modern/internals/geometry.js +2 -2
  175. package/package.json +1 -1
  176. package/themeAugmentation/components.d.ts +1 -0
  177. package/themeAugmentation/overrides.d.ts +2 -0
  178. package/ChartsTooltip/tooltipClasses.d.ts +0 -13
  179. package/ChartsTooltip/tooltipClasses.js +0 -12
  180. package/esm/ChartsTooltip/tooltipClasses.js +0 -5
  181. package/legacy/ChartsTooltip/tooltipClasses.js +0 -5
  182. package/modern/ChartsTooltip/tooltipClasses.js +0 -5
@@ -0,0 +1,6 @@
1
+ import generateUtilityClass from '@mui/utils/generateUtilityClass';
2
+ import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
3
+ export function getReferenceLineUtilityClass(slot) {
4
+ return generateUtilityClass('MuiChartsReferenceLine', slot);
5
+ }
6
+ export var referenceLineClasses = generateUtilityClasses('MuiChartsReferenceLine', ['root', 'vertical', 'horizontal', 'line', 'label']);
@@ -0,0 +1,20 @@
1
+ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ import { styled } from '@mui/material/styles';
4
+ import { referenceLineClasses } from './chartsReferenceLineClasses';
5
+ export var ReferenceLineRoot = styled('g')(function (_ref) {
6
+ var _ref2;
7
+ var theme = _ref.theme;
8
+ return _ref2 = {}, _defineProperty(_ref2, "& .".concat(referenceLineClasses.line), {
9
+ fill: 'none',
10
+ stroke: (theme.vars || theme).palette.text.primary,
11
+ shapeRendering: 'crispEdges',
12
+ strokeWidth: 1,
13
+ pointerEvents: 'none'
14
+ }), _defineProperty(_ref2, "& .".concat(referenceLineClasses.label), _extends({
15
+ fill: (theme.vars || theme).palette.text.primary,
16
+ stroke: 'none',
17
+ pointerEvents: 'none',
18
+ fontSize: 12
19
+ }, theme.typography.body1)), _ref2;
20
+ });
@@ -0,0 +1,2 @@
1
+ export * from './ChartsReferenceLine';
2
+ export * from './chartsReferenceLineClasses';
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import clsx from 'clsx';
3
4
  import Typography from '@mui/material/Typography';
4
5
  import { useSlotProps } from '@mui/base/utils';
5
6
  import { SeriesContext } from '../context/SeriesContextProvider';
@@ -25,6 +26,7 @@ export function DefaultChartsAxisContent(props) {
25
26
  sx: sx,
26
27
  className: classes.root,
27
28
  children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
29
+ className: classes.table,
28
30
  children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
29
31
  children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
30
32
  children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
@@ -46,21 +48,23 @@ export function DefaultChartsAxisContent(props) {
46
48
  return null;
47
49
  }
48
50
  return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
51
+ className: classes.row,
49
52
  children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
50
- className: classes.markCell,
53
+ className: clsx(classes.markCell, classes.cell),
51
54
  children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
52
55
  ownerState: {
53
56
  color: color
54
57
  },
55
- boxShadow: 1
58
+ boxShadow: 1,
59
+ className: classes.mark
56
60
  })
57
61
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
58
- className: classes.labelCell,
62
+ className: clsx(classes.labelCell, classes.cell),
59
63
  children: label ? /*#__PURE__*/_jsx(Typography, {
60
64
  children: label
61
65
  }) : null
62
66
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
63
- className: classes.valueCell,
67
+ className: clsx(classes.valueCell, classes.cell),
64
68
  children: /*#__PURE__*/_jsx(Typography, {
65
69
  children: formattedValue
66
70
  })
@@ -1,5 +1,6 @@
1
1
  import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
+ import clsx from 'clsx';
3
4
  import { useSlotProps } from '@mui/base/utils';
4
5
  import { SeriesContext } from '../context/SeriesContextProvider';
5
6
  import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
@@ -30,20 +31,23 @@ export function DefaultChartsItemContent(props) {
30
31
  sx: sx,
31
32
  className: classes.root,
32
33
  children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
34
+ className: classes.table,
33
35
  children: /*#__PURE__*/_jsx("tbody", {
34
36
  children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
37
+ className: classes.row,
35
38
  children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
36
- className: classes.markCell,
39
+ className: clsx(classes.markCell, classes.cell),
37
40
  children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
38
41
  ownerState: {
39
42
  color: color
40
- }
43
+ },
44
+ className: classes.mark
41
45
  })
42
46
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
43
- className: classes.labelCell,
47
+ className: clsx(classes.labelCell, classes.cell),
44
48
  children: displayedLabel
45
49
  }), /*#__PURE__*/_jsx(ChartsTooltipCell, {
46
- className: classes.valueCell,
50
+ className: clsx(classes.valueCell, classes.cell),
47
51
  children: formattedValue
48
52
  })]
49
53
  })
@@ -2,25 +2,29 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import * as React from 'react';
3
3
  import PropTypes from 'prop-types';
4
4
  import composeClasses from '@mui/utils/composeClasses';
5
- import { styled } from '@mui/material/styles';
5
+ import { styled, useThemeProps } from '@mui/material/styles';
6
6
  import { Popper } from '@mui/base/Popper';
7
7
  import { NoSsr } from '@mui/base/NoSsr';
8
8
  import { useSlotProps } from '@mui/base/utils';
9
9
  import { InteractionContext } from '../context/InteractionProvider';
10
- import { generateVirtualElement, useMouseTracker, getTootipHasData } from './utils';
10
+ import { generateVirtualElement, useMouseTracker, getTooltipHasData } from './utils';
11
11
  import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
12
12
  import { ChartsAxisTooltipContent } from './ChartsAxisTooltipContent';
13
- import { getTooltipUtilityClass } from './tooltipClasses';
13
+ import { getChartsTooltipUtilityClass } from './chartsTooltipClasses';
14
14
  import { jsx as _jsx } from "react/jsx-runtime";
15
15
  var useUtilityClasses = function useUtilityClasses(ownerState) {
16
16
  var classes = ownerState.classes;
17
17
  var slots = {
18
18
  root: ['root'],
19
+ table: ['table'],
20
+ row: ['row'],
21
+ cell: ['cell'],
22
+ mark: ['mark'],
19
23
  markCell: ['markCell'],
20
24
  labelCell: ['labelCell'],
21
25
  valueCell: ['valueCell']
22
26
  };
23
- return composeClasses(slots, getTooltipUtilityClass, classes);
27
+ return composeClasses(slots, getChartsTooltipUtilityClass, classes);
24
28
  };
25
29
  var ChartsTooltipRoot = styled(Popper, {
26
30
  name: 'MuiChartsTooltip',
@@ -47,21 +51,25 @@ var ChartsTooltipRoot = styled(Popper, {
47
51
  */
48
52
  function ChartsTooltip(props) {
49
53
  var _slots$popper, _slots$itemContent, _slots$axisContent;
50
- var _props$trigger = props.trigger,
51
- trigger = _props$trigger === void 0 ? 'axis' : _props$trigger,
52
- itemContent = props.itemContent,
53
- axisContent = props.axisContent,
54
- slots = props.slots,
55
- slotProps = props.slotProps;
54
+ var themeProps = useThemeProps({
55
+ props: props,
56
+ name: 'MuiChartsTooltip'
57
+ });
58
+ var _themeProps$trigger = themeProps.trigger,
59
+ trigger = _themeProps$trigger === void 0 ? 'axis' : _themeProps$trigger,
60
+ itemContent = themeProps.itemContent,
61
+ axisContent = themeProps.axisContent,
62
+ slots = themeProps.slots,
63
+ slotProps = themeProps.slotProps;
56
64
  var mousePosition = useMouseTracker();
57
65
  var _React$useContext = React.useContext(InteractionContext),
58
66
  item = _React$useContext.item,
59
67
  axis = _React$useContext.axis;
60
68
  var displayedData = trigger === 'item' ? item : axis;
61
- var tooltipHasData = getTootipHasData(trigger, displayedData);
69
+ var tooltipHasData = getTooltipHasData(trigger, displayedData);
62
70
  var popperOpen = mousePosition !== null && tooltipHasData;
63
71
  var classes = useUtilityClasses({
64
- classes: props.classes
72
+ classes: themeProps.classes
65
73
  });
66
74
  var PopperComponent = (_slots$popper = slots == null ? void 0 : slots.popper) != null ? _slots$popper : ChartsTooltipRoot;
67
75
  var popperProps = useSlotProps({
@@ -1,7 +1,7 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
2
2
  import Box from '@mui/system/Box';
3
3
  import { styled } from '@mui/material/styles';
4
- import { tooltipClasses } from './tooltipClasses';
4
+ import { chartsTooltipClasses } from './chartsTooltipClasses';
5
5
  export var ChartsTooltipPaper = styled('div', {
6
6
  name: 'MuiChartsTooltip',
7
7
  slot: 'Container'
@@ -50,9 +50,9 @@ export var ChartsTooltipCell = styled('td', {
50
50
  return _ref5 = {
51
51
  verticalAlign: 'middle',
52
52
  color: (theme.vars || theme).palette.text.secondary
53
- }, _defineProperty(_ref5, "&.".concat(tooltipClasses.labelCell), {
53
+ }, _defineProperty(_ref5, "&.".concat(chartsTooltipClasses.labelCell), {
54
54
  paddingLeft: theme.spacing(1)
55
- }), _defineProperty(_ref5, "&.".concat(tooltipClasses.valueCell), {
55
+ }), _defineProperty(_ref5, "&.".concat(chartsTooltipClasses.valueCell), {
56
56
  paddingLeft: theme.spacing(4),
57
57
  color: (theme.vars || theme).palette.text.primary
58
58
  }), _defineProperty(_ref5, 'td:first-of-type&', {
@@ -0,0 +1,5 @@
1
+ import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
2
+ export function getChartsTooltipUtilityClass(slot) {
3
+ return generateUtilityClass('MuiChartsTooltip', slot);
4
+ }
5
+ export var chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
@@ -1 +1,2 @@
1
- export * from './ChartsTooltip';
1
+ export * from './ChartsTooltip';
2
+ export * from './chartsTooltipClasses';
@@ -81,7 +81,7 @@ export function useMouseTracker() {
81
81
  }, [svgRef]);
82
82
  return mousePosition;
83
83
  }
84
- export function getTootipHasData(trigger, displayedData) {
84
+ export function getTooltipHasData(trigger, displayedData) {
85
85
  if (trigger === 'item') {
86
86
  return displayedData !== null;
87
87
  }
@@ -102,16 +102,18 @@ var defaultProps = {
102
102
  * - [ChartsXAxis API](https://mui.com/x/api/charts/charts-x-axis/)
103
103
  */
104
104
  function ChartsXAxis(inProps) {
105
- var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
105
+ var _props$axisId, _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
106
106
  var props = useThemeProps({
107
107
  props: _extends({}, defaultProps, inProps),
108
108
  name: 'MuiChartsXAxis'
109
109
  });
110
110
  var _React$useContext = React.useContext(CartesianContext),
111
- _React$useContext$xAx = _React$useContext.xAxis[props.axisId],
112
- xScale = _React$useContext$xAx.scale,
113
- tickNumber = _React$useContext$xAx.tickNumber,
114
- settings = _objectWithoutProperties(_React$useContext$xAx, _excluded);
111
+ xAxisIds = _React$useContext.xAxisIds;
112
+ var _React$useContext2 = React.useContext(CartesianContext),
113
+ _React$useContext2$xA = _React$useContext2.xAxis[(_props$axisId = props.axisId) != null ? _props$axisId : xAxisIds[0]],
114
+ xScale = _React$useContext2$xA.scale,
115
+ tickNumber = _React$useContext2$xA.tickNumber,
116
+ settings = _objectWithoutProperties(_React$useContext2$xA, _excluded);
115
117
  var isMounted = useMounted();
116
118
  var defaultizedProps = _extends({}, defaultProps, settings, props);
117
119
  var position = defaultizedProps.position,
@@ -132,11 +134,11 @@ function ChartsXAxis(inProps) {
132
134
  var classes = useUtilityClasses(_extends({}, defaultizedProps, {
133
135
  theme: theme
134
136
  }));
135
- var _React$useContext2 = React.useContext(DrawingContext),
136
- left = _React$useContext2.left,
137
- top = _React$useContext2.top,
138
- width = _React$useContext2.width,
139
- height = _React$useContext2.height;
137
+ var _React$useContext3 = React.useContext(DrawingContext),
138
+ left = _React$useContext3.left,
139
+ top = _React$useContext3.top,
140
+ width = _React$useContext3.width,
141
+ height = _React$useContext3.height;
140
142
  var tickSize = disableTicks ? 4 : tickSizeProp;
141
143
  var positionSign = position === 'bottom' ? 1 : -1;
142
144
  var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : 'line';
@@ -225,9 +227,10 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
225
227
  // | To update them edit the TypeScript types and run "yarn proptypes" |
226
228
  // ----------------------------------------------------------------------
227
229
  /**
228
- * Id of the axis to render.
230
+ * The id of the axis to render.
231
+ * If undefined, it will be the first defined axis.
229
232
  */
230
- axisId: PropTypes.string.isRequired,
233
+ axisId: PropTypes.string,
231
234
  /**
232
235
  * Override or extend the styles applied to the component.
233
236
  */
@@ -46,16 +46,18 @@ var defaultProps = {
46
46
  * - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
47
47
  */
48
48
  function ChartsYAxis(inProps) {
49
- var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
49
+ var _props$axisId, _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
50
50
  var props = useThemeProps({
51
51
  props: _extends({}, defaultProps, inProps),
52
52
  name: 'MuiChartsYAxis'
53
53
  });
54
54
  var _React$useContext = React.useContext(CartesianContext),
55
- _React$useContext$yAx = _React$useContext.yAxis[props.axisId],
56
- yScale = _React$useContext$yAx.scale,
57
- tickNumber = _React$useContext$yAx.tickNumber,
58
- settings = _objectWithoutProperties(_React$useContext$yAx, _excluded);
55
+ yAxisIds = _React$useContext.yAxisIds;
56
+ var _React$useContext2 = React.useContext(CartesianContext),
57
+ _React$useContext2$yA = _React$useContext2.yAxis[(_props$axisId = props.axisId) != null ? _props$axisId : yAxisIds[0]],
58
+ yScale = _React$useContext2$yA.scale,
59
+ tickNumber = _React$useContext2$yA.tickNumber,
60
+ settings = _objectWithoutProperties(_React$useContext2$yA, _excluded);
59
61
  var defaultizedProps = _extends({}, defaultProps, settings, props);
60
62
  var position = defaultizedProps.position,
61
63
  disableLine = defaultizedProps.disableLine,
@@ -71,11 +73,11 @@ function ChartsYAxis(inProps) {
71
73
  var classes = useUtilityClasses(_extends({}, defaultizedProps, {
72
74
  theme: theme
73
75
  }));
74
- var _React$useContext2 = React.useContext(DrawingContext),
75
- left = _React$useContext2.left,
76
- top = _React$useContext2.top,
77
- width = _React$useContext2.width,
78
- height = _React$useContext2.height;
76
+ var _React$useContext3 = React.useContext(DrawingContext),
77
+ left = _React$useContext3.left,
78
+ top = _React$useContext3.top,
79
+ width = _React$useContext3.width,
80
+ height = _React$useContext3.height;
79
81
  var tickSize = disableTicks ? 4 : tickSizeProp;
80
82
  var yTicks = useTicks({
81
83
  scale: yScale,
@@ -156,9 +158,10 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
156
158
  // | To update them edit the TypeScript types and run "yarn proptypes" |
157
159
  // ----------------------------------------------------------------------
158
160
  /**
159
- * Id of the axis to render.
161
+ * The id of the axis to render.
162
+ * If undefined, it will be the first defined axis.
160
163
  */
161
- axisId: PropTypes.string.isRequired,
164
+ axisId: PropTypes.string,
162
165
  /**
163
166
  * Override or extend the styles applied to the component.
164
167
  */
@@ -118,6 +118,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
118
118
  // | These PropTypes are generated from the TypeScript type definitions |
119
119
  // | To update them edit the TypeScript types and run "yarn proptypes" |
120
120
  // ----------------------------------------------------------------------
121
+ /**
122
+ * Object `{ x, y }` that defines how the charts highlight the mouse position along the x- and y-axes.
123
+ * The two properties accept the following values:
124
+ * - 'none': display nothing.
125
+ * - 'line': display a line at the current mouse position.
126
+ * - 'band': display a band at the current mouse position. Only available with band scale.
127
+ */
121
128
  axisHighlight: PropTypes.shape({
122
129
  x: PropTypes.oneOf(['band', 'line', 'none']),
123
130
  y: PropTypes.oneOf(['band', 'line', 'none'])
@@ -128,7 +135,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
128
135
  * @default xAxisIds[0] The id of the first provided axis
129
136
  */
130
137
  bottomAxis: PropTypes.oneOfType([PropTypes.shape({
131
- axisId: PropTypes.string.isRequired,
138
+ axisId: PropTypes.string,
132
139
  classes: PropTypes.object,
133
140
  disableLine: PropTypes.bool,
134
141
  disableTicks: PropTypes.bool,
@@ -155,13 +162,25 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
155
162
  * Color palette used to colorize multiple series.
156
163
  */
157
164
  colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
165
+ /**
166
+ * An array of objects that can be used to populate series and axes data using their `dataKey` property.
167
+ */
158
168
  dataset: PropTypes.arrayOf(PropTypes.object),
159
169
  desc: PropTypes.string,
170
+ /**
171
+ * If `true`, the charts will not listen to the mouse move event.
172
+ * It might break interactive features, but will improve performance.
173
+ * @default false
174
+ */
160
175
  disableAxisListener: PropTypes.bool,
161
176
  /**
162
177
  * If `true`, render the line highlight item.
163
178
  */
164
179
  disableLineItemHighlight: PropTypes.bool,
180
+ /**
181
+ * The height of the chart in px. If not defined, it takes the height of the parent element.
182
+ * @default undefined
183
+ */
165
184
  height: PropTypes.number,
166
185
  /**
167
186
  * Indicate which axis to display the left of the charts.
@@ -169,7 +188,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
169
188
  * @default yAxisIds[0] The id of the first provided axis
170
189
  */
171
190
  leftAxis: PropTypes.oneOfType([PropTypes.shape({
172
- axisId: PropTypes.string.isRequired,
191
+ axisId: PropTypes.string,
173
192
  classes: PropTypes.object,
174
193
  disableLine: PropTypes.bool,
175
194
  disableTicks: PropTypes.bool,
@@ -204,6 +223,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
204
223
  slotProps: PropTypes.object,
205
224
  slots: PropTypes.object
206
225
  }),
226
+ /**
227
+ * The margin between the SVG and the drawing area.
228
+ * It's used for leaving some space for extra information such as the x- and y-axis or legend.
229
+ * Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
230
+ * @default object Depends on the charts type.
231
+ */
207
232
  margin: PropTypes.shape({
208
233
  bottom: PropTypes.number,
209
234
  left: PropTypes.number,
@@ -216,7 +241,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
216
241
  * @default null
217
242
  */
218
243
  rightAxis: PropTypes.oneOfType([PropTypes.shape({
219
- axisId: PropTypes.string.isRequired,
244
+ axisId: PropTypes.string,
220
245
  classes: PropTypes.object,
221
246
  disableLine: PropTypes.bool,
222
247
  disableTicks: PropTypes.bool,
@@ -286,7 +311,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
286
311
  * @default null
287
312
  */
288
313
  topAxis: PropTypes.oneOfType([PropTypes.shape({
289
- axisId: PropTypes.string.isRequired,
314
+ axisId: PropTypes.string,
290
315
  classes: PropTypes.object,
291
316
  disableLine: PropTypes.bool,
292
317
  disableTicks: PropTypes.bool,
@@ -313,7 +338,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
313
338
  x: PropTypes.number,
314
339
  y: PropTypes.number
315
340
  }),
341
+ /**
342
+ * The width of the chart in px. If not defined, it takes the width of the parent element.
343
+ * @default undefined
344
+ */
316
345
  width: PropTypes.number,
346
+ /**
347
+ * The configuration of the x-axes.
348
+ * If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
349
+ */
317
350
  xAxis: PropTypes.arrayOf(PropTypes.shape({
318
351
  axisId: PropTypes.string,
319
352
  classes: PropTypes.object,
@@ -344,6 +377,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
344
377
  tickSize: PropTypes.number,
345
378
  valueFormatter: PropTypes.func
346
379
  })),
380
+ /**
381
+ * The configuration of the y-axes.
382
+ * If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
383
+ */
347
384
  yAxis: PropTypes.arrayOf(PropTypes.shape({
348
385
  axisId: PropTypes.string,
349
386
  classes: PropTypes.object,
@@ -66,7 +66,7 @@ function LineHighlightPlot(props) {
66
66
  throw new Error("Axis of id \"".concat(xAxisKey, "\" should have data property to be able to display a line plot."));
67
67
  }
68
68
  var x = xScale(xData[highlightedIndex]);
69
- var y = yScale(stackedData[highlightedIndex][1]);
69
+ var y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
70
70
  return /*#__PURE__*/_jsx(Element, _extends({
71
71
  id: seriesId,
72
72
  color: series[seriesId].color,
@@ -119,7 +119,8 @@ function MarkPlot(props) {
119
119
  shape: "circle",
120
120
  color: series[seriesId].color,
121
121
  x: x,
122
- y: y,
122
+ y: y // Don't knwo why TS don't get from the filter that y can't be null
123
+ ,
123
124
  highlightScope: series[seriesId].highlightScope
124
125
  }, slotProps == null ? void 0 : slotProps.mark), "".concat(seriesId, "-").concat(index));
125
126
  });
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
3
3
  var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "onClick", "isFaded", "isHighlighted", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
4
4
  import * as React from 'react';
5
+ import PropTypes from 'prop-types';
5
6
  import { arc as d3Arc } from 'd3-shape';
6
7
  import { animated, to } from '@react-spring/web';
7
8
  import composeClasses from '@mui/utils/composeClasses';
@@ -38,7 +39,7 @@ var PieArcRoot = styled(animated.path, {
38
39
  strokeLinejoin: 'round'
39
40
  };
40
41
  });
41
- export default function PieArc(props) {
42
+ function PieArc(props) {
42
43
  var id = props.id,
43
44
  dataIndex = props.dataIndex,
44
45
  innerClasses = props.classes,
@@ -83,4 +84,19 @@ export default function PieArc(props) {
83
84
  seriesId: id,
84
85
  dataIndex: dataIndex
85
86
  })));
86
- }
87
+ }
88
+ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
89
+ // ----------------------------- Warning --------------------------------
90
+ // | These PropTypes are generated from the TypeScript type definitions |
91
+ // | To update them edit the TypeScript types and run "yarn proptypes" |
92
+ // ----------------------------------------------------------------------
93
+ classes: PropTypes.object,
94
+ dataIndex: PropTypes.number.isRequired,
95
+ highlightScope: PropTypes.shape({
96
+ faded: PropTypes.oneOf(['global', 'none', 'series']),
97
+ highlighted: PropTypes.oneOf(['item', 'none', 'series'])
98
+ }),
99
+ isFaded: PropTypes.bool.isRequired,
100
+ isHighlighted: PropTypes.bool.isRequired
101
+ } : void 0;
102
+ export { PieArc };
@@ -3,9 +3,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
3
3
  import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
4
4
  var _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
5
5
  import * as React from 'react';
6
+ import PropTypes from 'prop-types';
6
7
  import { animated, to } from '@react-spring/web';
7
8
  import { arc as d3Arc } from 'd3-shape';
8
- import PropTypes from 'prop-types';
9
9
  import composeClasses from '@mui/utils/composeClasses';
10
10
  import generateUtilityClass from '@mui/utils/generateUtilityClass';
11
11
  import { styled } from '@mui/material/styles';
@@ -64,7 +64,7 @@ var getLabelPosition = function getLabelPosition(formattedArcLabel, variable) {
64
64
  return y;
65
65
  };
66
66
  };
67
- export default function PieArcLabel(props) {
67
+ function PieArcLabel(props) {
68
68
  var id = props.id,
69
69
  innerClasses = props.classes,
70
70
  color = props.color,
@@ -103,12 +103,8 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
103
103
  // | To update them edit the TypeScript types and run "yarn proptypes" |
104
104
  // ----------------------------------------------------------------------
105
105
  classes: PropTypes.object,
106
- cornerRadius: PropTypes.number,
107
- dataIndex: PropTypes.number.isRequired,
108
- highlightScope: PropTypes.shape({
109
- faded: PropTypes.oneOf(['global', 'none', 'series']),
110
- highlighted: PropTypes.oneOf(['item', 'none', 'series'])
111
- }),
112
- innerRadius: PropTypes.number,
113
- outerRadius: PropTypes.number.isRequired
114
- } : void 0;
106
+ formattedArcLabel: PropTypes.string,
107
+ isFaded: PropTypes.bool.isRequired,
108
+ isHighlighted: PropTypes.bool.isRequired
109
+ } : void 0;
110
+ export { PieArcLabel };
@@ -6,7 +6,7 @@ import * as React from 'react';
6
6
  import { useTransition } from '@react-spring/web';
7
7
  import { defaultLabelTransitionConfig } from './dataTransform/transition';
8
8
  import { useTransformData } from './dataTransform/useTransformData';
9
- import PieArcLabel from './PieArcLabel';
9
+ import { PieArcLabel } from './PieArcLabel';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";
11
11
  var RATIO = 180 / Math.PI;
12
12
  function getItemLabel(arcLabel, arcLabelMinAngle, item) {
@@ -4,7 +4,7 @@ var _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadi
4
4
  _excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
5
5
  import * as React from 'react';
6
6
  import { useTransition } from '@react-spring/web';
7
- import PieArc from './PieArc';
7
+ import { PieArc } from './PieArc';
8
8
  import { defaultTransitionConfig } from './dataTransform/transition';
9
9
  import { useTransformData } from './dataTransform/useTransformData';
10
10
  import { jsx as _jsx } from "react/jsx-runtime";