@mui/x-charts 7.3.1 → 7.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (147) hide show
  1. package/BarChart/BarChart.d.ts +4 -3
  2. package/BarChart/BarChart.js +22 -6
  3. package/BarChart/BarClipPath.d.ts +14 -0
  4. package/BarChart/BarClipPath.js +50 -0
  5. package/BarChart/BarPlot.d.ts +4 -0
  6. package/BarChart/BarPlot.js +108 -36
  7. package/BarChart/getRadius.d.ts +15 -0
  8. package/BarChart/getRadius.js +37 -0
  9. package/BarChart/types.d.ts +25 -0
  10. package/BarChart/types.js +5 -0
  11. package/CHANGELOG.md +141 -5
  12. package/ChartsAxis/axisClasses.d.ts +1 -1
  13. package/ChartsGrid/ChartsGrid.js +22 -11
  14. package/ChartsOverlay/ChartsLoadingOverlay.d.ts +3 -0
  15. package/ChartsOverlay/ChartsLoadingOverlay.js +43 -0
  16. package/ChartsOverlay/ChartsNoDataOverlay.d.ts +3 -0
  17. package/ChartsOverlay/ChartsNoDataOverlay.js +43 -0
  18. package/ChartsOverlay/ChartsOverlay.d.ts +35 -0
  19. package/ChartsOverlay/ChartsOverlay.js +41 -0
  20. package/ChartsOverlay/index.d.ts +3 -0
  21. package/ChartsOverlay/index.js +26 -0
  22. package/ChartsOverlay/package.json +6 -0
  23. package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  24. package/ChartsReferenceLine/common.d.ts +1 -1
  25. package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
  26. package/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  27. package/ChartsTooltip/ChartsTooltip.d.ts +2 -2
  28. package/ChartsTooltip/ChartsTooltip.js +2 -2
  29. package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
  30. package/ChartsXAxis/ChartsXAxis.d.ts +1 -1
  31. package/ChartsXAxis/ChartsXAxis.js +7 -0
  32. package/ChartsYAxis/ChartsYAxis.d.ts +1 -1
  33. package/ChartsYAxis/ChartsYAxis.js +7 -0
  34. package/Gauge/Gauge.js +1 -1
  35. package/Gauge/GaugeContainer.js +1 -1
  36. package/Gauge/GaugeProvider.d.ts +2 -2
  37. package/Gauge/GaugeProvider.js +1 -1
  38. package/Gauge/gaugeClasses.d.ts +2 -2
  39. package/Gauge/utils.d.ts +1 -1
  40. package/Gauge/utils.js +4 -4
  41. package/LineChart/AreaElement.d.ts +1 -1
  42. package/LineChart/LineChart.d.ts +4 -3
  43. package/LineChart/LineChart.js +12 -2
  44. package/LineChart/LineElement.d.ts +1 -1
  45. package/LineChart/MarkElement.d.ts +1 -1
  46. package/PieChart/PieArc.d.ts +1 -1
  47. package/PieChart/PieArcLabel.d.ts +1 -1
  48. package/PieChart/PieArcLabel.js +1 -1
  49. package/PieChart/PieArcLabelPlot.d.ts +1 -1
  50. package/PieChart/PieArcLabelPlot.js +3 -3
  51. package/PieChart/PieArcPlot.d.ts +1 -1
  52. package/PieChart/PieArcPlot.js +3 -3
  53. package/PieChart/PieChart.d.ts +4 -3
  54. package/PieChart/PieChart.js +15 -2
  55. package/ScatterChart/ScatterChart.d.ts +4 -3
  56. package/ScatterChart/ScatterChart.js +12 -2
  57. package/context/SeriesContextProvider.js +1 -1
  58. package/esm/BarChart/BarChart.js +22 -6
  59. package/esm/BarChart/BarClipPath.js +42 -0
  60. package/esm/BarChart/BarPlot.js +109 -37
  61. package/esm/BarChart/getRadius.js +30 -0
  62. package/esm/BarChart/types.js +1 -0
  63. package/esm/ChartsGrid/ChartsGrid.js +23 -12
  64. package/esm/ChartsOverlay/ChartsLoadingOverlay.js +34 -0
  65. package/esm/ChartsOverlay/ChartsNoDataOverlay.js +34 -0
  66. package/esm/ChartsOverlay/ChartsOverlay.js +31 -0
  67. package/esm/ChartsOverlay/index.js +3 -0
  68. package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  69. package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  70. package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
  71. package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
  72. package/esm/ChartsXAxis/ChartsXAxis.js +7 -0
  73. package/esm/ChartsYAxis/ChartsYAxis.js +7 -0
  74. package/esm/Gauge/Gauge.js +1 -1
  75. package/esm/Gauge/GaugeContainer.js +1 -1
  76. package/esm/Gauge/GaugeProvider.js +1 -1
  77. package/esm/Gauge/utils.js +4 -4
  78. package/esm/LineChart/LineChart.js +12 -2
  79. package/esm/PieChart/PieArcLabel.js +1 -1
  80. package/esm/PieChart/PieArcLabelPlot.js +3 -3
  81. package/esm/PieChart/PieArcPlot.js +3 -3
  82. package/esm/PieChart/PieChart.js +15 -2
  83. package/esm/ScatterChart/ScatterChart.js +12 -2
  84. package/esm/context/SeriesContextProvider.js +1 -1
  85. package/esm/hooks/useReducedMotion.js +1 -1
  86. package/esm/hooks/useScale.js +1 -1
  87. package/esm/hooks/useTicks.js +4 -0
  88. package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +5 -5
  89. package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
  90. package/esm/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -3
  91. package/esm/internals/utils.js +1 -1
  92. package/hooks/useReducedMotion.d.ts +1 -1
  93. package/hooks/useReducedMotion.js +1 -1
  94. package/hooks/useScale.d.ts +4 -4
  95. package/hooks/useScale.js +1 -1
  96. package/hooks/useTicks.js +4 -0
  97. package/index.js +1 -1
  98. package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +5 -5
  99. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.d.ts +1 -1
  100. package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
  101. package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.d.ts +1 -1
  102. package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -3
  103. package/internals/utils.d.ts +1 -1
  104. package/internals/utils.js +1 -1
  105. package/models/axis.d.ts +1 -1
  106. package/models/seriesType/bar.d.ts +1 -1
  107. package/models/seriesType/line.d.ts +1 -1
  108. package/models/seriesType/pie.d.ts +4 -4
  109. package/modern/BarChart/BarChart.js +22 -6
  110. package/modern/BarChart/BarClipPath.js +42 -0
  111. package/modern/BarChart/BarPlot.js +109 -37
  112. package/modern/BarChart/getRadius.js +30 -0
  113. package/modern/BarChart/types.js +1 -0
  114. package/modern/ChartsGrid/ChartsGrid.js +23 -12
  115. package/modern/ChartsOverlay/ChartsLoadingOverlay.js +34 -0
  116. package/modern/ChartsOverlay/ChartsNoDataOverlay.js +34 -0
  117. package/modern/ChartsOverlay/ChartsOverlay.js +31 -0
  118. package/modern/ChartsOverlay/index.js +3 -0
  119. package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
  120. package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
  121. package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
  122. package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
  123. package/modern/ChartsXAxis/ChartsXAxis.js +7 -0
  124. package/modern/ChartsYAxis/ChartsYAxis.js +7 -0
  125. package/modern/Gauge/Gauge.js +1 -1
  126. package/modern/Gauge/GaugeContainer.js +1 -1
  127. package/modern/Gauge/GaugeProvider.js +1 -1
  128. package/modern/Gauge/utils.js +4 -4
  129. package/modern/LineChart/LineChart.js +12 -2
  130. package/modern/PieChart/PieArcLabel.js +1 -1
  131. package/modern/PieChart/PieArcLabelPlot.js +3 -3
  132. package/modern/PieChart/PieArcPlot.js +3 -3
  133. package/modern/PieChart/PieChart.js +15 -2
  134. package/modern/ScatterChart/ScatterChart.js +12 -2
  135. package/modern/context/SeriesContextProvider.js +1 -1
  136. package/modern/hooks/useReducedMotion.js +1 -1
  137. package/modern/hooks/useScale.js +1 -1
  138. package/modern/hooks/useTicks.js +4 -0
  139. package/modern/index.js +1 -1
  140. package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +5 -5
  141. package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
  142. package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -3
  143. package/modern/internals/utils.js +1 -1
  144. package/package.json +2 -2
  145. package/themeAugmentation/components.d.ts +4 -0
  146. package/themeAugmentation/overrides.d.ts +2 -0
  147. package/themeAugmentation/props.d.ts +2 -0
