@mui/x-charts 7.0.0-alpha.5 → 7.0.0-alpha.8
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.js +1 -0
- package/BarChart/BarElement.d.ts +37 -20
- package/BarChart/BarPlot.js +4 -4
- package/BarChart/formatter.js +1 -1
- package/CHANGELOG.md +357 -49
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/ChartsSurface.d.ts +2 -2
- package/ChartsSurface.js +33 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/LineChart/AreaPlot.js +2 -2
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +2 -0
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.js +2 -2
- package/LineChart/MarkPlot.js +1 -1
- package/LineChart/formatter.js +2 -2
- package/PieChart/PieArcLabel.d.ts +1 -0
- package/PieChart/PieArcLabel.js +7 -8
- package/PieChart/PieArcLabelPlot.d.ts +5 -0
- package/PieChart/PieArcLabelPlot.js +16 -3
- package/PieChart/PieArcPlot.d.ts +5 -0
- package/PieChart/PieArcPlot.js +9 -1
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +6 -2
- package/PieChart/PiePlot.js +3 -0
- package/PieChart/dataTransform/transition.js +9 -2
- package/PieChart/dataTransform/useTransformData.d.ts +1 -0
- package/PieChart/dataTransform/useTransformData.js +11 -8
- package/ResponsiveChartContainer/index.js +2 -2
- package/ScatterChart/ScatterChart.js +1 -0
- package/SparkLineChart/SparkLineChart.d.ts +15 -1
- package/SparkLineChart/SparkLineChart.js +8 -1
- package/context/CartesianContextProvider.d.ts +1 -1
- package/context/CartesianContextProvider.js +9 -8
- package/context/DrawingProvider.d.ts +1 -1
- package/context/DrawingProvider.js +8 -7
- package/context/HighlightProvider.d.ts +2 -2
- package/context/HighlightProvider.js +4 -3
- package/context/InteractionProvider.d.ts +2 -2
- package/context/InteractionProvider.js +4 -3
- package/context/SeriesContextProvider.d.ts +3 -1
- package/context/SeriesContextProvider.js +8 -7
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/BarChart/BarPlot.js +4 -4
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/esm/ChartsSurface.js +35 -2
- package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/esm/LineChart/AreaPlot.js +2 -2
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/LineHighlightPlot.js +1 -1
- package/esm/LineChart/LinePlot.js +2 -2
- package/esm/LineChart/MarkPlot.js +1 -1
- package/esm/LineChart/formatter.js +2 -2
- package/esm/PieChart/PieArcLabel.js +7 -8
- package/esm/PieChart/PieArcLabelPlot.js +16 -3
- package/esm/PieChart/PieArcPlot.js +9 -1
- package/esm/PieChart/PieChart.js +6 -2
- package/esm/PieChart/PiePlot.js +3 -0
- package/esm/PieChart/dataTransform/transition.js +9 -2
- package/esm/PieChart/dataTransform/useTransformData.js +12 -9
- package/esm/ResponsiveChartContainer/index.js +2 -2
- package/esm/ScatterChart/ScatterChart.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +8 -1
- package/esm/context/CartesianContextProvider.js +9 -8
- package/esm/context/DrawingProvider.js +8 -7
- package/esm/context/HighlightProvider.js +6 -4
- package/esm/context/InteractionProvider.js +6 -4
- package/esm/context/SeriesContextProvider.js +10 -8
- package/esm/index.js +1 -0
- package/esm/internals/domUtils.js +3 -1
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/defaultizeColor.d.ts +3 -0
- package/internals/domUtils.js +3 -1
- package/legacy/BarChart/BarChart.js +1 -0
- package/legacy/BarChart/BarPlot.js +4 -4
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +7 -5
- package/legacy/ChartsSurface.js +35 -2
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/legacy/LineChart/AreaPlot.js +2 -2
- package/legacy/LineChart/LineChart.js +2 -0
- package/legacy/LineChart/LineHighlightPlot.js +1 -1
- package/legacy/LineChart/LinePlot.js +2 -2
- package/legacy/LineChart/MarkPlot.js +1 -1
- package/legacy/LineChart/formatter.js +2 -2
- package/legacy/PieChart/PieArcLabel.js +7 -8
- package/legacy/PieChart/PieArcLabelPlot.js +16 -4
- package/legacy/PieChart/PieArcPlot.js +10 -1
- package/legacy/PieChart/PieChart.js +6 -2
- package/legacy/PieChart/PiePlot.js +3 -0
- package/legacy/PieChart/dataTransform/transition.js +9 -2
- package/legacy/PieChart/dataTransform/useTransformData.js +12 -9
- package/legacy/ResponsiveChartContainer/index.js +2 -2
- package/legacy/ScatterChart/ScatterChart.js +1 -0
- package/legacy/SparkLineChart/SparkLineChart.js +8 -1
- package/legacy/context/CartesianContextProvider.js +17 -17
- package/legacy/context/DrawingProvider.js +6 -6
- package/legacy/context/HighlightProvider.js +4 -3
- package/legacy/context/InteractionProvider.js +4 -3
- package/legacy/context/SeriesContextProvider.js +9 -8
- package/legacy/index.js +2 -1
- package/legacy/internals/domUtils.js +3 -3
- package/models/seriesType/pie.d.ts +15 -0
- package/modern/BarChart/BarChart.js +1 -0
- package/modern/BarChart/BarPlot.js +4 -4
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +9 -5
- package/modern/ChartsSurface.js +35 -2
- package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/modern/LineChart/AreaPlot.js +2 -2
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +1 -1
- package/modern/LineChart/LinePlot.js +2 -2
- package/modern/LineChart/MarkPlot.js +1 -1
- package/modern/LineChart/formatter.js +2 -2
- package/modern/PieChart/PieArcLabel.js +7 -8
- package/modern/PieChart/PieArcLabelPlot.js +16 -3
- package/modern/PieChart/PieArcPlot.js +9 -1
- package/modern/PieChart/PieChart.js +6 -2
- package/modern/PieChart/PiePlot.js +3 -0
- package/modern/PieChart/dataTransform/transition.js +9 -2
- package/modern/PieChart/dataTransform/useTransformData.js +11 -8
- package/modern/ResponsiveChartContainer/index.js +2 -2
- package/modern/ScatterChart/ScatterChart.js +1 -0
- package/modern/SparkLineChart/SparkLineChart.js +8 -1
- package/modern/context/CartesianContextProvider.js +9 -8
- package/modern/context/DrawingProvider.js +8 -7
- package/modern/context/HighlightProvider.js +6 -4
- package/modern/context/InteractionProvider.js +6 -4
- package/modern/context/SeriesContextProvider.js +10 -8
- package/modern/index.js +2 -1
- package/modern/internals/domUtils.js +3 -1
- package/package.json +5 -5
package/LineChart/LineChart.js
CHANGED
|
@@ -125,6 +125,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
125
125
|
* - 'none': display nothing.
|
|
126
126
|
* - 'line': display a line at the current mouse position.
|
|
127
127
|
* - 'band': display a band at the current mouse position. Only available with band scale.
|
|
128
|
+
* @default { x: 'line' }
|
|
128
129
|
*/
|
|
129
130
|
axisHighlight: _propTypes.default.shape({
|
|
130
131
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
@@ -161,6 +162,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
161
162
|
className: _propTypes.default.string,
|
|
162
163
|
/**
|
|
163
164
|
* Color palette used to colorize multiple series.
|
|
165
|
+
* @default blueberryTwilightPalette
|
|
164
166
|
*/
|
|
165
167
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
166
168
|
/**
|
|
@@ -79,7 +79,7 @@ function LineHighlightPlot(props) {
|
|
|
79
79
|
const yScale = yAxis[yAxisKey].scale;
|
|
80
80
|
const xData = xAxis[xAxisKey].data;
|
|
81
81
|
if (xData === undefined) {
|
|
82
|
-
throw new Error(`MUI
|
|
82
|
+
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
83
83
|
}
|
|
84
84
|
const x = xScale(xData[highlightedIndex]);
|
|
85
85
|
const y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -70,10 +70,10 @@ function LinePlot(props) {
|
|
|
70
70
|
const xData = xAxis[xAxisKey].data;
|
|
71
71
|
if (process.env.NODE_ENV !== 'production') {
|
|
72
72
|
if (xData === undefined) {
|
|
73
|
-
throw new Error(`MUI
|
|
73
|
+
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
74
74
|
}
|
|
75
75
|
if (xData.length < stackedData.length) {
|
|
76
|
-
throw new Error(`MUI
|
|
76
|
+
throw new Error(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
const linePath = (0, _d3Shape.line)().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y(d => yScale(d.y[1]));
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -85,7 +85,7 @@ function MarkPlot(props) {
|
|
|
85
85
|
return true;
|
|
86
86
|
};
|
|
87
87
|
if (xData === undefined) {
|
|
88
|
-
throw new Error(`MUI
|
|
88
|
+
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
89
89
|
}
|
|
90
90
|
return xData?.map((x, index) => {
|
|
91
91
|
const value = data[index] == null ? null : stackedData[index][1];
|
package/LineChart/formatter.js
CHANGED
|
@@ -34,7 +34,7 @@ const formatter = (params, dataset) => {
|
|
|
34
34
|
}
|
|
35
35
|
});
|
|
36
36
|
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
37
|
-
throw new Error([`MUI
|
|
37
|
+
throw new Error([`MUI X Charts: line series with id='${id}' has no data.`, 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
38
38
|
}
|
|
39
39
|
});
|
|
40
40
|
const completedSeries = {};
|
|
@@ -61,7 +61,7 @@ const formatter = (params, dataset) => {
|
|
|
61
61
|
warnedOnce = true;
|
|
62
62
|
console.error([`MUI-X charts: your dataset key "${dataKey}" is used for plotting line, but contains nonnumerical elements.`, 'Line plots only support numbers and null values.']);
|
|
63
63
|
}
|
|
64
|
-
return
|
|
64
|
+
return null;
|
|
65
65
|
}
|
|
66
66
|
return value;
|
|
67
67
|
}) : series[id].data,
|
|
@@ -23,6 +23,7 @@ export type PieArcLabelProps = PieArcLabelOwnerState & React.ComponentPropsWitho
|
|
|
23
23
|
endAngle: SpringValue<number>;
|
|
24
24
|
innerRadius: SpringValue<number>;
|
|
25
25
|
outerRadius: SpringValue<number>;
|
|
26
|
+
arcLabelRadius: SpringValue<number>;
|
|
26
27
|
cornerRadius: SpringValue<number>;
|
|
27
28
|
paddingAngle: SpringValue<number>;
|
|
28
29
|
} & {
|
package/PieChart/PieArcLabel.js
CHANGED
|
@@ -18,7 +18,7 @@ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateU
|
|
|
18
18
|
var _styles = require("@mui/material/styles");
|
|
19
19
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "
|
|
21
|
+
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
22
22
|
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); }
|
|
23
23
|
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 && Object.prototype.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; }
|
|
24
24
|
function getPieArcLabelUtilityClass(slot) {
|
|
@@ -52,7 +52,7 @@ const PieArcLabelRoot = (0, _styles.styled)(_web.animated.text, {
|
|
|
52
52
|
* Helper to compute label position.
|
|
53
53
|
* It's not an inline function because we need it in inerpolation.
|
|
54
54
|
*/
|
|
55
|
-
const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle,
|
|
55
|
+
const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle, padAngle, arcLabelRadius, cornerRadius) => {
|
|
56
56
|
if (!formattedArcLabel) {
|
|
57
57
|
return 0;
|
|
58
58
|
}
|
|
@@ -60,8 +60,8 @@ const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle,
|
|
|
60
60
|
padAngle,
|
|
61
61
|
startAngle,
|
|
62
62
|
endAngle,
|
|
63
|
-
innerRadius,
|
|
64
|
-
outerRadius
|
|
63
|
+
innerRadius: arcLabelRadius,
|
|
64
|
+
outerRadius: arcLabelRadius
|
|
65
65
|
});
|
|
66
66
|
if (variable === 'x') {
|
|
67
67
|
return x;
|
|
@@ -76,8 +76,7 @@ function PieArcLabel(props) {
|
|
|
76
76
|
startAngle,
|
|
77
77
|
endAngle,
|
|
78
78
|
paddingAngle,
|
|
79
|
-
|
|
80
|
-
outerRadius,
|
|
79
|
+
arcLabelRadius,
|
|
81
80
|
cornerRadius,
|
|
82
81
|
formattedArcLabel,
|
|
83
82
|
isHighlighted,
|
|
@@ -97,8 +96,8 @@ function PieArcLabel(props) {
|
|
|
97
96
|
className: classes.root
|
|
98
97
|
}, other, {
|
|
99
98
|
style: (0, _extends2.default)({
|
|
100
|
-
x: (0, _web.to)([startAngle, endAngle, paddingAngle,
|
|
101
|
-
y: (0, _web.to)([startAngle, endAngle, paddingAngle,
|
|
99
|
+
x: (0, _web.to)([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
|
|
100
|
+
y: (0, _web.to)([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
|
|
102
101
|
}, style),
|
|
103
102
|
children: formattedArcLabel
|
|
104
103
|
}));
|
|
@@ -8,6 +8,11 @@ export interface PieArcLabelPlotSlotProps {
|
|
|
8
8
|
pieArcLabel?: Partial<PieArcLabelProps>;
|
|
9
9
|
}
|
|
10
10
|
export interface PieArcLabelPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'arcLabel' | 'arcLabelMinAngle' | 'id' | 'highlightScope'>, ComputedPieRadius {
|
|
11
|
+
/**
|
|
12
|
+
* Override the arc attibutes when it is faded.
|
|
13
|
+
* @default { additionalRadius: -5 }
|
|
14
|
+
*/
|
|
15
|
+
faded?: DefaultizedPieSeriesType['faded'];
|
|
11
16
|
/**
|
|
12
17
|
* Overridable component slots.
|
|
13
18
|
* @default {}
|
|
@@ -14,8 +14,8 @@ var _transition = require("./dataTransform/transition");
|
|
|
14
14
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
15
15
|
var _PieArcLabel = require("./PieArcLabel");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
18
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
17
|
+
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
18
|
+
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
|
|
19
19
|
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); }
|
|
20
20
|
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 && Object.prototype.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; }
|
|
21
21
|
const RATIO = 180 / Math.PI;
|
|
@@ -36,8 +36,9 @@ function PieArcLabelPlot(props) {
|
|
|
36
36
|
const {
|
|
37
37
|
slots,
|
|
38
38
|
slotProps,
|
|
39
|
-
innerRadius
|
|
39
|
+
innerRadius,
|
|
40
40
|
outerRadius,
|
|
41
|
+
arcLabelRadius,
|
|
41
42
|
cornerRadius = 0,
|
|
42
43
|
paddingAngle = 0,
|
|
43
44
|
id,
|
|
@@ -55,6 +56,7 @@ function PieArcLabelPlot(props) {
|
|
|
55
56
|
const transformedData = (0, _useTransformData.useTransformData)({
|
|
56
57
|
innerRadius,
|
|
57
58
|
outerRadius,
|
|
59
|
+
arcLabelRadius,
|
|
58
60
|
cornerRadius,
|
|
59
61
|
paddingAngle,
|
|
60
62
|
id,
|
|
@@ -78,6 +80,7 @@ function PieArcLabelPlot(props) {
|
|
|
78
80
|
paddingAngle: pA,
|
|
79
81
|
innerRadius: iR,
|
|
80
82
|
outerRadius: oR,
|
|
83
|
+
arcLabelRadius: aLR,
|
|
81
84
|
cornerRadius: cR
|
|
82
85
|
} = _ref,
|
|
83
86
|
style = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded2);
|
|
@@ -87,6 +90,7 @@ function PieArcLabelPlot(props) {
|
|
|
87
90
|
paddingAngle: pA,
|
|
88
91
|
innerRadius: iR,
|
|
89
92
|
outerRadius: oR,
|
|
93
|
+
arcLabelRadius: aLR,
|
|
90
94
|
cornerRadius: cR,
|
|
91
95
|
style: style,
|
|
92
96
|
id: id,
|
|
@@ -109,8 +113,14 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
109
113
|
arcLabel: _propTypes.default.oneOfType([_propTypes.default.oneOf(['formattedValue', 'label', 'value']), _propTypes.default.func]),
|
|
110
114
|
/**
|
|
111
115
|
* The minimal angle required to display the arc label.
|
|
116
|
+
* @default 0
|
|
112
117
|
*/
|
|
113
118
|
arcLabelMinAngle: _propTypes.default.number,
|
|
119
|
+
/**
|
|
120
|
+
* The radius between circle center and the arc label in px.
|
|
121
|
+
* @default (innerRadius - outerRadius) / 2
|
|
122
|
+
*/
|
|
123
|
+
arcLabelRadius: _propTypes.default.number,
|
|
114
124
|
/**
|
|
115
125
|
* The radius applied to arc corners (similar to border radius).
|
|
116
126
|
* @default 0
|
|
@@ -129,9 +139,11 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
129
139
|
})).isRequired,
|
|
130
140
|
/**
|
|
131
141
|
* Override the arc attibutes when it is faded.
|
|
142
|
+
* @default { additionalRadius: -5 }
|
|
132
143
|
*/
|
|
133
144
|
faded: _propTypes.default.shape({
|
|
134
145
|
additionalRadius: _propTypes.default.number,
|
|
146
|
+
arcLabelRadius: _propTypes.default.number,
|
|
135
147
|
color: _propTypes.default.string,
|
|
136
148
|
cornerRadius: _propTypes.default.number,
|
|
137
149
|
innerRadius: _propTypes.default.number,
|
|
@@ -143,6 +155,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
143
155
|
*/
|
|
144
156
|
highlighted: _propTypes.default.shape({
|
|
145
157
|
additionalRadius: _propTypes.default.number,
|
|
158
|
+
arcLabelRadius: _propTypes.default.number,
|
|
146
159
|
color: _propTypes.default.string,
|
|
147
160
|
cornerRadius: _propTypes.default.number,
|
|
148
161
|
innerRadius: _propTypes.default.number,
|
package/PieChart/PieArcPlot.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ export interface PieArcPlotSlotProps {
|
|
|
8
8
|
pieArc?: Partial<PieArcProps>;
|
|
9
9
|
}
|
|
10
10
|
export interface PieArcPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'id' | 'highlightScope'>, ComputedPieRadius {
|
|
11
|
+
/**
|
|
12
|
+
* Override the arc attibutes when it is faded.
|
|
13
|
+
* @default { additionalRadius: -5 }
|
|
14
|
+
*/
|
|
15
|
+
faded?: DefaultizedPieSeriesType['faded'];
|
|
11
16
|
/**
|
|
12
17
|
* Overridable component slots.
|
|
13
18
|
* @default {}
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -15,7 +15,7 @@ var _transition = require("./dataTransform/transition");
|
|
|
15
15
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onClick", "skipAnimation"],
|
|
18
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
18
|
+
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
|
|
19
19
|
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); }
|
|
20
20
|
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 && Object.prototype.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; }
|
|
21
21
|
function PieArcPlot(props) {
|
|
@@ -96,6 +96,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
96
96
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
97
97
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
98
98
|
// ----------------------------------------------------------------------
|
|
99
|
+
/**
|
|
100
|
+
* The radius between circle center and the arc label in px.
|
|
101
|
+
* @default (innerRadius - outerRadius) / 2
|
|
102
|
+
*/
|
|
103
|
+
arcLabelRadius: _propTypes.default.number,
|
|
99
104
|
/**
|
|
100
105
|
* The radius applied to arc corners (similar to border radius).
|
|
101
106
|
* @default 0
|
|
@@ -114,9 +119,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
114
119
|
})).isRequired,
|
|
115
120
|
/**
|
|
116
121
|
* Override the arc attibutes when it is faded.
|
|
122
|
+
* @default { additionalRadius: -5 }
|
|
117
123
|
*/
|
|
118
124
|
faded: _propTypes.default.shape({
|
|
119
125
|
additionalRadius: _propTypes.default.number,
|
|
126
|
+
arcLabelRadius: _propTypes.default.number,
|
|
120
127
|
color: _propTypes.default.string,
|
|
121
128
|
cornerRadius: _propTypes.default.number,
|
|
122
129
|
innerRadius: _propTypes.default.number,
|
|
@@ -128,6 +135,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
128
135
|
*/
|
|
129
136
|
highlighted: _propTypes.default.shape({
|
|
130
137
|
additionalRadius: _propTypes.default.number,
|
|
138
|
+
arcLabelRadius: _propTypes.default.number,
|
|
131
139
|
color: _propTypes.default.string,
|
|
132
140
|
cornerRadius: _propTypes.default.number,
|
|
133
141
|
innerRadius: _propTypes.default.number,
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -8,12 +8,24 @@ import { ChartsLegendProps, ChartsLegendSlotProps, ChartsLegendSlots } from '../
|
|
|
8
8
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
9
9
|
import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from './PiePlot';
|
|
10
10
|
import { PieValueType } from '../models/seriesType/pie';
|
|
11
|
-
import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
11
|
+
import { ChartsAxisSlots, ChartsAxisSlotProps, ChartsXAxisProps, ChartsYAxisProps } from '../models/axis';
|
|
12
12
|
export interface PieChartSlots extends ChartsAxisSlots, PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots {
|
|
13
13
|
}
|
|
14
14
|
export interface PieChartSlotProps extends ChartsAxisSlotProps, PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps {
|
|
15
15
|
}
|
|
16
|
-
export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
16
|
+
export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
17
|
+
/**
|
|
18
|
+
* Indicate which axis to display the bottom of the charts.
|
|
19
|
+
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
20
|
+
* @default null
|
|
21
|
+
*/
|
|
22
|
+
bottomAxis?: null | string | ChartsXAxisProps;
|
|
23
|
+
/**
|
|
24
|
+
* Indicate which axis to display the left of the charts.
|
|
25
|
+
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
26
|
+
* @default null
|
|
27
|
+
*/
|
|
28
|
+
leftAxis?: null | string | ChartsYAxisProps;
|
|
17
29
|
series: MakeOptional<PieSeriesType<MakeOptional<PieValueType, 'id'>>, 'type'>[];
|
|
18
30
|
tooltip?: ChartsTooltipProps;
|
|
19
31
|
axisHighlight?: ChartsAxisHighlightProps;
|
package/PieChart/PieChart.js
CHANGED
|
@@ -116,7 +116,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
116
116
|
/**
|
|
117
117
|
* Indicate which axis to display the bottom of the charts.
|
|
118
118
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
119
|
-
* @default
|
|
119
|
+
* @default null
|
|
120
120
|
*/
|
|
121
121
|
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
122
122
|
axisId: _propTypes.default.string,
|
|
@@ -144,6 +144,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
144
144
|
className: _propTypes.default.string,
|
|
145
145
|
/**
|
|
146
146
|
* Color palette used to colorize multiple series.
|
|
147
|
+
* @default blueberryTwilightPalette
|
|
147
148
|
*/
|
|
148
149
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
149
150
|
/**
|
|
@@ -165,7 +166,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
165
166
|
/**
|
|
166
167
|
* Indicate which axis to display the left of the charts.
|
|
167
168
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
168
|
-
* @default
|
|
169
|
+
* @default null
|
|
169
170
|
*/
|
|
170
171
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
171
172
|
axisId: _propTypes.default.string,
|
|
@@ -246,6 +247,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
246
247
|
series: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
247
248
|
arcLabel: _propTypes.default.oneOfType([_propTypes.default.oneOf(['formattedValue', 'label', 'value']), _propTypes.default.func]),
|
|
248
249
|
arcLabelMinAngle: _propTypes.default.number,
|
|
250
|
+
arcLabelRadius: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
249
251
|
color: _propTypes.default.string,
|
|
250
252
|
cornerRadius: _propTypes.default.number,
|
|
251
253
|
cx: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
@@ -259,6 +261,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
259
261
|
endAngle: _propTypes.default.number,
|
|
260
262
|
faded: _propTypes.default.shape({
|
|
261
263
|
additionalRadius: _propTypes.default.number,
|
|
264
|
+
arcLabelRadius: _propTypes.default.number,
|
|
262
265
|
color: _propTypes.default.string,
|
|
263
266
|
cornerRadius: _propTypes.default.number,
|
|
264
267
|
innerRadius: _propTypes.default.number,
|
|
@@ -267,6 +270,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
267
270
|
}),
|
|
268
271
|
highlighted: _propTypes.default.shape({
|
|
269
272
|
additionalRadius: _propTypes.default.number,
|
|
273
|
+
arcLabelRadius: _propTypes.default.number,
|
|
270
274
|
color: _propTypes.default.string,
|
|
271
275
|
cornerRadius: _propTypes.default.number,
|
|
272
276
|
innerRadius: _propTypes.default.number,
|
package/PieChart/PiePlot.js
CHANGED
|
@@ -87,6 +87,7 @@ function PiePlot(props) {
|
|
|
87
87
|
const {
|
|
88
88
|
innerRadius: innerRadiusParam,
|
|
89
89
|
outerRadius: outerRadiusParam,
|
|
90
|
+
arcLabelRadius: arcLabelRadiusParam,
|
|
90
91
|
cornerRadius,
|
|
91
92
|
paddingAngle,
|
|
92
93
|
arcLabel,
|
|
@@ -98,6 +99,7 @@ function PiePlot(props) {
|
|
|
98
99
|
} = series[seriesId];
|
|
99
100
|
const outerRadius = (0, _utils.getPercentageValue)(outerRadiusParam ?? availableRadius, availableRadius);
|
|
100
101
|
const innerRadius = (0, _utils.getPercentageValue)(innerRadiusParam ?? 0, availableRadius);
|
|
102
|
+
const arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : (0, _utils.getPercentageValue)(arcLabelRadiusParam, availableRadius);
|
|
101
103
|
const cx = (0, _utils.getPercentageValue)(cxParam ?? '50%', width);
|
|
102
104
|
const cy = (0, _utils.getPercentageValue)(cyParam ?? '50%', height);
|
|
103
105
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
@@ -105,6 +107,7 @@ function PiePlot(props) {
|
|
|
105
107
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_PieArcLabelPlot.PieArcLabelPlot, {
|
|
106
108
|
innerRadius: innerRadius,
|
|
107
109
|
outerRadius: outerRadius ?? availableRadius,
|
|
110
|
+
arcLabelRadius: arcLabelRadius,
|
|
108
111
|
cornerRadius: cornerRadius,
|
|
109
112
|
paddingAngle: paddingAngle,
|
|
110
113
|
id: seriesId,
|
|
@@ -76,6 +76,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
76
76
|
from: ({
|
|
77
77
|
innerRadius,
|
|
78
78
|
outerRadius,
|
|
79
|
+
arcLabelRadius,
|
|
79
80
|
cornerRadius,
|
|
80
81
|
startAngle,
|
|
81
82
|
endAngle,
|
|
@@ -84,6 +85,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
84
85
|
innerRadius,
|
|
85
86
|
outerRadius: (innerRadius + outerRadius) / 2,
|
|
86
87
|
cornerRadius,
|
|
88
|
+
arcLabelRadius,
|
|
87
89
|
startAngle: (startAngle + endAngle) / 2,
|
|
88
90
|
endAngle: (startAngle + endAngle) / 2,
|
|
89
91
|
paddingAngle,
|
|
@@ -96,6 +98,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
96
98
|
}) => ({
|
|
97
99
|
innerRadius,
|
|
98
100
|
outerRadius: innerRadius,
|
|
101
|
+
arcLabelRadius: innerRadius,
|
|
99
102
|
startAngle: (startAngle + endAngle) / 2,
|
|
100
103
|
endAngle: (startAngle + endAngle) / 2,
|
|
101
104
|
opacity: 0
|
|
@@ -104,12 +107,14 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
104
107
|
innerRadius,
|
|
105
108
|
outerRadius,
|
|
106
109
|
startAngle,
|
|
107
|
-
endAngle
|
|
110
|
+
endAngle,
|
|
111
|
+
arcLabelRadius
|
|
108
112
|
}) => ({
|
|
109
113
|
innerRadius,
|
|
110
114
|
outerRadius,
|
|
111
115
|
startAngle,
|
|
112
116
|
endAngle,
|
|
117
|
+
arcLabelRadius,
|
|
113
118
|
opacity: 1
|
|
114
119
|
}),
|
|
115
120
|
update: ({
|
|
@@ -118,7 +123,8 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
118
123
|
cornerRadius,
|
|
119
124
|
startAngle,
|
|
120
125
|
endAngle,
|
|
121
|
-
paddingAngle
|
|
126
|
+
paddingAngle,
|
|
127
|
+
arcLabelRadius
|
|
122
128
|
}) => ({
|
|
123
129
|
innerRadius,
|
|
124
130
|
outerRadius,
|
|
@@ -126,6 +132,7 @@ const defaultLabelTransitionConfig = exports.defaultLabelTransitionConfig = {
|
|
|
126
132
|
startAngle,
|
|
127
133
|
endAngle,
|
|
128
134
|
paddingAngle,
|
|
135
|
+
arcLabelRadius,
|
|
129
136
|
opacity: 1
|
|
130
137
|
}),
|
|
131
138
|
config: {
|
|
@@ -20,6 +20,7 @@ function useTransformData(series) {
|
|
|
20
20
|
highlighted,
|
|
21
21
|
paddingAngle: basePaddingAngle = 0,
|
|
22
22
|
innerRadius: baseInnerRadius = 0,
|
|
23
|
+
arcLabelRadius: baseArcLabelRadius,
|
|
23
24
|
outerRadius: baseOuterRadius,
|
|
24
25
|
cornerRadius: baseCornerRadius = 0
|
|
25
26
|
} = series;
|
|
@@ -47,21 +48,23 @@ function useTransformData(series) {
|
|
|
47
48
|
isHighlighted,
|
|
48
49
|
isFaded
|
|
49
50
|
} = getHighlightStatus(itemIndex);
|
|
50
|
-
const
|
|
51
|
+
const attributesOverride = (0, _extends2.default)({
|
|
51
52
|
additionalRadius: 0
|
|
52
53
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
53
|
-
const paddingAngle = Math.max(0, Math.PI * (
|
|
54
|
-
const innerRadius = Math.max(0,
|
|
55
|
-
const outerRadius = Math.max(0,
|
|
56
|
-
const cornerRadius =
|
|
57
|
-
|
|
54
|
+
const paddingAngle = Math.max(0, Math.PI * (attributesOverride.paddingAngle ?? basePaddingAngle) / 180);
|
|
55
|
+
const innerRadius = Math.max(0, attributesOverride.innerRadius ?? baseInnerRadius);
|
|
56
|
+
const outerRadius = Math.max(0, attributesOverride.outerRadius ?? baseOuterRadius + attributesOverride.additionalRadius);
|
|
57
|
+
const cornerRadius = attributesOverride.cornerRadius ?? baseCornerRadius;
|
|
58
|
+
const arcLabelRadius = attributesOverride.arcLabelRadius ?? baseArcLabelRadius ?? (innerRadius + outerRadius) / 2;
|
|
59
|
+
return (0, _extends2.default)({}, item, attributesOverride, {
|
|
58
60
|
isFaded,
|
|
59
61
|
isHighlighted,
|
|
60
62
|
paddingAngle,
|
|
61
63
|
innerRadius,
|
|
62
64
|
outerRadius,
|
|
63
|
-
cornerRadius
|
|
65
|
+
cornerRadius,
|
|
66
|
+
arcLabelRadius
|
|
64
67
|
});
|
|
65
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, data, faded, getHighlightStatus, highlighted]);
|
|
68
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, getHighlightStatus, highlighted]);
|
|
66
69
|
return dataWithHighlight;
|
|
67
70
|
}
|
|
@@ -69,11 +69,11 @@ const useChartDimensions = (inWidth, inHeight) => {
|
|
|
69
69
|
}, [computeSize, inHeight, inWidth]);
|
|
70
70
|
if (process.env.NODE_ENV !== 'production') {
|
|
71
71
|
if (displayError.current && inWidth === undefined && width === 0) {
|
|
72
|
-
console.error(`MUI
|
|
72
|
+
console.error(`MUI X Charts: ChartContainer does not have \`width\` prop, and its container has no \`width\` defined.`);
|
|
73
73
|
displayError.current = false;
|
|
74
74
|
}
|
|
75
75
|
if (displayError.current && inHeight === undefined && height === 0) {
|
|
76
|
-
console.error(`MUI
|
|
76
|
+
console.error(`MUI X Charts: ChartContainer does not have \`height\` prop, and its container has no \`height\` defined.`);
|
|
77
77
|
displayError.current = false;
|
|
78
78
|
}
|
|
79
79
|
}
|
|
@@ -126,6 +126,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
126
126
|
className: _propTypes.default.string,
|
|
127
127
|
/**
|
|
128
128
|
* Color palette used to colorize multiple series.
|
|
129
|
+
* @default blueberryTwilightPalette
|
|
129
130
|
*/
|
|
130
131
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
131
132
|
/**
|
|
@@ -5,6 +5,7 @@ import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
|
5
5
|
import { AxisConfig } from '../models/axis';
|
|
6
6
|
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { LineSeriesType } from '../models/seriesType/line';
|
|
8
|
+
import { CardinalDirections } from '../models/layout';
|
|
8
9
|
import { AreaPlotSlots, AreaPlotSlotProps } from '../LineChart/AreaPlot';
|
|
9
10
|
import { LinePlotSlots, LinePlotSlotProps } from '../LineChart/LinePlot';
|
|
10
11
|
import { MarkPlotSlots, MarkPlotSlotProps } from '../LineChart/MarkPlot';
|
|
@@ -14,7 +15,7 @@ export interface SparkLineChartSlots extends AreaPlotSlots, LinePlotSlots, MarkP
|
|
|
14
15
|
}
|
|
15
16
|
export interface SparkLineChartSlotProps extends AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, BarPlotSlotProps, ChartsTooltipSlotProps {
|
|
16
17
|
}
|
|
17
|
-
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis'> {
|
|
18
|
+
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis' | 'margin'> {
|
|
18
19
|
/**
|
|
19
20
|
* The xAxis configuration.
|
|
20
21
|
* Notice it is a single configuration object, not an array of configuration.
|
|
@@ -35,6 +36,7 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
35
36
|
* Formatter used by the tooltip.
|
|
36
37
|
* @param {number} value The value to format.
|
|
37
38
|
* @returns {string} the formatted value.
|
|
39
|
+
* @default (v: number) => v.toString()
|
|
38
40
|
*/
|
|
39
41
|
valueFormatter?: (value: number) => string;
|
|
40
42
|
/**
|
|
@@ -59,6 +61,18 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
59
61
|
* @default 'linear'
|
|
60
62
|
*/
|
|
61
63
|
curve?: LineSeriesType['curve'];
|
|
64
|
+
/**
|
|
65
|
+
* The margin between the SVG and the drawing area.
|
|
66
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
67
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
68
|
+
* @default {
|
|
69
|
+
* top: 5,
|
|
70
|
+
* bottom: 5,
|
|
71
|
+
* left: 5,
|
|
72
|
+
* right: 5,
|
|
73
|
+
* }
|
|
74
|
+
*/
|
|
75
|
+
margin?: Partial<CardinalDirections<number>>;
|
|
62
76
|
/**
|
|
63
77
|
* Overridable component slots.
|
|
64
78
|
* @default {}
|
|
@@ -128,6 +128,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
128
128
|
className: _propTypes.default.string,
|
|
129
129
|
/**
|
|
130
130
|
* Color palette used to colorize multiple series.
|
|
131
|
+
* @default blueberryTwilightPalette
|
|
131
132
|
*/
|
|
132
133
|
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
133
134
|
/**
|
|
@@ -158,7 +159,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
158
159
|
* The margin between the SVG and the drawing area.
|
|
159
160
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
160
161
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
161
|
-
* @default
|
|
162
|
+
* @default {
|
|
163
|
+
* top: 5,
|
|
164
|
+
* bottom: 5,
|
|
165
|
+
* left: 5,
|
|
166
|
+
* right: 5,
|
|
167
|
+
* }
|
|
162
168
|
*/
|
|
163
169
|
margin: _propTypes.default.shape({
|
|
164
170
|
bottom: _propTypes.default.number,
|
|
@@ -207,6 +213,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
207
213
|
* Formatter used by the tooltip.
|
|
208
214
|
* @param {number} value The value to format.
|
|
209
215
|
* @returns {string} the formatted value.
|
|
216
|
+
* @default (v: number) => v.toString()
|
|
210
217
|
*/
|
|
211
218
|
valueFormatter: _propTypes.default.func,
|
|
212
219
|
viewBox: _propTypes.default.shape({
|
|
@@ -50,7 +50,7 @@ export declare const CartesianContext: React.Context<{
|
|
|
50
50
|
*
|
|
51
51
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
52
52
|
*/
|
|
53
|
-
declare function CartesianContextProvider(
|
|
53
|
+
declare function CartesianContextProvider(props: CartesianContextProviderProps): React.JSX.Element;
|
|
54
54
|
declare namespace CartesianContextProvider {
|
|
55
55
|
var propTypes: any;
|
|
56
56
|
}
|
|
@@ -48,12 +48,13 @@ const CartesianContext = exports.CartesianContext = /*#__PURE__*/React.createCon
|
|
|
48
48
|
*
|
|
49
49
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
50
50
|
*/
|
|
51
|
-
function CartesianContextProvider({
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
51
|
+
function CartesianContextProvider(props) {
|
|
52
|
+
const {
|
|
53
|
+
xAxis: inXAxis,
|
|
54
|
+
yAxis: inYAxis,
|
|
55
|
+
dataset,
|
|
56
|
+
children
|
|
57
|
+
} = props;
|
|
57
58
|
const formattedSeries = React.useContext(_SeriesContextProvider.SeriesContext);
|
|
58
59
|
const drawingArea = React.useContext(_DrawingProvider.DrawingContext);
|
|
59
60
|
const xAxis = React.useMemo(() => inXAxis?.map(axisConfig => {
|
|
@@ -62,7 +63,7 @@ function CartesianContextProvider({
|
|
|
62
63
|
return axisConfig;
|
|
63
64
|
}
|
|
64
65
|
if (dataset === undefined) {
|
|
65
|
-
throw Error('MUI
|
|
66
|
+
throw Error('MUI X Charts: x-axis uses `dataKey` but no `dataset` is provided.');
|
|
66
67
|
}
|
|
67
68
|
return (0, _extends2.default)({}, axisConfig, {
|
|
68
69
|
data: dataset.map(d => d[dataKey])
|
|
@@ -74,7 +75,7 @@ function CartesianContextProvider({
|
|
|
74
75
|
return axisConfig;
|
|
75
76
|
}
|
|
76
77
|
if (dataset === undefined) {
|
|
77
|
-
throw Error('MUI
|
|
78
|
+
throw Error('MUI X Charts: y-axis uses `dataKey` but no `dataset` is provided.');
|
|
78
79
|
}
|
|
79
80
|
return (0, _extends2.default)({}, axisConfig, {
|
|
80
81
|
data: dataset.map(d => d[dataKey])
|
|
@@ -40,7 +40,7 @@ export declare const SVGContext: React.Context<React.RefObject<SVGSVGElement>>;
|
|
|
40
40
|
*
|
|
41
41
|
* - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
|
|
42
42
|
*/
|
|
43
|
-
declare function DrawingProvider(
|
|
43
|
+
declare function DrawingProvider(props: DrawingProviderProps): React.JSX.Element;
|
|
44
44
|
declare namespace DrawingProvider {
|
|
45
45
|
var propTypes: any;
|
|
46
46
|
}
|