@mui/x-charts 7.3.1 → 7.3.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.
- package/BarChart/BarChart.d.ts +4 -3
- package/BarChart/BarChart.js +15 -5
- package/BarChart/BarPlot.js +6 -6
- package/CHANGELOG.md +76 -5
- package/ChartsAxis/axisClasses.d.ts +1 -1
- package/ChartsOverlay/ChartsLoadingOverlay.d.ts +3 -0
- package/ChartsOverlay/ChartsLoadingOverlay.js +43 -0
- package/ChartsOverlay/ChartsNoDataOverlay.d.ts +3 -0
- package/ChartsOverlay/ChartsNoDataOverlay.js +43 -0
- package/ChartsOverlay/ChartsOverlay.d.ts +35 -0
- package/ChartsOverlay/ChartsOverlay.js +41 -0
- package/ChartsOverlay/index.d.ts +3 -0
- package/ChartsOverlay/index.js +26 -0
- package/ChartsOverlay/package.json +6 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/ChartsTooltip/ChartsTooltip.d.ts +2 -2
- package/ChartsTooltip/ChartsTooltip.js +2 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/ChartsXAxis/ChartsXAxis.d.ts +1 -1
- package/ChartsXAxis/ChartsXAxis.js +7 -0
- package/ChartsYAxis/ChartsYAxis.d.ts +1 -1
- package/ChartsYAxis/ChartsYAxis.js +7 -0
- package/Gauge/Gauge.js +1 -1
- package/Gauge/GaugeContainer.js +1 -1
- package/Gauge/GaugeProvider.d.ts +2 -2
- package/Gauge/GaugeProvider.js +1 -1
- package/Gauge/gaugeClasses.d.ts +2 -2
- package/Gauge/utils.d.ts +1 -1
- package/Gauge/utils.js +4 -4
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/LineChart.d.ts +4 -3
- package/LineChart/LineChart.js +12 -2
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/MarkElement.d.ts +1 -1
- package/PieChart/PieArc.d.ts +1 -1
- package/PieChart/PieArcLabel.d.ts +1 -1
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieArcLabelPlot.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +3 -3
- package/PieChart/PieArcPlot.d.ts +1 -1
- package/PieChart/PieArcPlot.js +3 -3
- package/PieChart/PieChart.d.ts +4 -3
- package/PieChart/PieChart.js +15 -2
- package/ScatterChart/ScatterChart.d.ts +4 -3
- package/ScatterChart/ScatterChart.js +12 -2
- package/context/SeriesContextProvider.js +1 -1
- package/esm/BarChart/BarChart.js +15 -5
- package/esm/BarChart/BarPlot.js +6 -6
- package/esm/ChartsOverlay/ChartsLoadingOverlay.js +34 -0
- package/esm/ChartsOverlay/ChartsNoDataOverlay.js +34 -0
- package/esm/ChartsOverlay/ChartsOverlay.js +31 -0
- package/esm/ChartsOverlay/index.js +3 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +7 -0
- package/esm/ChartsYAxis/ChartsYAxis.js +7 -0
- package/esm/Gauge/Gauge.js +1 -1
- package/esm/Gauge/GaugeContainer.js +1 -1
- package/esm/Gauge/GaugeProvider.js +1 -1
- package/esm/Gauge/utils.js +4 -4
- package/esm/LineChart/LineChart.js +12 -2
- package/esm/PieChart/PieArcLabel.js +1 -1
- package/esm/PieChart/PieArcLabelPlot.js +3 -3
- package/esm/PieChart/PieArcPlot.js +3 -3
- package/esm/PieChart/PieChart.js +15 -2
- package/esm/ScatterChart/ScatterChart.js +12 -2
- package/esm/context/SeriesContextProvider.js +1 -1
- package/esm/hooks/useReducedMotion.js +1 -1
- package/esm/hooks/useScale.js +1 -1
- package/esm/hooks/useTicks.js +4 -0
- package/esm/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +5 -5
- package/esm/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
- package/esm/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -3
- package/esm/internals/utils.js +1 -1
- package/hooks/useReducedMotion.d.ts +1 -1
- package/hooks/useReducedMotion.js +1 -1
- package/hooks/useScale.d.ts +4 -4
- package/hooks/useScale.js +1 -1
- package/hooks/useTicks.js +4 -0
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +5 -5
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -3
- package/internals/utils.d.ts +1 -1
- package/internals/utils.js +1 -1
- package/models/axis.d.ts +1 -1
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +4 -4
- package/modern/BarChart/BarChart.js +15 -5
- package/modern/BarChart/BarPlot.js +6 -6
- package/modern/ChartsOverlay/ChartsLoadingOverlay.js +34 -0
- package/modern/ChartsOverlay/ChartsNoDataOverlay.js +34 -0
- package/modern/ChartsOverlay/ChartsOverlay.js +31 -0
- package/modern/ChartsOverlay/index.js +3 -0
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +7 -0
- package/modern/ChartsYAxis/ChartsYAxis.js +7 -0
- package/modern/Gauge/Gauge.js +1 -1
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/Gauge/GaugeProvider.js +1 -1
- package/modern/Gauge/utils.js +4 -4
- package/modern/LineChart/LineChart.js +12 -2
- package/modern/PieChart/PieArcLabel.js +1 -1
- package/modern/PieChart/PieArcLabelPlot.js +3 -3
- package/modern/PieChart/PieArcPlot.js +3 -3
- package/modern/PieChart/PieChart.js +15 -2
- package/modern/ScatterChart/ScatterChart.js +12 -2
- package/modern/context/SeriesContextProvider.js +1 -1
- package/modern/hooks/useReducedMotion.js +1 -1
- package/modern/hooks/useScale.js +1 -1
- package/modern/hooks/useTicks.js +4 -0
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +5 -5
- package/modern/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +3 -3
- package/modern/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +3 -3
- package/modern/internals/utils.js +1 -1
- package/package.json +1 -1
package/Gauge/gaugeClasses.d.ts
CHANGED
|
@@ -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
|
|
4
|
+
/** Styles applied to the arc displaying the value. */
|
|
5
5
|
valueArc: string;
|
|
6
|
-
/** Styles applied to the arc
|
|
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
package/Gauge/utils.js
CHANGED
|
@@ -14,7 +14,7 @@ function getPoint(angle) {
|
|
|
14
14
|
}
|
|
15
15
|
|
|
16
16
|
/**
|
|
17
|
-
*
|
|
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
|
|
31
|
-
if (
|
|
32
|
-
points.push(getPoint(
|
|
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
|
|
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;
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -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
|
-
|
|
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.
|
package/LineChart/LineChart.js
CHANGED
|
@@ -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
|
|
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
|
|
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;
|
package/PieChart/PieArc.d.ts
CHANGED
|
@@ -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
|
|
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
|
|
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;
|
package/PieChart/PieArcLabel.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
171
|
+
* The radius between circle center and the beginning of the arc.
|
|
172
172
|
* @default 0
|
|
173
173
|
*/
|
|
174
174
|
innerRadius: _propTypes.default.number,
|
package/PieChart/PieArcPlot.d.ts
CHANGED
|
@@ -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
|
|
12
|
+
* Override the arc attributes when it is faded.
|
|
13
13
|
* @default { additionalRadius: -5 }
|
|
14
14
|
*/
|
|
15
15
|
faded?: DefaultizedPieSeriesType['faded'];
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -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
|
|
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
|
|
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
|
|
151
|
+
* The radius between circle center and the beginning of the arc.
|
|
152
152
|
* @default 0
|
|
153
153
|
*/
|
|
154
154
|
innerRadius: _propTypes.default.number,
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -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
|
-
|
|
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`.
|
package/PieChart/PieChart.js
CHANGED
|
@@ -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
|
|
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
|
|
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];
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -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:
|
|
@@ -49,7 +50,8 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
49
50
|
onAxisClick,
|
|
50
51
|
children,
|
|
51
52
|
slots,
|
|
52
|
-
slotProps
|
|
53
|
+
slotProps,
|
|
54
|
+
loading
|
|
53
55
|
} = props;
|
|
54
56
|
const id = useId();
|
|
55
57
|
const clipPathId = `${id}-clip-path`;
|
|
@@ -90,14 +92,18 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
90
92
|
}), grid && /*#__PURE__*/_jsx(ChartsGrid, {
|
|
91
93
|
vertical: grid.vertical,
|
|
92
94
|
horizontal: grid.horizontal
|
|
93
|
-
}), /*#__PURE__*/
|
|
95
|
+
}), /*#__PURE__*/_jsxs("g", {
|
|
94
96
|
clipPath: `url(#${clipPathId})`,
|
|
95
|
-
children: /*#__PURE__*/_jsx(BarPlot, {
|
|
97
|
+
children: [/*#__PURE__*/_jsx(BarPlot, {
|
|
96
98
|
slots: slots,
|
|
97
99
|
slotProps: slotProps,
|
|
98
100
|
skipAnimation: skipAnimation,
|
|
99
101
|
onItemClick: onItemClick
|
|
100
|
-
})
|
|
102
|
+
}), /*#__PURE__*/_jsx(ChartsOverlay, {
|
|
103
|
+
loading: loading,
|
|
104
|
+
slots: slots,
|
|
105
|
+
slotProps: slotProps
|
|
106
|
+
})]
|
|
101
107
|
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
102
108
|
topAxis: topAxis,
|
|
103
109
|
leftAxis: leftAxis,
|
|
@@ -108,7 +114,7 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
108
114
|
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
109
115
|
slots: slots,
|
|
110
116
|
slotProps: slotProps
|
|
111
|
-
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
117
|
+
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, defaultizedAxisHighlight)), !loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip, {
|
|
112
118
|
slots: slots,
|
|
113
119
|
slotProps: slotProps
|
|
114
120
|
})), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
@@ -191,6 +197,10 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
191
197
|
slotProps: PropTypes.object,
|
|
192
198
|
slots: PropTypes.object
|
|
193
199
|
}),
|
|
200
|
+
/**
|
|
201
|
+
* If `true`, a loading overlay is displayed.
|
|
202
|
+
*/
|
|
203
|
+
loading: PropTypes.bool,
|
|
194
204
|
/**
|
|
195
205
|
* The margin between the SVG and the drawing area.
|
|
196
206
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
package/esm/BarChart/BarPlot.js
CHANGED
|
@@ -70,25 +70,25 @@ const useAggregatedData = () => {
|
|
|
70
70
|
let baseScaleConfig;
|
|
71
71
|
if (verticalLayout) {
|
|
72
72
|
if (!isBandScaleConfig(xAxisConfig)) {
|
|
73
|
-
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`}
|
|
73
|
+
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
74
74
|
}
|
|
75
75
|
if (xAxis[xAxisKey].data === undefined) {
|
|
76
|
-
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`}
|
|
76
|
+
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property.`);
|
|
77
77
|
}
|
|
78
78
|
baseScaleConfig = xAxisConfig;
|
|
79
79
|
if (isBandScaleConfig(yAxisConfig) || isPointScaleConfig(yAxisConfig)) {
|
|
80
|
-
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`}
|
|
80
|
+
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
81
81
|
}
|
|
82
82
|
} else {
|
|
83
83
|
if (!isBandScaleConfig(yAxisConfig)) {
|
|
84
|
-
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`}
|
|
84
|
+
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should be of type "band" to display the bar series of id "${seriesId}".`);
|
|
85
85
|
}
|
|
86
86
|
if (yAxis[yAxisKey].data === undefined) {
|
|
87
|
-
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`}
|
|
87
|
+
throw new Error(`MUI X Charts: ${yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : `The y-axis with id "${yAxisKey}"`} should have data property.`);
|
|
88
88
|
}
|
|
89
89
|
baseScaleConfig = yAxisConfig;
|
|
90
90
|
if (isBandScaleConfig(xAxisConfig) || isPointScaleConfig(xAxisConfig)) {
|
|
91
|
-
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`}
|
|
91
|
+
throw new Error(`MUI X Charts: ${xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should be a continuous type to display the bar series of id "${seriesId}".`);
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
const xScale = xAxisConfig.scale;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["message"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { useDrawingArea } from '../hooks/useDrawingArea';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const StyledText = styled('text')(({
|
|
9
|
+
theme
|
|
10
|
+
}) => ({
|
|
11
|
+
stroke: 'none',
|
|
12
|
+
fill: theme.palette.text.primary,
|
|
13
|
+
shapeRendering: 'crispEdges',
|
|
14
|
+
textAnchor: 'middle',
|
|
15
|
+
dominantBaseline: 'middle'
|
|
16
|
+
}));
|
|
17
|
+
export function ChartsLoadingOverlay(props) {
|
|
18
|
+
const {
|
|
19
|
+
message
|
|
20
|
+
} = props,
|
|
21
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
|
+
const {
|
|
23
|
+
top,
|
|
24
|
+
left,
|
|
25
|
+
height,
|
|
26
|
+
width
|
|
27
|
+
} = useDrawingArea();
|
|
28
|
+
return /*#__PURE__*/_jsx(StyledText, _extends({
|
|
29
|
+
x: left + width / 2,
|
|
30
|
+
y: top + height / 2
|
|
31
|
+
}, other, {
|
|
32
|
+
children: message ?? 'Loading data ...'
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["message"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { useDrawingArea } from '../hooks/useDrawingArea';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
const StyledText = styled('text')(({
|
|
9
|
+
theme
|
|
10
|
+
}) => ({
|
|
11
|
+
stroke: 'none',
|
|
12
|
+
fill: theme.palette.text.primary,
|
|
13
|
+
shapeRendering: 'crispEdges',
|
|
14
|
+
textAnchor: 'middle',
|
|
15
|
+
dominantBaseline: 'middle'
|
|
16
|
+
}));
|
|
17
|
+
export function ChartsNoDataOverlay(props) {
|
|
18
|
+
const {
|
|
19
|
+
message
|
|
20
|
+
} = props,
|
|
21
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
22
|
+
const {
|
|
23
|
+
top,
|
|
24
|
+
left,
|
|
25
|
+
height,
|
|
26
|
+
width
|
|
27
|
+
} = useDrawingArea();
|
|
28
|
+
return /*#__PURE__*/_jsx(StyledText, _extends({
|
|
29
|
+
x: left + width / 2,
|
|
30
|
+
y: top + height / 2
|
|
31
|
+
}, other, {
|
|
32
|
+
children: message ?? 'No data to display'
|
|
33
|
+
}));
|
|
34
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import { ChartsLoadingOverlay } from './ChartsLoadingOverlay';
|
|
4
|
+
import { useSeries } from '../hooks/useSeries';
|
|
5
|
+
import { ChartsNoDataOverlay } from './ChartsNoDataOverlay';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
export function useNoData() {
|
|
8
|
+
const seriesPerType = useSeries();
|
|
9
|
+
return Object.values(seriesPerType).every(seriesOfGivenType => {
|
|
10
|
+
if (!seriesOfGivenType) {
|
|
11
|
+
return true;
|
|
12
|
+
}
|
|
13
|
+
const {
|
|
14
|
+
series,
|
|
15
|
+
seriesOrder
|
|
16
|
+
} = seriesOfGivenType;
|
|
17
|
+
return seriesOrder.every(seriesId => series[seriesId].data.length === 0);
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
export function ChartsOverlay(props) {
|
|
21
|
+
const noData = useNoData();
|
|
22
|
+
if (props.loading) {
|
|
23
|
+
const LoadingOverlay = props.slots?.loadingOverlay ?? ChartsLoadingOverlay;
|
|
24
|
+
return /*#__PURE__*/_jsx(LoadingOverlay, _extends({}, props.slotProps?.loadingOverlay));
|
|
25
|
+
}
|
|
26
|
+
if (noData) {
|
|
27
|
+
const NoDataOverlay = props.slots?.noDataOverlay ?? ChartsNoDataOverlay;
|
|
28
|
+
return /*#__PURE__*/_jsx(NoDataOverlay, _extends({}, props.slotProps?.noDataOverlay));
|
|
29
|
+
}
|
|
30
|
+
return null;
|
|
31
|
+
}
|
|
@@ -52,7 +52,7 @@ process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
|
|
|
52
52
|
*/
|
|
53
53
|
lineStyle: PropTypes.object,
|
|
54
54
|
/**
|
|
55
|
-
* Additional space
|
|
55
|
+
* Additional space around the label in px.
|
|
56
56
|
* Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
|
|
57
57
|
* @default 5
|
|
58
58
|
*/
|
|
@@ -106,7 +106,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
|
106
106
|
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
107
107
|
})
|
|
108
108
|
}),
|
|
109
|
-
axisValue: PropTypes.
|
|
109
|
+
axisValue: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]),
|
|
110
110
|
classes: PropTypes.object,
|
|
111
111
|
dataIndex: PropTypes.number,
|
|
112
112
|
series: PropTypes.arrayOf(PropTypes.object),
|
|
@@ -113,7 +113,7 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
113
113
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
114
114
|
// ----------------------------------------------------------------------
|
|
115
115
|
/**
|
|
116
|
-
* Component to override the tooltip content when
|
|
116
|
+
* Component to override the tooltip content when trigger is set to 'axis'.
|
|
117
117
|
* @deprecated Use slots.axisContent instead
|
|
118
118
|
*/
|
|
119
119
|
axisContent: PropTypes.elementType,
|
|
@@ -122,7 +122,7 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
122
122
|
*/
|
|
123
123
|
classes: PropTypes.object,
|
|
124
124
|
/**
|
|
125
|
-
* Component to override the tooltip content when
|
|
125
|
+
* Component to override the tooltip content when trigger is set to 'item'.
|
|
126
126
|
* @deprecated Use slots.itemContent instead
|
|
127
127
|
*/
|
|
128
128
|
itemContent: PropTypes.elementType,
|