@@ -59,7 +59,7 @@ function GaugeProvider(props) {
59
59
  let cy = top + innerCy;
60
60
  const maxRadius = (0, _utils2.getAvailableRadius)(innerCx, innerCy, width, height, ratios);
61
61
 
62
- // If the center is not defined, after computation of the available radius, udpate the center to use the remaining space.
62
+ // If the center is not defined, after computation of the available radius, update the center to use the remaining space.
63
63
  if (cxParam === undefined) {
64
64
  const usedWidth = maxRadius * (ratios.maxX - ratios.minX);
65
65
  cx = left + (width - usedWidth) / 2 + ratios.cx * usedWidth;
@@ -1,9 +1,9 @@
1
1
  export interface GaugeClasses {
2
2
  /** Styles applied to the root element. */
3
3
  root: string;
4
- /** Styles applied to the arc diplaying the value. */
4
+ /** Styles applied to the arc displaying the value. */
5
5
  valueArc: string;
6
- /** Styles applied to the arc diplaying the range of available values. */
6
+ /** Styles applied to the arc displaying the range of available values. */
7
7
  referenceArc: string;
8
8
  /** Styles applied to the value text. */
9
9
  valueText: string;
package/Gauge/utils.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Retruns the ratio of the arc bounding box and its center.
2
+ * Returns the ratio of the arc bounding box and its center.
3
3
  * @param startAngle The start angle (in deg)
4
4
  * @param endAngle The end angle (in deg)
5
5
  */
package/Gauge/utils.js CHANGED
@@ -14,7 +14,7 @@ function getPoint(angle) {
14
14
  }
15
15
 
16
16
  /**
17
- * Retruns the ratio of the arc bounding box and its center.
17
+ * Returns the ratio of the arc bounding box and its center.
18
18
  * @param startAngle The start angle (in deg)
19
19
  * @param endAngle The end angle (in deg)
20
20
  */
@@ -27,9 +27,9 @@ function getArcRatios(startAngle, endAngle) {
27
27
  const maxAngle = Math.max(startAngle, endAngle);
28
28
  const initialAngle = Math.floor(minAngle / 90) * 90;
29
29
  for (let step = 1; step <= 4; step += 1) {
30
- const cartinalAngle = initialAngle + step * 90;
31
- if (cartinalAngle < maxAngle) {
32
- points.push(getPoint(cartinalAngle));
30
+ const cardinalAngle = initialAngle + step * 90;
31
+ if (cardinalAngle < maxAngle) {
32
+ points.push(getPoint(cardinalAngle));
33
33
  }
34
34
  }
35
35
  const minX = Math.min(...points.map(([x]) => x));
@@ -5,7 +5,7 @@ import { SeriesId } from '../models/seriesType/common';
5
5
  export interface AreaElementClasses {
6
6
  /** Styles applied to the root element. */
7
7
  root: string;
8
- /** Styles applied to the root element when higlighted. */
8
+ /** Styles applied to the root element when highlighted. */
9
9
  highlighted: string;
10
10
  /** Styles applied to the root element when faded. */
11
11
  faded: string;
@@ -13,11 +13,12 @@ import { ChartsAxisSlotProps, ChartsAxisSlots } from '../models/axis';
13
13
  import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from './LineHighlightPlot';
14
14
  import { ChartsGridProps } from '../ChartsGrid';
15
15
  import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
16
- export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsTooltipSlots {
16
+ import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay/ChartsOverlay';
17
+ export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots {
17
18
  }
18
- export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps {
19
+ export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps {
19
20
  }
20
- export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
21
+ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
21
22
  /**
22
23
  * The series to display in the line chart.
23
24
  * An array of [[LineSeriesType]] objects.
@@ -22,6 +22,7 @@ var _ChartsClipPath = require("../ChartsClipPath");
22
22
  var _LineHighlightPlot = require("./LineHighlightPlot");
23
23
  var _ChartsGrid = require("../ChartsGrid");
24
24
  var _ChartsOnAxisClickHandler = require("../ChartsOnAxisClickHandler");
25
+ var _ChartsOverlay = require("../ChartsOverlay/ChartsOverlay");
25
26
  var _jsxRuntime = require("react/jsx-runtime");
26
27
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
27
28
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -64,7 +65,8 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
64
65
  children,
65
66
  slots,
66
67
  slotProps,
67
- skipAnimation
68
+ skipAnimation,
69
+ loading
68
70
  } = props;
69
71
  const id = (0, _useId.default)();
70
72
  const clipPathId = `${id}-clip-path`;
@@ -106,6 +108,10 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
106
108
  slotProps: slotProps,
107
109
  onItemClick: onLineClick,
108
110
  skipAnimation: skipAnimation
111
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
112
+ loading: loading,
113
+ slots: slots,
114
+ slotProps: slotProps
109
115
  })]
110
116
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
111
117
  topAxis: topAxis,
@@ -125,7 +131,7 @@ const LineChart = exports.LineChart = /*#__PURE__*/React.forwardRef(function Lin
125
131
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
126
132
  slots: slots,
127
133
  slotProps: slotProps
128
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip, {
134
+ })), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip, {
129
135
  slots: slots,
130
136
  slotProps: slotProps
131
137
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
@@ -206,6 +212,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
206
212
  slotProps: _propTypes.default.object,
207
213
  slots: _propTypes.default.object
208
214
  }),
215
+ /**
216
+ * If `true`, a loading overlay is displayed.
217
+ */
218
+ loading: _propTypes.default.bool,
209
219
  /**
210
220
  * The margin between the SVG and the drawing area.
211
221
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -5,7 +5,7 @@ import { SeriesId } from '../models/seriesType/common';
5
5
  export interface LineElementClasses {
6
6
  /** Styles applied to the root element. */
7
7
  root: string;
8
- /** Styles applied to the root element when higlighted. */
8
+ /** Styles applied to the root element when highlighted. */
9
9
  highlighted: string;
10
10
  /** Styles applied to the root element when faded. */
11
11
  faded: string;
@@ -4,7 +4,7 @@ import { SeriesId } from '../models/seriesType/common';
4
4
  export interface MarkElementClasses {
5
5
  /** Styles applied to the root element. */
6
6
  root: string;
7
- /** Styles applied to the root element when higlighted. */
7
+ /** Styles applied to the root element when highlighted. */
8
8
  highlighted: string;
9
9
  /** Styles applied to the root element when faded. */
10
10
  faded: string;
@@ -6,7 +6,7 @@ import { PieItemId } from '../models';
6
6
  export interface PieArcClasses {
7
7
  /** Styles applied to the root element. */
8
8
  root: string;
9
- /** Styles applied to the root element when higlighted. */
9
+ /** Styles applied to the root element when highlighted. */
10
10
  highlighted: string;
11
11
  /** Styles applied to the root element when faded. */
12
12
  faded: string;
@@ -5,7 +5,7 @@ import { PieItemId } from '../models/seriesType/pie';
5
5
  export interface PieArcLabelClasses {
6
6
  /** Styles applied to the root element. */
7
7
  root: string;
8
- /** Styles applied to the root element when higlighted. */
8
+ /** Styles applied to the root element when highlighted. */
9
9
  highlighted: string;
10
10
  /** Styles applied to the root element when faded. */
11
11
  faded: string;
@@ -50,7 +50,7 @@ const PieArcLabelRoot = (0, _styles.styled)(_web.animated.text, {
50
50
  }));
51
51
  /**
52
52
  * Helper to compute label position.
53
- * It's not an inline function because we need it in inerpolation.
53
+ * It's not an inline function because we need it in interpolation.
54
54
  */
55
55
  const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle, arcLabelRadius, cornerRadius) => {
56
56
  if (!formattedArcLabel) {
@@ -9,7 +9,7 @@ export interface PieArcLabelPlotSlotProps {
9
9
  }
10
10
  export interface PieArcLabelPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'arcLabel' | 'arcLabelMinAngle' | 'id' | 'highlightScope'>, ComputedPieRadius {
11
11
  /**
12
- * Override the arc attibutes when it is faded.
12
+ * Override the arc attributes when it is faded.
13
13
  * @default { additionalRadius: -5 }
14
14
  */
15
15
  faded?: DefaultizedPieSeriesType['faded'];
@@ -138,7 +138,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
138
138
  value: _propTypes.default.number.isRequired
139
139
  })).isRequired,
140
140
  /**
141
- * Override the arc attibutes when it is faded.
141
+ * Override the arc attributes when it is faded.
142
142
  * @default { additionalRadius: -5 }
143
143
  */
144
144
  faded: _propTypes.default.shape({
@@ -151,7 +151,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
151
151
  paddingAngle: _propTypes.default.number
152
152
  }),
153
153
  /**
154
- * Override the arc attibutes when it is highlighted.
154
+ * Override the arc attributes when it is highlighted.
155
155
  */
156
156
  highlighted: _propTypes.default.shape({
157
157
  additionalRadius: _propTypes.default.number,
@@ -168,7 +168,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
168
168
  }),
169
169
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
170
170
  /**
171
- * The radius between circle center and the begining of the arc.
171
+ * The radius between circle center and the beginning of the arc.
172
172
  * @default 0
173
173
  */
174
174
  innerRadius: _propTypes.default.number,
@@ -9,7 +9,7 @@ export interface PieArcPlotSlotProps {
9
9
  }
10
10
  export interface PieArcPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'id' | 'highlightScope'>, ComputedPieRadius {
11
11
  /**
12
- * Override the arc attibutes when it is faded.
12
+ * Override the arc attributes when it is faded.
13
13
  * @default { additionalRadius: -5 }
14
14
  */
15
15
  faded?: DefaultizedPieSeriesType['faded'];
@@ -118,7 +118,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
118
118
  value: _propTypes.default.number.isRequired
119
119
  })).isRequired,
120
120
  /**
121
- * Override the arc attibutes when it is faded.
121
+ * Override the arc attributes when it is faded.
122
122
  * @default { additionalRadius: -5 }
123
123
  */
124
124
  faded: _propTypes.default.shape({
@@ -131,7 +131,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
131
131
  paddingAngle: _propTypes.default.number
132
132
  }),
133
133
  /**
134
- * Override the arc attibutes when it is highlighted.
134
+ * Override the arc attributes when it is highlighted.
135
135
  */
136
136
  highlighted: _propTypes.default.shape({
137
137
  additionalRadius: _propTypes.default.number,
@@ -148,7 +148,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
148
148
  }),
149
149
  id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
150
150
  /**
151
- * The radius between circle center and the begining of the arc.
151
+ * The radius between circle center and the beginning of the arc.
152
152
  * @default 0
153
153
  */
154
154
  innerRadius: _propTypes.default.number,
@@ -9,11 +9,12 @@ import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
9
9
  import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from './PiePlot';
10
10
  import { PieValueType } from '../models/seriesType/pie';
11
11
  import { ChartsAxisSlots, ChartsAxisSlotProps, ChartsXAxisProps, ChartsYAxisProps } from '../models/axis';
12
- export interface PieChartSlots extends ChartsAxisSlots, PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots {
12
+ import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay/ChartsOverlay';
13
+ export interface PieChartSlots extends ChartsAxisSlots, PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots {
13
14
  }
14
- export interface PieChartSlotProps extends ChartsAxisSlotProps, PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps {
15
+ export interface PieChartSlotProps extends ChartsAxisSlotProps, PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps {
15
16
  }
16
- export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
17
+ export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
17
18
  /**
18
19
  * Indicate which axis to display the bottom of the charts.
19
20
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
@@ -16,6 +16,7 @@ var _ChartsLegend = require("../ChartsLegend");
16
16
  var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
17
17
  var _PiePlot = require("./PiePlot");
18
18
  var _useIsRTL = require("../internals/useIsRTL");
19
+ var _ChartsOverlay = require("../ChartsOverlay/ChartsOverlay");
19
20
  var _jsxRuntime = require("react/jsx-runtime");
20
21
  function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
21
22
  function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
@@ -68,7 +69,8 @@ function PieChart(props) {
68
69
  children,
69
70
  slots,
70
71
  slotProps,
71
- onItemClick
72
+ onItemClick,
73
+ loading
72
74
  } = props;
73
75
  const isRTL = (0, _useIsRTL.useIsRTL)();
74
76
  const margin = (0, _extends2.default)({}, isRTL ? defaultRTLMargin : defaultMargin, marginProps);
@@ -107,10 +109,17 @@ function PieChart(props) {
107
109
  slotProps: slotProps,
108
110
  onItemClick: onItemClick,
109
111
  skipAnimation: skipAnimation
112
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
113
+ loading: loading,
114
+ slots: slots,
115
+ slotProps: slotProps
110
116
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
111
117
  slots: slots,
112
118
  slotProps: slotProps
113
- })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip)), children]
119
+ })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip, {
120
+ slots: slots,
121
+ slotProps: slotProps
122
+ })), children]
114
123
  });
115
124
  }
116
125
  process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
@@ -177,6 +186,10 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
177
186
  slotProps: _propTypes.default.object,
178
187
  slots: _propTypes.default.object
179
188
  }),
189
+ /**
190
+ * If `true`, a loading overlay is displayed.
191
+ */
192
+ loading: _propTypes.default.bool,
180
193
  /**
181
194
  * The margin between the SVG and the drawing area.
182
195
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -6,16 +6,17 @@ import { ScatterSeriesType } from '../models/seriesType/scatter';
6
6
  import { MakeOptional } from '../models/helpers';
7
7
  import { ChartsTooltipProps, ChartsTooltipSlotProps, ChartsTooltipSlots } from '../ChartsTooltip';
8
8
  import { ChartsLegendProps, ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
9
+ import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay/ChartsOverlay';
9
10
  import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
10
11
  import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
11
12
  import { ChartsVoronoiHandlerProps } from '../ChartsVoronoiHandler/ChartsVoronoiHandler';
12
13
  import { ChartsGridProps } from '../ChartsGrid';
13
14
  import { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
14
- export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsTooltipSlots {
15
+ export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsTooltipSlots, ChartsOverlaySlots {
15
16
  }
16
- export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps {
17
+ export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps, ChartsOverlaySlotProps {
17
18
  }
18
- export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ZAxisContextProviderProps, 'children' | 'dataset'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsVoronoiHandlerProps, 'onItemClick'> {
19
+ export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ZAxisContextProviderProps, 'children' | 'dataset'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Omit<ChartsVoronoiHandlerProps, 'onItemClick'> {
19
20
  /**
20
21
  * The series to display in the scatter chart.
21
22
  * An array of [[ScatterSeriesType]] objects.
@@ -13,6 +13,7 @@ var _ResponsiveChartContainer = require("../ResponsiveChartContainer");
13
13
  var _ChartsAxis = require("../ChartsAxis");
14
14
  var _ChartsTooltip = require("../ChartsTooltip");
15
15
  var _ChartsLegend = require("../ChartsLegend");
16
+ var _ChartsOverlay = require("../ChartsOverlay/ChartsOverlay");
16
17
  var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
17
18
  var _ChartsVoronoiHandler = require("../ChartsVoronoiHandler/ChartsVoronoiHandler");
18
19
  var _ChartsGrid = require("../ChartsGrid");
@@ -54,7 +55,8 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
54
55
  onItemClick,
55
56
  children,
56
57
  slots,
57
- slotProps
58
+ slotProps,
59
+ loading
58
60
  } = props;
59
61
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ResponsiveChartContainer.ResponsiveChartContainer, {
60
62
  ref: ref,
@@ -87,13 +89,17 @@ const ScatterChart = exports.ScatterChart = /*#__PURE__*/React.forwardRef(functi
87
89
  slots: slots,
88
90
  slotProps: slotProps,
89
91
  onItemClick: disableVoronoi ? onItemClick : undefined
92
+ }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
93
+ loading: loading,
94
+ slots: slots,
95
+ slotProps: slotProps
90
96
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
91
97
  slots: slots,
92
98
  slotProps: slotProps
93
99
  })), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({
94
100
  x: "none",
95
101
  y: "none"
96
- }, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({
102
+ }, axisHighlight)), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({
97
103
  trigger: "item"
98
104
  }, tooltip)), children]
99
105
  })
