@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.
- package/BarChart/BarChart.d.ts +4 -3
- package/BarChart/BarChart.js +22 -6
- package/BarChart/BarClipPath.d.ts +14 -0
- package/BarChart/BarClipPath.js +50 -0
- package/BarChart/BarPlot.d.ts +4 -0
- package/BarChart/BarPlot.js +108 -36
- package/BarChart/getRadius.d.ts +15 -0
- package/BarChart/getRadius.js +37 -0
- package/BarChart/types.d.ts +25 -0
- package/BarChart/types.js +5 -0
- package/CHANGELOG.md +141 -5
- package/ChartsAxis/axisClasses.d.ts +1 -1
- package/ChartsGrid/ChartsGrid.js +22 -11
- 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 +22 -6
- package/esm/BarChart/BarClipPath.js +42 -0
- package/esm/BarChart/BarPlot.js +109 -37
- package/esm/BarChart/getRadius.js +30 -0
- package/esm/BarChart/types.js +1 -0
- package/esm/ChartsGrid/ChartsGrid.js +23 -12
- 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 +22 -6
- package/modern/BarChart/BarClipPath.js +42 -0
- package/modern/BarChart/BarPlot.js +109 -37
- package/modern/BarChart/getRadius.js +30 -0
- package/modern/BarChart/types.js +1 -0
- package/modern/ChartsGrid/ChartsGrid.js +23 -12
- 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 +2 -2
- package/themeAugmentation/components.d.ts +4 -0
- package/themeAugmentation/overrides.d.ts +2 -0
- package/themeAugmentation/props.d.ts +2 -0
package/Gauge/GaugeProvider.js
CHANGED
|
@@ -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,
|
|
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;
|
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:
|
|
@@ -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__*/
|
|
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 };
|