@mui/x-charts 6.19.1 → 6.19.3
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/CHANGELOG.md +84 -0
- package/ChartsLegend/ChartsLegend.d.ts +5 -2
- package/ChartsLegend/ChartsLegend.js +137 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/ChartsSurface.d.ts +2 -2
- package/ChartsSurface.js +33 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/LineChart/LineChart.d.ts +1 -0
- package/LineChart/LineChart.js +2 -0
- package/PieChart/PieArcLabelPlot.d.ts +5 -0
- package/PieChart/PieArcLabelPlot.js +2 -0
- package/PieChart/PieArcPlot.d.ts +5 -0
- package/PieChart/PieArcPlot.js +1 -0
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +3 -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 +7 -6
- 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 +7 -6
- package/esm/BarChart/BarChart.js +1 -0
- package/esm/ChartsLegend/ChartsLegend.js +139 -2
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/esm/ChartsSurface.js +35 -2
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/PieChart/PieArcLabelPlot.js +2 -0
- package/esm/PieChart/PieArcPlot.js +1 -0
- package/esm/PieChart/PieChart.js +3 -2
- package/esm/ScatterChart/ScatterChart.js +1 -0
- package/esm/SparkLineChart/SparkLineChart.js +8 -1
- package/esm/context/CartesianContextProvider.js +7 -6
- 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 +9 -7
- package/esm/hooks/useDrawingArea.js +7 -3
- package/esm/index.js +2 -0
- package/hooks/useDrawingArea.d.ts +2 -0
- package/hooks/useDrawingArea.js +7 -3
- package/index.d.ts +2 -0
- package/index.js +23 -1
- package/legacy/BarChart/BarChart.js +1 -0
- package/legacy/ChartsLegend/ChartsLegend.js +139 -2
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +5 -3
- package/legacy/ChartsReferenceLine/common.js +3 -4
- package/legacy/ChartsSurface.js +35 -2
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +8 -7
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/legacy/LineChart/LineChart.js +2 -0
- package/legacy/PieChart/PieArcLabelPlot.js +2 -0
- package/legacy/PieChart/PieArcPlot.js +1 -0
- package/legacy/PieChart/PieChart.js +3 -2
- package/legacy/ScatterChart/ScatterChart.js +1 -0
- package/legacy/SparkLineChart/SparkLineChart.js +8 -1
- package/legacy/context/CartesianContextProvider.js +15 -15
- 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 +8 -7
- package/legacy/hooks/useDrawingArea.js +7 -3
- package/legacy/index.js +3 -1
- package/legacy/internals/components/AxisSharedComponents.js +5 -6
- package/models/seriesType/pie.d.ts +1 -0
- package/modern/BarChart/BarChart.js +1 -0
- package/modern/ChartsLegend/ChartsLegend.js +139 -2
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +7 -3
- package/modern/ChartsSurface.js +35 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +2 -54
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -1
- package/modern/ChartsTooltip/ChartsTooltipTable.js +2 -0
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +2 -54
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +15 -1
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/PieChart/PieArcLabelPlot.js +2 -0
- package/modern/PieChart/PieArcPlot.js +1 -0
- package/modern/PieChart/PieChart.js +3 -2
- package/modern/ScatterChart/ScatterChart.js +1 -0
- package/modern/SparkLineChart/SparkLineChart.js +8 -1
- package/modern/context/CartesianContextProvider.js +7 -6
- 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 +9 -7
- package/modern/hooks/useDrawingArea.js +7 -3
- package/modern/index.js +3 -1
- package/package.json +1 -1
|
@@ -125,6 +125,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
125
125
|
className: PropTypes.string,
|
|
126
126
|
/**
|
|
127
127
|
* Color palette used to colorize multiple series.
|
|
128
|
+
* @default blueberryTwilightPalette
|
|
128
129
|
*/
|
|
129
130
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
130
131
|
/**
|
|
@@ -155,7 +156,12 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
155
156
|
* The margin between the SVG and the drawing area.
|
|
156
157
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
157
158
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
158
|
-
* @default
|
|
159
|
+
* @default {
|
|
160
|
+
* top: 5,
|
|
161
|
+
* bottom: 5,
|
|
162
|
+
* left: 5,
|
|
163
|
+
* right: 5,
|
|
164
|
+
* }
|
|
159
165
|
*/
|
|
160
166
|
margin: PropTypes.shape({
|
|
161
167
|
bottom: PropTypes.number,
|
|
@@ -204,6 +210,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
204
210
|
* Formatter used by the tooltip.
|
|
205
211
|
* @param {number} value The value to format.
|
|
206
212
|
* @returns {string} the formatted value.
|
|
213
|
+
* @default (v: number) => v.toString()
|
|
207
214
|
*/
|
|
208
215
|
valueFormatter: PropTypes.func,
|
|
209
216
|
viewBox: PropTypes.shape({
|
|
@@ -40,11 +40,11 @@ export var CartesianContext = /*#__PURE__*/React.createContext({
|
|
|
40
40
|
*
|
|
41
41
|
* - [CartesianContextProvider API](https://mui.com/x/api/charts/cartesian-context-provider/)
|
|
42
42
|
*/
|
|
43
|
-
function CartesianContextProvider(
|
|
44
|
-
var inXAxis =
|
|
45
|
-
inYAxis =
|
|
46
|
-
dataset =
|
|
47
|
-
children =
|
|
43
|
+
function CartesianContextProvider(props) {
|
|
44
|
+
var inXAxis = props.xAxis,
|
|
45
|
+
inYAxis = props.yAxis,
|
|
46
|
+
dataset = props.dataset,
|
|
47
|
+
children = props.children;
|
|
48
48
|
var formattedSeries = React.useContext(SeriesContext);
|
|
49
49
|
var drawingArea = React.useContext(DrawingContext);
|
|
50
50
|
var xAxis = React.useMemo(function () {
|
|
@@ -82,9 +82,9 @@ function CartesianContextProvider(_ref) {
|
|
|
82
82
|
var value = React.useMemo(function () {
|
|
83
83
|
var _xAxis$map, _yAxis$map;
|
|
84
84
|
var axisExtremumCallback = function axisExtremumCallback(acc, chartType, axis, getters, isDefaultAxis) {
|
|
85
|
-
var
|
|
85
|
+
var _ref, _formattedSeries$char;
|
|
86
86
|
var getter = getters[chartType];
|
|
87
|
-
var series = (
|
|
87
|
+
var series = (_ref = (_formattedSeries$char = formattedSeries[chartType]) == null ? void 0 : _formattedSeries$char.series) != null ? _ref : {};
|
|
88
88
|
var _getter = getter({
|
|
89
89
|
series: series,
|
|
90
90
|
axis: axis,
|
|
@@ -114,8 +114,8 @@ function CartesianContextProvider(_ref) {
|
|
|
114
114
|
return _extends({
|
|
115
115
|
id: "deaultized-x-axis-".concat(index)
|
|
116
116
|
}, axis);
|
|
117
|
-
})) != null ? _xAxis$map : []), _toConsumableArray(xAxis === undefined || xAxis.findIndex(function (
|
|
118
|
-
var id =
|
|
117
|
+
})) != null ? _xAxis$map : []), _toConsumableArray(xAxis === undefined || xAxis.findIndex(function (_ref2) {
|
|
118
|
+
var id = _ref2.id;
|
|
119
119
|
return id === DEFAULT_X_AXIS_KEY;
|
|
120
120
|
}) === -1 ? [{
|
|
121
121
|
id: DEFAULT_X_AXIS_KEY,
|
|
@@ -171,8 +171,8 @@ function CartesianContextProvider(_ref) {
|
|
|
171
171
|
return _extends({
|
|
172
172
|
id: "deaultized-y-axis-".concat(index)
|
|
173
173
|
}, axis);
|
|
174
|
-
})) != null ? _yAxis$map : []), _toConsumableArray(yAxis === undefined || yAxis.findIndex(function (
|
|
175
|
-
var id =
|
|
174
|
+
})) != null ? _yAxis$map : []), _toConsumableArray(yAxis === undefined || yAxis.findIndex(function (_ref3) {
|
|
175
|
+
var id = _ref3.id;
|
|
176
176
|
return id === DEFAULT_Y_AXIS_KEY;
|
|
177
177
|
}) === -1 ? [{
|
|
178
178
|
id: DEFAULT_Y_AXIS_KEY,
|
|
@@ -226,12 +226,12 @@ function CartesianContextProvider(_ref) {
|
|
|
226
226
|
return {
|
|
227
227
|
xAxis: completedXAxis,
|
|
228
228
|
yAxis: completedYAxis,
|
|
229
|
-
xAxisIds: allXAxis.map(function (
|
|
230
|
-
var id =
|
|
229
|
+
xAxisIds: allXAxis.map(function (_ref4) {
|
|
230
|
+
var id = _ref4.id;
|
|
231
231
|
return id;
|
|
232
232
|
}),
|
|
233
|
-
yAxisIds: allYAxis.map(function (
|
|
234
|
-
var id =
|
|
233
|
+
yAxisIds: allYAxis.map(function (_ref5) {
|
|
234
|
+
var id = _ref5.id;
|
|
235
235
|
return id;
|
|
236
236
|
})
|
|
237
237
|
};
|
|
@@ -23,12 +23,12 @@ export var SVGContext = /*#__PURE__*/React.createContext({
|
|
|
23
23
|
*
|
|
24
24
|
* - [DrawingProvider API](https://mui.com/x/api/charts/drawing-provider/)
|
|
25
25
|
*/
|
|
26
|
-
function DrawingProvider(
|
|
27
|
-
var width =
|
|
28
|
-
height =
|
|
29
|
-
margin =
|
|
30
|
-
svgRef =
|
|
31
|
-
children =
|
|
26
|
+
function DrawingProvider(props) {
|
|
27
|
+
var width = props.width,
|
|
28
|
+
height = props.height,
|
|
29
|
+
margin = props.margin,
|
|
30
|
+
svgRef = props.svgRef,
|
|
31
|
+
children = props.children;
|
|
32
32
|
var drawingArea = useChartDimensions(width, height, margin);
|
|
33
33
|
return /*#__PURE__*/_jsx(SVGContext.Provider, {
|
|
34
34
|
value: svgRef,
|
|
@@ -34,8 +34,8 @@ var dataReducer = function dataReducer(prevState, action) {
|
|
|
34
34
|
return prevState;
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
|
-
|
|
38
|
-
var children =
|
|
37
|
+
function HighlightProvider(props) {
|
|
38
|
+
var children = props.children;
|
|
39
39
|
var _React$useReducer = React.useReducer(dataReducer, {
|
|
40
40
|
item: null,
|
|
41
41
|
scope: defaultScope
|
|
@@ -52,4 +52,5 @@ export function HighlightProvider(_ref) {
|
|
|
52
52
|
value: value,
|
|
53
53
|
children: children
|
|
54
54
|
});
|
|
55
|
-
}
|
|
55
|
+
}
|
|
56
|
+
export { HighlightProvider };
|
|
@@ -36,8 +36,8 @@ var dataReducer = function dataReducer(prevState, action) {
|
|
|
36
36
|
return prevState;
|
|
37
37
|
}
|
|
38
38
|
};
|
|
39
|
-
|
|
40
|
-
var children =
|
|
39
|
+
function InteractionProvider(props) {
|
|
40
|
+
var children = props.children;
|
|
41
41
|
var _React$useReducer = React.useReducer(dataReducer, {
|
|
42
42
|
item: null,
|
|
43
43
|
axis: {
|
|
@@ -57,4 +57,5 @@ export function InteractionProvider(_ref) {
|
|
|
57
57
|
value: value,
|
|
58
58
|
children: children
|
|
59
59
|
});
|
|
60
|
-
}
|
|
60
|
+
}
|
|
61
|
+
export { InteractionProvider };
|
|
@@ -56,12 +56,12 @@ var formatSeries = function formatSeries(series, colors, dataset) {
|
|
|
56
56
|
});
|
|
57
57
|
return formattedSeries;
|
|
58
58
|
};
|
|
59
|
-
|
|
60
|
-
var series =
|
|
61
|
-
dataset =
|
|
62
|
-
|
|
63
|
-
colors =
|
|
64
|
-
children =
|
|
59
|
+
function SeriesContextProvider(props) {
|
|
60
|
+
var series = props.series,
|
|
61
|
+
dataset = props.dataset,
|
|
62
|
+
_props$colors = props.colors,
|
|
63
|
+
colors = _props$colors === void 0 ? blueberryTwilightPalette : _props$colors,
|
|
64
|
+
children = props.children;
|
|
65
65
|
var theme = useTheme();
|
|
66
66
|
var formattedSeries = React.useMemo(function () {
|
|
67
67
|
return formatSeries(series, typeof colors === 'function' ? colors(theme.palette.mode) : colors, dataset);
|
|
@@ -70,4 +70,5 @@ export function SeriesContextProvider(_ref) {
|
|
|
70
70
|
value: formattedSeries,
|
|
71
71
|
children: children
|
|
72
72
|
});
|
|
73
|
-
}
|
|
73
|
+
}
|
|
74
|
+
export { SeriesContextProvider };
|
|
@@ -5,13 +5,17 @@ export function useDrawingArea() {
|
|
|
5
5
|
left = _React$useContext.left,
|
|
6
6
|
top = _React$useContext.top,
|
|
7
7
|
width = _React$useContext.width,
|
|
8
|
-
height = _React$useContext.height
|
|
8
|
+
height = _React$useContext.height,
|
|
9
|
+
bottom = _React$useContext.bottom,
|
|
10
|
+
right = _React$useContext.right;
|
|
9
11
|
return React.useMemo(function () {
|
|
10
12
|
return {
|
|
11
13
|
left: left,
|
|
12
14
|
top: top,
|
|
13
15
|
width: width,
|
|
14
|
-
height: height
|
|
16
|
+
height: height,
|
|
17
|
+
bottom: bottom,
|
|
18
|
+
right: right
|
|
15
19
|
};
|
|
16
|
-
}, [height, left, top, width]);
|
|
20
|
+
}, [height, left, top, width, bottom, right]);
|
|
17
21
|
}
|
package/legacy/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v6.19.
|
|
2
|
+
* @mui/x-charts v6.19.3
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -24,4 +24,6 @@ export * from './PieChart';
|
|
|
24
24
|
export * from './ScatterChart';
|
|
25
25
|
export * from './SparkLineChart';
|
|
26
26
|
export * from './ChartContainer';
|
|
27
|
+
export * from './ChartsSurface';
|
|
28
|
+
export * from './ChartsLegend';
|
|
27
29
|
export * from './ResponsiveChartContainer';
|
|
@@ -9,18 +9,17 @@ export var AxisRoot = styled('g', {
|
|
|
9
9
|
return styles.root;
|
|
10
10
|
}
|
|
11
11
|
})(function (_ref) {
|
|
12
|
-
var _ref2;
|
|
13
12
|
var theme = _ref.theme;
|
|
14
|
-
return
|
|
13
|
+
return _defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "& .".concat(axisClasses.tickLabel), _extends({}, theme.typography.caption, {
|
|
15
14
|
fill: (theme.vars || theme).palette.text.primary
|
|
16
|
-
})),
|
|
15
|
+
})), "& .".concat(axisClasses.label), _extends({}, theme.typography.body1, {
|
|
17
16
|
fill: (theme.vars || theme).palette.text.primary
|
|
18
|
-
})),
|
|
17
|
+
})), "& .".concat(axisClasses.line), {
|
|
19
18
|
stroke: (theme.vars || theme).palette.text.primary,
|
|
20
19
|
shapeRendering: 'crispEdges',
|
|
21
20
|
strokeWidth: 1
|
|
22
|
-
}),
|
|
21
|
+
}), "& .".concat(axisClasses.tick), {
|
|
23
22
|
stroke: (theme.vars || theme).palette.text.primary,
|
|
24
23
|
shapeRendering: 'crispEdges'
|
|
25
|
-
})
|
|
24
|
+
});
|
|
26
25
|
});
|
|
@@ -63,6 +63,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
63
63
|
arcLabel?: 'formattedValue' | 'label' | 'value' | ((item: DefaultizedPieValueType) => string);
|
|
64
64
|
/**
|
|
65
65
|
* The minimal angle required to display the arc label.
|
|
66
|
+
* @default 0
|
|
66
67
|
*/
|
|
67
68
|
arcLabelMinAngle?: number;
|
|
68
69
|
/**
|
|
@@ -153,6 +153,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
153
153
|
className: PropTypes.string,
|
|
154
154
|
/**
|
|
155
155
|
* Color palette used to colorize multiple series.
|
|
156
|
+
* @default blueberryTwilightPalette
|
|
156
157
|
*/
|
|
157
158
|
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
158
159
|
/**
|
|
@@ -3,6 +3,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
3
3
|
const _excluded = ["rotate", "dominantBaseline"],
|
|
4
4
|
_excluded2 = ["label"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { useSlotProps } from '@mui/base/utils';
|
|
7
8
|
import { NoSsr } from '@mui/base/NoSsr';
|
|
8
9
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
@@ -234,7 +235,108 @@ function DefaultChartsLegend(props) {
|
|
|
234
235
|
})
|
|
235
236
|
});
|
|
236
237
|
}
|
|
237
|
-
|
|
238
|
+
process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
|
|
239
|
+
// ----------------------------- Warning --------------------------------
|
|
240
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
241
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
242
|
+
// ----------------------------------------------------------------------
|
|
243
|
+
/**
|
|
244
|
+
* Override or extend the styles applied to the component.
|
|
245
|
+
*/
|
|
246
|
+
classes: PropTypes.object.isRequired,
|
|
247
|
+
/**
|
|
248
|
+
* The direction of the legend layout.
|
|
249
|
+
* The default depends on the chart.
|
|
250
|
+
*/
|
|
251
|
+
direction: PropTypes.oneOf(['column', 'row']).isRequired,
|
|
252
|
+
drawingArea: PropTypes.shape({
|
|
253
|
+
bottom: PropTypes.number.isRequired,
|
|
254
|
+
height: PropTypes.number.isRequired,
|
|
255
|
+
left: PropTypes.number.isRequired,
|
|
256
|
+
right: PropTypes.number.isRequired,
|
|
257
|
+
top: PropTypes.number.isRequired,
|
|
258
|
+
width: PropTypes.number.isRequired
|
|
259
|
+
}).isRequired,
|
|
260
|
+
/**
|
|
261
|
+
* Set to true to hide the legend.
|
|
262
|
+
* @default false
|
|
263
|
+
*/
|
|
264
|
+
hidden: PropTypes.bool,
|
|
265
|
+
/**
|
|
266
|
+
* Space between two legend items (in px).
|
|
267
|
+
* @default 10
|
|
268
|
+
*/
|
|
269
|
+
itemGap: PropTypes.number,
|
|
270
|
+
/**
|
|
271
|
+
* Height of the item mark (in px).
|
|
272
|
+
* @default 20
|
|
273
|
+
*/
|
|
274
|
+
itemMarkHeight: PropTypes.number,
|
|
275
|
+
/**
|
|
276
|
+
* Width of the item mark (in px).
|
|
277
|
+
* @default 20
|
|
278
|
+
*/
|
|
279
|
+
itemMarkWidth: PropTypes.number,
|
|
280
|
+
/**
|
|
281
|
+
* Style applied to legend labels.
|
|
282
|
+
* @default theme.typography.subtitle1
|
|
283
|
+
*/
|
|
284
|
+
labelStyle: PropTypes.object,
|
|
285
|
+
/**
|
|
286
|
+
* Space between the mark and the label (in px).
|
|
287
|
+
* @default 5
|
|
288
|
+
*/
|
|
289
|
+
markGap: PropTypes.number,
|
|
290
|
+
/**
|
|
291
|
+
* Legend padding (in px).
|
|
292
|
+
* Can either be a single number, or an object with top, left, bottom, right properties.
|
|
293
|
+
* @default 0
|
|
294
|
+
*/
|
|
295
|
+
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
296
|
+
bottom: PropTypes.number,
|
|
297
|
+
left: PropTypes.number,
|
|
298
|
+
right: PropTypes.number,
|
|
299
|
+
top: PropTypes.number
|
|
300
|
+
})]),
|
|
301
|
+
position: PropTypes.shape({
|
|
302
|
+
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
303
|
+
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
304
|
+
}).isRequired,
|
|
305
|
+
series: PropTypes.shape({
|
|
306
|
+
bar: PropTypes.shape({
|
|
307
|
+
series: PropTypes.object.isRequired,
|
|
308
|
+
seriesOrder: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
309
|
+
stackingGroups: PropTypes.arrayOf(PropTypes.shape({
|
|
310
|
+
ids: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
311
|
+
stackingOffset: PropTypes.func.isRequired,
|
|
312
|
+
stackingOrder: PropTypes.func.isRequired
|
|
313
|
+
})).isRequired
|
|
314
|
+
}),
|
|
315
|
+
line: PropTypes.shape({
|
|
316
|
+
series: PropTypes.object.isRequired,
|
|
317
|
+
seriesOrder: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
318
|
+
stackingGroups: PropTypes.arrayOf(PropTypes.shape({
|
|
319
|
+
ids: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
320
|
+
stackingOffset: PropTypes.func.isRequired,
|
|
321
|
+
stackingOrder: PropTypes.func.isRequired
|
|
322
|
+
})).isRequired
|
|
323
|
+
}),
|
|
324
|
+
pie: PropTypes.shape({
|
|
325
|
+
series: PropTypes.object.isRequired,
|
|
326
|
+
seriesOrder: PropTypes.arrayOf(PropTypes.string).isRequired
|
|
327
|
+
}),
|
|
328
|
+
scatter: PropTypes.shape({
|
|
329
|
+
series: PropTypes.object.isRequired,
|
|
330
|
+
seriesOrder: PropTypes.arrayOf(PropTypes.string).isRequired
|
|
331
|
+
})
|
|
332
|
+
}).isRequired,
|
|
333
|
+
seriesToDisplay: PropTypes.arrayOf(PropTypes.shape({
|
|
334
|
+
color: PropTypes.string.isRequired,
|
|
335
|
+
id: PropTypes.string.isRequired,
|
|
336
|
+
label: PropTypes.string.isRequired
|
|
337
|
+
})).isRequired
|
|
338
|
+
} : void 0;
|
|
339
|
+
function ChartsLegend(inProps) {
|
|
238
340
|
const props = useThemeProps({
|
|
239
341
|
props: _extends({}, defaultProps, inProps),
|
|
240
342
|
name: 'MuiChartsLegend'
|
|
@@ -269,4 +371,39 @@ export function ChartsLegend(inProps) {
|
|
|
269
371
|
ownerState: {}
|
|
270
372
|
});
|
|
271
373
|
return /*#__PURE__*/_jsx(ChartLegendRender, _extends({}, chartLegendRenderProps));
|
|
272
|
-
}
|
|
374
|
+
}
|
|
375
|
+
process.env.NODE_ENV !== "production" ? ChartsLegend.propTypes = {
|
|
376
|
+
// ----------------------------- Warning --------------------------------
|
|
377
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
378
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
379
|
+
// ----------------------------------------------------------------------
|
|
380
|
+
/**
|
|
381
|
+
* Override or extend the styles applied to the component.
|
|
382
|
+
*/
|
|
383
|
+
classes: PropTypes.object,
|
|
384
|
+
/**
|
|
385
|
+
* The direction of the legend layout.
|
|
386
|
+
* The default depends on the chart.
|
|
387
|
+
*/
|
|
388
|
+
direction: PropTypes.oneOf(['column', 'row']),
|
|
389
|
+
/**
|
|
390
|
+
* Set to true to hide the legend.
|
|
391
|
+
* @default false
|
|
392
|
+
*/
|
|
393
|
+
hidden: PropTypes.bool,
|
|
394
|
+
position: PropTypes.shape({
|
|
395
|
+
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
396
|
+
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
397
|
+
}),
|
|
398
|
+
/**
|
|
399
|
+
* The props used for each component slot.
|
|
400
|
+
* @default {}
|
|
401
|
+
*/
|
|
402
|
+
slotProps: PropTypes.object,
|
|
403
|
+
/**
|
|
404
|
+
* Overridable component slots.
|
|
405
|
+
* @default {}
|
|
406
|
+
*/
|
|
407
|
+
slots: PropTypes.object
|
|
408
|
+
} : void 0;
|
|
409
|
+
export { ChartsLegend };
|
|
@@ -5,13 +5,17 @@ import { ChartsXReferenceLine } from './ChartsXReferenceLine';
|
|
|
5
5
|
import { ChartsYReferenceLine } from './ChartsYReferenceLine';
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
function ChartsReferenceLine(props) {
|
|
8
|
-
|
|
8
|
+
const {
|
|
9
|
+
x,
|
|
10
|
+
y
|
|
11
|
+
} = props;
|
|
12
|
+
if (x !== undefined && y !== undefined) {
|
|
9
13
|
throw new Error('MUI-X-Charts: The ChartsReferenceLine can not have both `x` and `y` props set.');
|
|
10
14
|
}
|
|
11
|
-
if (
|
|
15
|
+
if (x === undefined && y === undefined) {
|
|
12
16
|
throw new Error('MUI-X-Charts: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
13
17
|
}
|
|
14
|
-
if (
|
|
18
|
+
if (x !== undefined) {
|
|
15
19
|
return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));
|
|
16
20
|
}
|
|
17
21
|
return /*#__PURE__*/_jsx(ChartsYReferenceLine, _extends({}, props));
|
package/modern/ChartsSurface.js
CHANGED
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className"];
|
|
4
4
|
import { styled } from '@mui/material/styles';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
5
6
|
import * as React from 'react';
|
|
6
7
|
import { useAxisEvents } from './hooks/useAxisEvents';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -10,7 +11,7 @@ const ChartChartsSurfaceStyles = styled('svg', {
|
|
|
10
11
|
name: 'MuiChartsSurface',
|
|
11
12
|
slot: 'Root'
|
|
12
13
|
})(() => ({}));
|
|
13
|
-
|
|
14
|
+
const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props, ref) {
|
|
14
15
|
const {
|
|
15
16
|
children,
|
|
16
17
|
width,
|
|
@@ -38,4 +39,36 @@ export const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurfac
|
|
|
38
39
|
children: props.desc
|
|
39
40
|
}), children]
|
|
40
41
|
}));
|
|
41
|
-
});
|
|
42
|
+
});
|
|
43
|
+
process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
|
|
44
|
+
// ----------------------------- Warning --------------------------------
|
|
45
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
46
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
47
|
+
// ----------------------------------------------------------------------
|
|
48
|
+
children: PropTypes.node,
|
|
49
|
+
className: PropTypes.string,
|
|
50
|
+
desc: PropTypes.string,
|
|
51
|
+
/**
|
|
52
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
53
|
+
* It might break interactive features, but will improve performance.
|
|
54
|
+
* @default false
|
|
55
|
+
*/
|
|
56
|
+
disableAxisListener: PropTypes.bool,
|
|
57
|
+
/**
|
|
58
|
+
* The height of the chart in px.
|
|
59
|
+
*/
|
|
60
|
+
height: PropTypes.number.isRequired,
|
|
61
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
62
|
+
title: PropTypes.string,
|
|
63
|
+
viewBox: PropTypes.shape({
|
|
64
|
+
height: PropTypes.number,
|
|
65
|
+
width: PropTypes.number,
|
|
66
|
+
x: PropTypes.number,
|
|
67
|
+
y: PropTypes.number
|
|
68
|
+
}),
|
|
69
|
+
/**
|
|
70
|
+
* The width of the chart in px.
|
|
71
|
+
*/
|
|
72
|
+
width: PropTypes.number.isRequired
|
|
73
|
+
} : void 0;
|
|
74
|
+
export { ChartsSurface };
|
|
@@ -76,37 +76,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
|
76
76
|
classes: PropTypes.object.isRequired,
|
|
77
77
|
content: PropTypes.elementType,
|
|
78
78
|
contentProps: PropTypes.shape({
|
|
79
|
-
axis: PropTypes.
|
|
80
|
-
axisId: PropTypes.string,
|
|
81
|
-
classes: PropTypes.object,
|
|
82
|
-
data: PropTypes.array,
|
|
83
|
-
dataKey: PropTypes.string,
|
|
84
|
-
disableLine: PropTypes.bool,
|
|
85
|
-
disableTicks: PropTypes.bool,
|
|
86
|
-
fill: PropTypes.string,
|
|
87
|
-
hideTooltip: PropTypes.bool,
|
|
88
|
-
id: PropTypes.string.isRequired,
|
|
89
|
-
label: PropTypes.string,
|
|
90
|
-
labelFontSize: PropTypes.number,
|
|
91
|
-
labelStyle: PropTypes.object,
|
|
92
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
93
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
94
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
95
|
-
scale: PropTypes.func.isRequired,
|
|
96
|
-
scaleType: PropTypes.oneOf(['time']).isRequired,
|
|
97
|
-
slotProps: PropTypes.object,
|
|
98
|
-
slots: PropTypes.object,
|
|
99
|
-
stroke: PropTypes.string,
|
|
100
|
-
tickFontSize: PropTypes.number,
|
|
101
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
102
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
103
|
-
tickLabelStyle: PropTypes.object,
|
|
104
|
-
tickMaxStep: PropTypes.number,
|
|
105
|
-
tickMinStep: PropTypes.number,
|
|
106
|
-
tickNumber: PropTypes.number.isRequired,
|
|
107
|
-
tickSize: PropTypes.number,
|
|
108
|
-
valueFormatter: PropTypes.func
|
|
109
|
-
}),
|
|
79
|
+
axis: PropTypes.object,
|
|
110
80
|
axisData: PropTypes.shape({
|
|
111
81
|
x: PropTypes.shape({
|
|
112
82
|
index: PropTypes.number,
|
|
@@ -120,29 +90,7 @@ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
|
120
90
|
axisValue: PropTypes.any,
|
|
121
91
|
classes: PropTypes.object,
|
|
122
92
|
dataIndex: PropTypes.number,
|
|
123
|
-
series: PropTypes.arrayOf(PropTypes.
|
|
124
|
-
area: PropTypes.bool,
|
|
125
|
-
color: PropTypes.string.isRequired,
|
|
126
|
-
connectNulls: PropTypes.bool,
|
|
127
|
-
curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
128
|
-
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
129
|
-
dataKey: PropTypes.string,
|
|
130
|
-
disableHighlight: PropTypes.bool,
|
|
131
|
-
highlightScope: PropTypes.shape({
|
|
132
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
133
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
134
|
-
}),
|
|
135
|
-
id: PropTypes.string.isRequired,
|
|
136
|
-
label: PropTypes.string,
|
|
137
|
-
showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
138
|
-
stack: PropTypes.string,
|
|
139
|
-
stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
140
|
-
stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
141
|
-
type: PropTypes.oneOf(['line']).isRequired,
|
|
142
|
-
valueFormatter: PropTypes.func.isRequired,
|
|
143
|
-
xAxisKey: PropTypes.string,
|
|
144
|
-
yAxisKey: PropTypes.string
|
|
145
|
-
})),
|
|
93
|
+
series: PropTypes.arrayOf(PropTypes.object),
|
|
146
94
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
147
95
|
}),
|
|
148
96
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
@@ -44,7 +44,21 @@ process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
|
|
|
44
44
|
}),
|
|
45
45
|
series: PropTypes.shape({
|
|
46
46
|
color: PropTypes.string,
|
|
47
|
-
data: PropTypes.arrayOf(PropTypes.number).
|
|
47
|
+
data: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.number), PropTypes.arrayOf(PropTypes.shape({
|
|
48
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
49
|
+
x: PropTypes.number.isRequired,
|
|
50
|
+
y: PropTypes.number.isRequired
|
|
51
|
+
})), PropTypes.arrayOf(PropTypes.shape({
|
|
52
|
+
color: PropTypes.string.isRequired,
|
|
53
|
+
endAngle: PropTypes.number.isRequired,
|
|
54
|
+
formattedValue: PropTypes.string.isRequired,
|
|
55
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
56
|
+
index: PropTypes.number.isRequired,
|
|
57
|
+
label: PropTypes.string,
|
|
58
|
+
padAngle: PropTypes.number.isRequired,
|
|
59
|
+
startAngle: PropTypes.number.isRequired,
|
|
60
|
+
value: PropTypes.number.isRequired
|
|
61
|
+
}))]).isRequired,
|
|
48
62
|
highlightScope: PropTypes.shape({
|
|
49
63
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
50
64
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
@@ -80,37 +80,7 @@ process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propType
|
|
|
80
80
|
/**
|
|
81
81
|
* The properties of the triggered axis.
|
|
82
82
|
*/
|
|
83
|
-
axis: PropTypes.
|
|
84
|
-
axisId: PropTypes.string,
|
|
85
|
-
classes: PropTypes.object,
|
|
86
|
-
data: PropTypes.array,
|
|
87
|
-
dataKey: PropTypes.string,
|
|
88
|
-
disableLine: PropTypes.bool,
|
|
89
|
-
disableTicks: PropTypes.bool,
|
|
90
|
-
fill: PropTypes.string,
|
|
91
|
-
hideTooltip: PropTypes.bool,
|
|
92
|
-
id: PropTypes.string.isRequired,
|
|
93
|
-
label: PropTypes.string,
|
|
94
|
-
labelFontSize: PropTypes.number,
|
|
95
|
-
labelStyle: PropTypes.object,
|
|
96
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
97
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
98
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
99
|
-
scale: PropTypes.func.isRequired,
|
|
100
|
-
scaleType: PropTypes.oneOf(['time']).isRequired,
|
|
101
|
-
slotProps: PropTypes.object,
|
|
102
|
-
slots: PropTypes.object,
|
|
103
|
-
stroke: PropTypes.string,
|
|
104
|
-
tickFontSize: PropTypes.number,
|
|
105
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
106
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
107
|
-
tickLabelStyle: PropTypes.object,
|
|
108
|
-
tickMaxStep: PropTypes.number,
|
|
109
|
-
tickMinStep: PropTypes.number,
|
|
110
|
-
tickNumber: PropTypes.number.isRequired,
|
|
111
|
-
tickSize: PropTypes.number,
|
|
112
|
-
valueFormatter: PropTypes.func
|
|
113
|
-
}).isRequired,
|
|
83
|
+
axis: PropTypes.object.isRequired,
|
|
114
84
|
/**
|
|
115
85
|
* Data identifying the triggered axis.
|
|
116
86
|
*/
|
|
@@ -139,29 +109,7 @@ process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propType
|
|
|
139
109
|
/**
|
|
140
110
|
* The series linked to the triggered axis.
|
|
141
111
|
*/
|
|
142
|
-
series: PropTypes.arrayOf(PropTypes.
|
|
143
|
-
area: PropTypes.bool,
|
|
144
|
-
color: PropTypes.string.isRequired,
|
|
145
|
-
connectNulls: PropTypes.bool,
|
|
146
|
-
curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
147
|
-
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
148
|
-
dataKey: PropTypes.string,
|
|
149
|
-
disableHighlight: PropTypes.bool,
|
|
150
|
-
highlightScope: PropTypes.shape({
|
|
151
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
152
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
153
|
-
}),
|
|
154
|
-
id: PropTypes.string.isRequired,
|
|
155
|
-
label: PropTypes.string,
|
|
156
|
-
showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
157
|
-
stack: PropTypes.string,
|
|
158
|
-
stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
159
|
-
stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
160
|
-
type: PropTypes.oneOf(['line']).isRequired,
|
|
161
|
-
valueFormatter: PropTypes.func.isRequired,
|
|
162
|
-
xAxisKey: PropTypes.string,
|
|
163
|
-
yAxisKey: PropTypes.string
|
|
164
|
-
})).isRequired,
|
|
112
|
+
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
165
113
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
166
114
|
} : void 0;
|
|
167
115
|
export { DefaultChartsAxisTooltipContent };
|