@@ -173,6 +179,10 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
173
179
  slotProps: _propTypes.default.object,
174
180
  slots: _propTypes.default.object
175
181
  }),
182
+ /**
183
+ * If `true`, a loading overlay is displayed.
184
+ */
185
+ loading: _propTypes.default.bool,
176
186
  /**
177
187
  * The margin between the SVG and the drawing area.
178
188
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -60,7 +60,7 @@ const formatSeries = (series, colors, dataset) => {
60
60
  seriesGroups[type].seriesOrder.push(id);
61
61
  });
62
62
  const formattedSeries = {};
63
- // Apply formater on a type group
63
+ // Apply formatter on a type group
64
64
  Object.keys(seriesTypeFormatter).forEach(type => {
65
65
  if (seriesGroups[type] !== undefined) {
66
66
  formattedSeries[type] = seriesTypeFormatter[type]?.(seriesGroups[type], dataset) ?? seriesGroups[type];
@@ -12,6 +12,7 @@ import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
12
12
  import { ChartsClipPath } from '../ChartsClipPath';
13
13
  import { ChartsGrid } from '../ChartsGrid';
14
14
  import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
15
+ import { ChartsOverlay } from '../ChartsOverlay/ChartsOverlay';
15
16
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
16
17
  /**
17
18
  * Demos:
@@ -45,11 +46,13 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
45
46
  rightAxis,
46
47
  bottomAxis,
47
48
  skipAnimation,
49
+ borderRadius,
48
50
  onItemClick,
49
51
  onAxisClick,
50
52
  children,
51
53
  slots,
52
- slotProps
54
+ slotProps,
55
+ loading
53
56
  } = props;
54
57
  const id = useId();
55
58
  const clipPathId = `${id}-clip-path`;
@@ -90,14 +93,19 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
90
93
  }), grid && /*#__PURE__*/_jsx(ChartsGrid, {
91
94
  vertical: grid.vertical,
92
95
  horizontal: grid.horizontal
93
- }), /*#__PURE__*/_jsx("g", {
96
+ }), /*#__PURE__*/_jsxs("g", {
94
97
  clipPath: `url(#${clipPathId})`,
95
- children: /*#__PURE__*/_jsx(BarPlot, {
98
+ children: [/*#__PURE__*/_jsx(BarPlot, {
96
99
  slots: slots,
97
100
  slotProps: slotProps,
98
101
  skipAnimation: skipAnimation,
99
- onItemClick: onItemClick
100
- })
102
+ onItemClick: onItemClick,
103
+ borderRadius: borderRadius
104
+ }), /*#__PURE__*/_jsx(ChartsOverlay, {
105
+ loading: loading,
106
+ slots: slots,
107
+ slotProps: slotProps
108
+ })]
101
109
  }), /*#__PURE__*/_jsx(ChartsAxis, {
102
110
  topAxis: topAxis,
103
111
  leftAxis: leftAxis,
@@ -108,7 +116,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
108
116
  }), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
