@mui/x-charts 6.18.7 → 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 +155 -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/LineChart/formatter.js +5 -1
- 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/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/LineChart/formatter.js +5 -1
- 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/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/esm/internals/stackSeries.js +5 -3
- package/esm/models/index.js +1 -0
- package/esm/models/stacking.js +1 -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/internals/defaultizeColor.d.ts +7 -4
- package/internals/stackSeries.d.ts +8 -3
- package/internals/stackSeries.js +4 -3
- 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/LineChart/formatter.js +6 -2
- package/legacy/PieChart/PieArcLabel.js +7 -6
- 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/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/legacy/internals/stackSeries.js +5 -3
- package/legacy/models/index.js +1 -0
- package/legacy/models/stacking.js +1 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +11 -0
- package/models/seriesType/bar.d.ts +6 -0
- package/models/seriesType/common.d.ts +2 -3
- package/models/seriesType/index.d.ts +0 -1
- package/models/seriesType/line.d.ts +6 -0
- package/models/seriesType/pie.d.ts +15 -0
- package/models/stacking.d.ts +2 -0
- package/models/stacking.js +5 -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/LineChart/formatter.js +5 -1
- 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/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/modern/internals/stackSeries.js +4 -3
- package/modern/models/index.js +1 -0
- package/modern/models/stacking.js +1 -0
- package/package.json +1 -1
|
@@ -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.
|
|
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
|
});
|
|
@@ -55,7 +55,8 @@ export var StackOffset = {
|
|
|
55
55
|
*/
|
|
56
56
|
export var getStackingGroups = function getStackingGroups(params) {
|
|
57
57
|
var series = params.series,
|
|
58
|
-
seriesOrder = params.seriesOrder
|
|
58
|
+
seriesOrder = params.seriesOrder,
|
|
59
|
+
defaultStrategy = params.defaultStrategy;
|
|
59
60
|
var stackingGroups = [];
|
|
60
61
|
var stackIndex = {};
|
|
61
62
|
seriesOrder.forEach(function (id) {
|
|
@@ -70,11 +71,12 @@ export var getStackingGroups = function getStackingGroups(params) {
|
|
|
70
71
|
stackingOffset: StackOffset.none
|
|
71
72
|
});
|
|
72
73
|
} else if (stackIndex[stack] === undefined) {
|
|
74
|
+
var _ref, _ref2;
|
|
73
75
|
stackIndex[stack] = stackingGroups.length;
|
|
74
76
|
stackingGroups.push({
|
|
75
77
|
ids: [id],
|
|
76
|
-
stackingOrder: StackOrder[stackOrder != null ? stackOrder : 'none'],
|
|
77
|
-
stackingOffset: StackOffset[stackOffset != null ? stackOffset : 'diverging']
|
|
78
|
+
stackingOrder: StackOrder[(_ref = stackOrder != null ? stackOrder : defaultStrategy == null ? void 0 : defaultStrategy.stackOrder) != null ? _ref : 'none'],
|
|
79
|
+
stackingOffset: StackOffset[(_ref2 = stackOffset != null ? stackOffset : defaultStrategy == null ? void 0 : defaultStrategy.stackOffset) != null ? _ref2 : 'diverging']
|
|
78
80
|
});
|
|
79
81
|
} else {
|
|
80
82
|
stackingGroups[stackIndex[stack]].ids.push(id);
|
package/legacy/models/index.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/models/index.d.ts
CHANGED
package/models/index.js
CHANGED
|
@@ -24,4 +24,15 @@ Object.keys(_layout).forEach(function (key) {
|
|
|
24
24
|
return _layout[key];
|
|
25
25
|
}
|
|
26
26
|
});
|
|
27
|
+
});
|
|
28
|
+
var _stacking = require("./stacking");
|
|
29
|
+
Object.keys(_stacking).forEach(function (key) {
|
|
30
|
+
if (key === "default" || key === "__esModule") return;
|
|
31
|
+
if (key in exports && exports[key] === _stacking[key]) return;
|
|
32
|
+
Object.defineProperty(exports, key, {
|
|
33
|
+
enumerable: true,
|
|
34
|
+
get: function () {
|
|
35
|
+
return _stacking[key];
|
|
36
|
+
}
|
|
37
|
+
});
|
|
27
38
|
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DefaultizedProps } from '../helpers';
|
|
2
|
+
import type { StackOffsetType } from '../stacking';
|
|
2
3
|
import { CartesianSeriesType, CommonSeriesType, CommonDefaultizedProps, StackableSeriesType } from './common';
|
|
3
4
|
export interface BarSeriesType extends CommonSeriesType<number>, CartesianSeriesType, StackableSeriesType {
|
|
4
5
|
type: 'bar';
|
|
@@ -16,6 +17,11 @@ export interface BarSeriesType extends CommonSeriesType<number>, CartesianSeries
|
|
|
16
17
|
* @default 'vertical'
|
|
17
18
|
*/
|
|
18
19
|
layout?: 'horizontal' | 'vertical';
|
|
20
|
+
/**
|
|
21
|
+
* Defines how stacked series handle negative values.
|
|
22
|
+
* @default 'diverging'
|
|
23
|
+
*/
|
|
24
|
+
stackOffset?: StackOffsetType;
|
|
19
25
|
}
|
|
20
26
|
/**
|
|
21
27
|
* An object that allows to identify a single bar.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { HighlightScope } from '../../context/HighlightProvider';
|
|
2
|
-
import type {
|
|
2
|
+
import type { StackOffsetType, StackOrderType } from '../stacking';
|
|
3
3
|
export type CommonSeriesType<TValue> = {
|
|
4
4
|
id?: string;
|
|
5
5
|
color?: string;
|
|
@@ -34,9 +34,8 @@ export type StackableSeriesType = {
|
|
|
34
34
|
stackOffset?: StackOffsetType;
|
|
35
35
|
/**
|
|
36
36
|
* The order in which series' of the same group are stacked together.
|
|
37
|
+
* @default 'none'
|
|
37
38
|
*/
|
|
38
39
|
stackOrder?: StackOrderType;
|
|
39
40
|
};
|
|
40
|
-
export type StackOrderType = keyof typeof StackOrder;
|
|
41
|
-
export type StackOffsetType = keyof typeof StackOffset;
|
|
42
41
|
export type DefaultizedCartesianSeriesType = Required<CartesianSeriesType>;
|
|
@@ -13,5 +13,4 @@ export * from './line';
|
|
|
13
13
|
export * from './bar';
|
|
14
14
|
export * from './scatter';
|
|
15
15
|
export * from './pie';
|
|
16
|
-
export type { StackOrderType, StackOffsetType } from './common';
|
|
17
16
|
export type { AllSeriesType, CartesianSeriesType, DefaultizedSeriesType, DefaultizedCartesianSeriesType, StackableSeriesType, };
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { DefaultizedProps } from '../helpers';
|
|
2
|
+
import type { StackOffsetType } from '../stacking';
|
|
2
3
|
import { CartesianSeriesType, CommonDefaultizedProps, CommonSeriesType, StackableSeriesType } from './common';
|
|
3
4
|
export type CurveType = 'catmullRom' | 'linear' | 'monotoneX' | 'monotoneY' | 'natural' | 'step' | 'stepBefore' | 'stepAfter';
|
|
4
5
|
export interface ShowMarkParams<AxisValue = number | Date> {
|
|
@@ -53,6 +54,11 @@ export interface LineSeriesType extends CommonSeriesType<number>, CartesianSerie
|
|
|
53
54
|
* @default false
|
|
54
55
|
*/
|
|
55
56
|
connectNulls?: boolean;
|
|
57
|
+
/**
|
|
58
|
+
* Defines how stacked series handle negative values.
|
|
59
|
+
* @default 'none'
|
|
60
|
+
*/
|
|
61
|
+
stackOffset?: StackOffsetType;
|
|
56
62
|
}
|
|
57
63
|
/**
|
|
58
64
|
* An object that allows to identify a single line.
|
|
@@ -29,6 +29,13 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
29
29
|
* @default '100%'
|
|
30
30
|
*/
|
|
31
31
|
outerRadius?: number | string;
|
|
32
|
+
/**
|
|
33
|
+
* The radius between circle center and the arc label.
|
|
34
|
+
* Can be a number (in px) or a string with a percentage such as '50%'.
|
|
35
|
+
* The '100%' is the maximal radius that fit into the drawing area.
|
|
36
|
+
* @default (innerRadius - outerRadius) / 2
|
|
37
|
+
*/
|
|
38
|
+
arcLabelRadius?: number | string;
|
|
32
39
|
/**
|
|
33
40
|
* The radius applied to arc corners (similar to border radius).
|
|
34
41
|
* @default 0
|
|
@@ -56,6 +63,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
56
63
|
arcLabel?: 'formattedValue' | 'label' | 'value' | ((item: DefaultizedPieValueType) => string);
|
|
57
64
|
/**
|
|
58
65
|
* The minimal angle required to display the arc label.
|
|
66
|
+
* @default 0
|
|
59
67
|
*/
|
|
60
68
|
arcLabelMinAngle?: number;
|
|
61
69
|
/**
|
|
@@ -85,6 +93,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
85
93
|
outerRadius?: number;
|
|
86
94
|
cornerRadius?: number;
|
|
87
95
|
paddingAngle?: number;
|
|
96
|
+
arcLabelRadius?: number;
|
|
88
97
|
color?: string;
|
|
89
98
|
};
|
|
90
99
|
/**
|
|
@@ -100,6 +109,7 @@ export interface PieSeriesType<Tdata = PieValueType> extends CommonSeriesType<Td
|
|
|
100
109
|
outerRadius?: number;
|
|
101
110
|
cornerRadius?: number;
|
|
102
111
|
paddingAngle?: number;
|
|
112
|
+
arcLabelRadius?: number;
|
|
103
113
|
color?: string;
|
|
104
114
|
};
|
|
105
115
|
}
|
|
@@ -128,4 +138,9 @@ export interface ComputedPieRadius {
|
|
|
128
138
|
* The radius between circle center and the end of the arc.
|
|
129
139
|
*/
|
|
130
140
|
outerRadius: number;
|
|
141
|
+
/**
|
|
142
|
+
* The radius between circle center and the arc label in px.
|
|
143
|
+
* @default (innerRadius - outerRadius) / 2
|
|
144
|
+
*/
|
|
145
|
+
arcLabelRadius?: number;
|
|
131
146
|
}
|
|
@@ -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'])
|