109
117
  slots: slots,
110
118
  slotProps: slotProps
111
- })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
119
+ })), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), !loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
112
120
  slots: slots,
113
121
  slotProps: slotProps
114
122
  })), /*#__PURE__*/_jsx(ChartsClipPath, {
@@ -131,6 +139,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
131
139
  x: PropTypes.oneOf(['band', 'line', 'none']),
132
140
  y: PropTypes.oneOf(['band', 'line', 'none'])
133
141
  }),
142
+ /**
143
+ * Defines the border radius of the bar element.
144
+ */
145
+ borderRadius: PropTypes.number,
134
146
  /**
135
147
  * Indicate which axis to display the bottom of the charts.
136
148
  * Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
@@ -191,6 +203,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
191
203
  slotProps: PropTypes.object,
192
204
  slots: PropTypes.object
193
205
  }),
206
+ /**
207
+ * If `true`, a loading overlay is displayed.
208
+ */
209
+ loading: PropTypes.bool,
194
210
  /**
195
211
  * The margin between the SVG and the drawing area.
196
212
  * It's used for leaving some space for extra information such as the x- and y-axis or legend.
@@ -0,0 +1,42 @@
1
+ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
2
+ import _extends from "@babel/runtime/helpers/esm/extends";
3
+ const _excluded = ["style", "maskId"];
4
+ import * as React from 'react';
5
+ import { animated } from '@react-spring/web';
6
+ import { getRadius } from './getRadius';
7
+ import { jsx as _jsx } from "react/jsx-runtime";
8
+ const buildInset = corners => `inset(0px round ${corners.topLeft}px ${corners.topRight}px ${corners.bottomRight}px ${corners.bottomLeft}px)`;
9
+ function BarClipRect(props) {
10
+ const radiusData = props.ownerState;
11
+ return /*#__PURE__*/_jsx(animated.rect, {
12
+ style: _extends({}, props.style, {
13
+ clipPath: (props.ownerState.layout === 'vertical' ? props.style?.height : props.style?.width).to(value => buildInset({
14
+ topLeft: Math.min(value, getRadius('top-left', radiusData)),
15
+ topRight: Math.min(value, getRadius('top-right', radiusData)),
16
+ bottomRight: Math.min(value, getRadius('bottom-right', radiusData)),
17
+ bottomLeft: Math.min(value, getRadius('bottom-left', radiusData))
18
+ }))
19
+ })
20
+ });
21
+ }
22
+ /**
23
+ * @ignore - internal component.
24
+ */
25
+ function BarClipPath(props) {
26
+ const {
27
+ style,
28
+ maskId
29
+ } = props,
30
+ rest = _objectWithoutPropertiesLoose(props, _excluded);
31
+ if (!props.borderRadius || props.borderRadius <= 0) {
32
+ return null;
33
+ }
34
+ return /*#__PURE__*/_jsx("clipPath", {
35
+ id: maskId,
36
+ children: /*#__PURE__*/_jsx(BarClipRect, {
37
+ ownerState: rest,
38
+ style: style
39
+ })
40
+ });
41
+ }
42
+ export { BarClipPath };