@mui/x-charts 6.18.1 → 6.18.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/BarElement.d.ts +5 -1
- package/BarChart/BarElement.js +24 -1
- package/BarChart/index.d.ts +3 -2
- package/BarChart/index.js +31 -12
- package/CHANGELOG.md +112 -0
- package/ChartsLegend/index.d.ts +1 -0
- package/ChartsLegend/index.js +11 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +6 -3
- package/ChartsTooltip/ChartsAxisTooltipContent.js +93 -69
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +6 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +38 -53
- package/ChartsTooltip/ChartsTooltip.d.ts +1 -1
- package/ChartsTooltip/ChartsTooltip.js +13 -5
- package/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +7 -0
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +174 -0
- package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +8 -0
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +99 -0
- package/ChartsTooltip/chartsTooltipClasses.d.ts +21 -0
- package/ChartsTooltip/chartsTooltipClasses.js +12 -0
- package/ChartsTooltip/index.d.ts +5 -0
- package/ChartsTooltip/index.js +55 -0
- package/ChartsTooltip/utils.d.ts +1 -1
- package/ChartsTooltip/utils.js +2 -2
- package/ChartsYAxis/ChartsYAxis.js +6 -4
- package/LineChart/extremums.js +25 -8
- package/LineChart/index.d.ts +5 -5
- package/LineChart/index.js +50 -41
- package/PieChart/PieArc.d.ts +5 -2
- package/PieChart/PieArc.js +17 -2
- package/PieChart/PieArcLabel.d.ts +1 -1
- package/PieChart/PieArcLabel.js +5 -10
- package/PieChart/PieArcLabelPlot.d.ts +5 -1
- package/PieChart/PieArcLabelPlot.js +91 -3
- package/PieChart/PieArcPlot.d.ts +5 -1
- package/PieChart/PieArcPlot.js +90 -3
- package/PieChart/index.d.ts +4 -2
- package/PieChart/index.js +42 -18
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/index.d.ts +3 -3
- package/ScatterChart/index.js +31 -19
- package/esm/BarChart/BarElement.js +26 -2
- package/esm/BarChart/index.js +3 -2
- package/esm/ChartsLegend/index.js +2 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +95 -71
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +40 -54
- package/esm/ChartsTooltip/ChartsTooltip.js +15 -7
- package/esm/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +168 -0
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
- package/esm/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/esm/ChartsTooltip/index.js +6 -1
- package/esm/ChartsTooltip/utils.js +1 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +6 -4
- package/esm/LineChart/extremums.js +25 -8
- package/esm/LineChart/index.js +5 -5
- package/esm/PieChart/PieArc.js +18 -2
- package/esm/PieChart/PieArcLabel.js +7 -11
- package/esm/PieChart/PieArcLabelPlot.js +92 -3
- package/esm/PieChart/PieArcPlot.js +91 -3
- package/esm/PieChart/index.js +4 -2
- package/esm/ScatterChart/Scatter.js +1 -1
- package/esm/ScatterChart/index.js +3 -3
- package/esm/internals/defaultizeValueFormatter.js +4 -3
- package/index.js +1 -1
- package/internals/defaultizeValueFormatter.d.ts +3 -1
- package/internals/defaultizeValueFormatter.js +3 -3
- package/legacy/BarChart/BarElement.js +26 -2
- package/legacy/BarChart/index.js +3 -2
- package/legacy/ChartsLegend/index.js +2 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +95 -70
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +40 -51
- package/legacy/ChartsTooltip/ChartsTooltip.js +20 -12
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +89 -0
- package/legacy/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/legacy/ChartsTooltip/index.js +6 -1
- package/legacy/ChartsTooltip/utils.js +1 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +6 -4
- package/legacy/LineChart/extremums.js +29 -14
- package/legacy/LineChart/index.js +5 -5
- package/legacy/PieChart/PieArc.js +18 -2
- package/legacy/PieChart/PieArcLabel.js +7 -11
- package/legacy/PieChart/PieArcLabelPlot.js +92 -3
- package/legacy/PieChart/PieArcPlot.js +91 -3
- package/legacy/PieChart/index.js +4 -2
- package/legacy/ScatterChart/Scatter.js +1 -1
- package/legacy/ScatterChart/index.js +3 -3
- package/legacy/index.js +1 -1
- package/legacy/internals/defaultizeValueFormatter.js +4 -3
- package/models/seriesType/config.d.ts +5 -1
- package/models/seriesType/scatter.d.ts +1 -1
- package/modern/BarChart/BarElement.js +26 -2
- package/modern/BarChart/index.js +3 -2
- package/modern/ChartsLegend/index.js +2 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +95 -70
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +40 -54
- package/modern/ChartsTooltip/ChartsTooltip.js +15 -7
- package/modern/ChartsTooltip/ChartsTooltipTable.js +3 -3
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
- package/modern/ChartsTooltip/chartsTooltipClasses.js +5 -0
- package/modern/ChartsTooltip/index.js +6 -1
- package/modern/ChartsTooltip/utils.js +1 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +6 -4
- package/modern/LineChart/extremums.js +25 -8
- package/modern/LineChart/index.js +5 -5
- package/modern/PieChart/PieArc.js +18 -2
- package/modern/PieChart/PieArcLabel.js +7 -11
- package/modern/PieChart/PieArcLabelPlot.js +92 -3
- package/modern/PieChart/PieArcPlot.js +91 -3
- package/modern/PieChart/index.js +4 -2
- package/modern/ScatterChart/Scatter.js +1 -1
- package/modern/ScatterChart/index.js +3 -3
- package/modern/index.js +1 -1
- package/modern/internals/defaultizeValueFormatter.js +3 -3
- package/package.json +1 -1
- package/themeAugmentation/components.d.ts +1 -0
- package/themeAugmentation/overrides.d.ts +2 -0
- package/ChartsTooltip/tooltipClasses.d.ts +0 -13
- package/ChartsTooltip/tooltipClasses.js +0 -12
- package/esm/ChartsTooltip/tooltipClasses.js +0 -5
- package/legacy/ChartsTooltip/tooltipClasses.js +0 -5
- package/modern/ChartsTooltip/tooltipClasses.js +0 -5
|
@@ -74,6 +74,8 @@ function ChartsYAxis(inProps) {
|
|
|
74
74
|
tickFontSize,
|
|
75
75
|
label,
|
|
76
76
|
labelFontSize,
|
|
77
|
+
labelStyle,
|
|
78
|
+
tickLabelStyle,
|
|
77
79
|
tickSize: tickSizeProp,
|
|
78
80
|
valueFormatter,
|
|
79
81
|
slots,
|
|
@@ -108,11 +110,11 @@ function ChartsYAxis(inProps) {
|
|
|
108
110
|
elementType: TickLabel,
|
|
109
111
|
externalSlotProps: slotProps?.axisTickLabel,
|
|
110
112
|
additionalProps: {
|
|
111
|
-
style: {
|
|
113
|
+
style: _extends({
|
|
112
114
|
fontSize: tickFontSize,
|
|
113
115
|
textAnchor: position === 'right' ? 'start' : 'end',
|
|
114
116
|
dominantBaseline: 'central'
|
|
115
|
-
},
|
|
117
|
+
}, tickLabelStyle),
|
|
116
118
|
className: classes.tickLabel
|
|
117
119
|
},
|
|
118
120
|
ownerState: {}
|
|
@@ -121,12 +123,12 @@ function ChartsYAxis(inProps) {
|
|
|
121
123
|
elementType: Label,
|
|
122
124
|
externalSlotProps: slotProps?.axisLabel,
|
|
123
125
|
additionalProps: {
|
|
124
|
-
style: {
|
|
126
|
+
style: _extends({
|
|
125
127
|
fontSize: labelFontSize,
|
|
126
128
|
angle: positionSign * 90,
|
|
127
129
|
textAnchor: 'middle',
|
|
128
130
|
dominantBaseline: 'auto'
|
|
129
|
-
}
|
|
131
|
+
}, labelStyle)
|
|
130
132
|
},
|
|
131
133
|
ownerState: {}
|
|
132
134
|
});
|
|
@@ -6,6 +6,18 @@ export const getExtremumX = params => {
|
|
|
6
6
|
const maxX = Math.max(...(axis.data ?? []));
|
|
7
7
|
return [minX, maxX];
|
|
8
8
|
};
|
|
9
|
+
function getSeriesExtremums(getValues, stackedData) {
|
|
10
|
+
if (stackedData.length === 0) {
|
|
11
|
+
return [null, null];
|
|
12
|
+
}
|
|
13
|
+
return stackedData.reduce((seriesAcc, stackedValue) => {
|
|
14
|
+
const [base, value] = getValues(stackedValue);
|
|
15
|
+
if (seriesAcc[0] === null) {
|
|
16
|
+
return [Math.min(base, value), Math.max(base, value)];
|
|
17
|
+
}
|
|
18
|
+
return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
|
|
19
|
+
}, getValues(stackedData[0]));
|
|
20
|
+
}
|
|
9
21
|
export const getExtremumY = params => {
|
|
10
22
|
const {
|
|
11
23
|
series,
|
|
@@ -13,16 +25,21 @@ export const getExtremumY = params => {
|
|
|
13
25
|
isDefaultAxis
|
|
14
26
|
} = params;
|
|
15
27
|
return Object.keys(series).filter(seriesId => series[seriesId].yAxisKey === axis.id || isDefaultAxis && series[seriesId].yAxisKey === undefined).reduce((acc, seriesId) => {
|
|
16
|
-
const
|
|
17
|
-
|
|
28
|
+
const {
|
|
29
|
+
area,
|
|
30
|
+
stackedData
|
|
31
|
+
} = series[seriesId];
|
|
32
|
+
const isArea = area !== undefined;
|
|
33
|
+
const getValues = isArea ? d => d : d => [d[1], d[1]]; // Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
18
34
|
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
return
|
|
22
|
-
}
|
|
23
|
-
if (
|
|
24
|
-
return
|
|
35
|
+
const seriesExtremums = getSeriesExtremums(getValues, stackedData);
|
|
36
|
+
if (acc[0] === null) {
|
|
37
|
+
return seriesExtremums;
|
|
38
|
+
}
|
|
39
|
+
if (seriesExtremums[0] === null) {
|
|
40
|
+
return acc;
|
|
25
41
|
}
|
|
42
|
+
const [seriesMin, seriesMax] = seriesExtremums;
|
|
26
43
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
27
44
|
}, [null, null]);
|
|
28
45
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
4
|
-
export
|
|
5
|
-
export
|
|
1
|
+
export * from './LineChart';
|
|
2
|
+
export * from './LinePlot';
|
|
3
|
+
export * from './AreaPlot';
|
|
4
|
+
export * from './MarkPlot';
|
|
5
|
+
export * from './LineHighlightPlot';
|
|
6
6
|
export * from './AreaElement';
|
|
7
7
|
export * from './LineElement';
|
|
8
8
|
export * from './MarkElement';
|
|
@@ -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 = ["id", "dataIndex", "classes", "color", "highlightScope", "onClick", "isFaded", "isHighlighted", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
5
6
|
import { arc as d3Arc } from 'd3-shape';
|
|
6
7
|
import { animated, to } from '@react-spring/web';
|
|
7
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
@@ -37,7 +38,7 @@ const PieArcRoot = styled(animated.path, {
|
|
|
37
38
|
strokeWidth: 1,
|
|
38
39
|
strokeLinejoin: 'round'
|
|
39
40
|
}));
|
|
40
|
-
|
|
41
|
+
function PieArc(props) {
|
|
41
42
|
const {
|
|
42
43
|
id,
|
|
43
44
|
dataIndex,
|
|
@@ -82,4 +83,19 @@ export default function PieArc(props) {
|
|
|
82
83
|
seriesId: id,
|
|
83
84
|
dataIndex
|
|
84
85
|
})));
|
|
85
|
-
}
|
|
86
|
+
}
|
|
87
|
+
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
88
|
+
// ----------------------------- Warning --------------------------------
|
|
89
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
90
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
91
|
+
// ----------------------------------------------------------------------
|
|
92
|
+
classes: PropTypes.object,
|
|
93
|
+
dataIndex: PropTypes.number.isRequired,
|
|
94
|
+
highlightScope: PropTypes.shape({
|
|
95
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
96
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
97
|
+
}),
|
|
98
|
+
isFaded: PropTypes.bool.isRequired,
|
|
99
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
100
|
+
} : void 0;
|
|
101
|
+
export { PieArc };
|
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
3
|
const _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
5
6
|
import { animated, to } from '@react-spring/web';
|
|
6
7
|
import { arc as d3Arc } from 'd3-shape';
|
|
7
|
-
import PropTypes from 'prop-types';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
9
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
10
10
|
import { styled } from '@mui/material/styles';
|
|
@@ -57,7 +57,7 @@ const getLabelPosition = (formattedArcLabel, variable) => (startAngle, endAngle,
|
|
|
57
57
|
}
|
|
58
58
|
return y;
|
|
59
59
|
};
|
|
60
|
-
|
|
60
|
+
function PieArcLabel(props) {
|
|
61
61
|
const {
|
|
62
62
|
id,
|
|
63
63
|
classes: innerClasses,
|
|
@@ -98,12 +98,8 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
|
98
98
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
99
99
|
// ----------------------------------------------------------------------
|
|
100
100
|
classes: PropTypes.object,
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
}),
|
|
107
|
-
innerRadius: PropTypes.number,
|
|
108
|
-
outerRadius: PropTypes.number.isRequired
|
|
109
|
-
} : void 0;
|
|
101
|
+
formattedArcLabel: PropTypes.string,
|
|
102
|
+
isFaded: PropTypes.bool.isRequired,
|
|
103
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
104
|
+
} : void 0;
|
|
105
|
+
export { PieArcLabel };
|
|
@@ -3,10 +3,11 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
4
4
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { useTransition } from '@react-spring/web';
|
|
7
8
|
import { defaultLabelTransitionConfig } from './dataTransform/transition';
|
|
8
9
|
import { useTransformData } from './dataTransform/useTransformData';
|
|
9
|
-
import PieArcLabel from './PieArcLabel';
|
|
10
|
+
import { PieArcLabel } from './PieArcLabel';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
12
|
const RATIO = 180 / Math.PI;
|
|
12
13
|
function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
@@ -22,7 +23,7 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
|
22
23
|
}
|
|
23
24
|
return arcLabel(item);
|
|
24
25
|
}
|
|
25
|
-
|
|
26
|
+
function PieArcLabelPlot(props) {
|
|
26
27
|
const {
|
|
27
28
|
slots,
|
|
28
29
|
slotProps,
|
|
@@ -87,4 +88,92 @@ export function PieArcLabelPlot(props) {
|
|
|
87
88
|
}, slotProps?.pieArcLabel));
|
|
88
89
|
})
|
|
89
90
|
}));
|
|
90
|
-
}
|
|
91
|
+
}
|
|
92
|
+
process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
93
|
+
// ----------------------------- Warning --------------------------------
|
|
94
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
95
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
96
|
+
// ----------------------------------------------------------------------
|
|
97
|
+
/**
|
|
98
|
+
* The label displayed into the arc.
|
|
99
|
+
*/
|
|
100
|
+
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
101
|
+
/**
|
|
102
|
+
* The minimal angle required to display the arc label.
|
|
103
|
+
*/
|
|
104
|
+
arcLabelMinAngle: PropTypes.number,
|
|
105
|
+
/**
|
|
106
|
+
* The radius applied to arc corners (similar to border radius).
|
|
107
|
+
* @default 0
|
|
108
|
+
*/
|
|
109
|
+
cornerRadius: PropTypes.number,
|
|
110
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
111
|
+
color: PropTypes.string.isRequired,
|
|
112
|
+
endAngle: PropTypes.number.isRequired,
|
|
113
|
+
formattedValue: PropTypes.string.isRequired,
|
|
114
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
115
|
+
index: PropTypes.number.isRequired,
|
|
116
|
+
label: PropTypes.string,
|
|
117
|
+
padAngle: PropTypes.number.isRequired,
|
|
118
|
+
startAngle: PropTypes.number.isRequired,
|
|
119
|
+
value: PropTypes.number.isRequired
|
|
120
|
+
})).isRequired,
|
|
121
|
+
/**
|
|
122
|
+
* Override the arc attibutes when it is faded.
|
|
123
|
+
*/
|
|
124
|
+
faded: PropTypes.shape({
|
|
125
|
+
additionalRadius: PropTypes.number,
|
|
126
|
+
color: PropTypes.string,
|
|
127
|
+
cornerRadius: PropTypes.number,
|
|
128
|
+
innerRadius: PropTypes.number,
|
|
129
|
+
outerRadius: PropTypes.number,
|
|
130
|
+
paddingAngle: PropTypes.number
|
|
131
|
+
}),
|
|
132
|
+
/**
|
|
133
|
+
* Override the arc attibutes when it is highlighted.
|
|
134
|
+
*/
|
|
135
|
+
highlighted: PropTypes.shape({
|
|
136
|
+
additionalRadius: PropTypes.number,
|
|
137
|
+
color: PropTypes.string,
|
|
138
|
+
cornerRadius: PropTypes.number,
|
|
139
|
+
innerRadius: PropTypes.number,
|
|
140
|
+
outerRadius: PropTypes.number,
|
|
141
|
+
paddingAngle: PropTypes.number
|
|
142
|
+
}),
|
|
143
|
+
highlightScope: PropTypes.shape({
|
|
144
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
145
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
146
|
+
}),
|
|
147
|
+
id: PropTypes.string.isRequired,
|
|
148
|
+
/**
|
|
149
|
+
* The radius between circle center and the begining of the arc.
|
|
150
|
+
* @default 0
|
|
151
|
+
*/
|
|
152
|
+
innerRadius: PropTypes.number,
|
|
153
|
+
/**
|
|
154
|
+
* The radius between circle center and the end of the arc.
|
|
155
|
+
* @default R_max The maximal radius that fit into the drawing area.
|
|
156
|
+
*/
|
|
157
|
+
outerRadius: PropTypes.number.isRequired,
|
|
158
|
+
/**
|
|
159
|
+
* The padding angle (deg) between two arcs.
|
|
160
|
+
* @default 0
|
|
161
|
+
*/
|
|
162
|
+
paddingAngle: PropTypes.number,
|
|
163
|
+
/**
|
|
164
|
+
* If `true`, animations are skiped.
|
|
165
|
+
* @default false
|
|
166
|
+
*/
|
|
167
|
+
skipAnimation: PropTypes.bool,
|
|
168
|
+
/**
|
|
169
|
+
* The props used for each component slot.
|
|
170
|
+
* @default {}
|
|
171
|
+
*/
|
|
172
|
+
slotProps: PropTypes.object,
|
|
173
|
+
/**
|
|
174
|
+
* Overridable component slots.
|
|
175
|
+
* @default {}
|
|
176
|
+
*/
|
|
177
|
+
slots: PropTypes.object
|
|
178
|
+
} : void 0;
|
|
179
|
+
export { PieArcLabelPlot };
|
|
@@ -3,12 +3,13 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
3
3
|
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onClick", "skipAnimation"],
|
|
4
4
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { useTransition } from '@react-spring/web';
|
|
7
|
-
import PieArc from './PieArc';
|
|
8
|
+
import { PieArc } from './PieArc';
|
|
8
9
|
import { defaultTransitionConfig } from './dataTransform/transition';
|
|
9
10
|
import { useTransformData } from './dataTransform/useTransformData';
|
|
10
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
|
|
12
|
+
function PieArcPlot(props) {
|
|
12
13
|
const {
|
|
13
14
|
slots,
|
|
14
15
|
slotProps,
|
|
@@ -80,4 +81,91 @@ export function PieArcPlot(props) {
|
|
|
80
81
|
}, slotProps?.pieArc));
|
|
81
82
|
})
|
|
82
83
|
}));
|
|
83
|
-
}
|
|
84
|
+
}
|
|
85
|
+
process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
86
|
+
// ----------------------------- Warning --------------------------------
|
|
87
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
88
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
89
|
+
// ----------------------------------------------------------------------
|
|
90
|
+
/**
|
|
91
|
+
* The radius applied to arc corners (similar to border radius).
|
|
92
|
+
* @default 0
|
|
93
|
+
*/
|
|
94
|
+
cornerRadius: PropTypes.number,
|
|
95
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
96
|
+
color: PropTypes.string.isRequired,
|
|
97
|
+
endAngle: PropTypes.number.isRequired,
|
|
98
|
+
formattedValue: PropTypes.string.isRequired,
|
|
99
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
100
|
+
index: PropTypes.number.isRequired,
|
|
101
|
+
label: PropTypes.string,
|
|
102
|
+
padAngle: PropTypes.number.isRequired,
|
|
103
|
+
startAngle: PropTypes.number.isRequired,
|
|
104
|
+
value: PropTypes.number.isRequired
|
|
105
|
+
})).isRequired,
|
|
106
|
+
/**
|
|
107
|
+
* Override the arc attibutes when it is faded.
|
|
108
|
+
*/
|
|
109
|
+
faded: PropTypes.shape({
|
|
110
|
+
additionalRadius: PropTypes.number,
|
|
111
|
+
color: PropTypes.string,
|
|
112
|
+
cornerRadius: PropTypes.number,
|
|
113
|
+
innerRadius: PropTypes.number,
|
|
114
|
+
outerRadius: PropTypes.number,
|
|
115
|
+
paddingAngle: PropTypes.number
|
|
116
|
+
}),
|
|
117
|
+
/**
|
|
118
|
+
* Override the arc attibutes when it is highlighted.
|
|
119
|
+
*/
|
|
120
|
+
highlighted: PropTypes.shape({
|
|
121
|
+
additionalRadius: PropTypes.number,
|
|
122
|
+
color: PropTypes.string,
|
|
123
|
+
cornerRadius: PropTypes.number,
|
|
124
|
+
innerRadius: PropTypes.number,
|
|
125
|
+
outerRadius: PropTypes.number,
|
|
126
|
+
paddingAngle: PropTypes.number
|
|
127
|
+
}),
|
|
128
|
+
highlightScope: PropTypes.shape({
|
|
129
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
130
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
131
|
+
}),
|
|
132
|
+
id: PropTypes.string.isRequired,
|
|
133
|
+
/**
|
|
134
|
+
* The radius between circle center and the begining of the arc.
|
|
135
|
+
* @default 0
|
|
136
|
+
*/
|
|
137
|
+
innerRadius: PropTypes.number,
|
|
138
|
+
/**
|
|
139
|
+
* Callback fired when a pie item is clicked.
|
|
140
|
+
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
141
|
+
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
142
|
+
* @param {DefaultizedPieValueType} item The pie item.
|
|
143
|
+
*/
|
|
144
|
+
onClick: PropTypes.func,
|
|
145
|
+
/**
|
|
146
|
+
* The radius between circle center and the end of the arc.
|
|
147
|
+
* @default R_max The maximal radius that fit into the drawing area.
|
|
148
|
+
*/
|
|
149
|
+
outerRadius: PropTypes.number.isRequired,
|
|
150
|
+
/**
|
|
151
|
+
* The padding angle (deg) between two arcs.
|
|
152
|
+
* @default 0
|
|
153
|
+
*/
|
|
154
|
+
paddingAngle: PropTypes.number,
|
|
155
|
+
/**
|
|
156
|
+
* If `true`, animations are skiped.
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
skipAnimation: PropTypes.bool,
|
|
160
|
+
/**
|
|
161
|
+
* The props used for each component slot.
|
|
162
|
+
* @default {}
|
|
163
|
+
*/
|
|
164
|
+
slotProps: PropTypes.object,
|
|
165
|
+
/**
|
|
166
|
+
* Overridable component slots.
|
|
167
|
+
* @default {}
|
|
168
|
+
*/
|
|
169
|
+
slots: PropTypes.object
|
|
170
|
+
} : void 0;
|
|
171
|
+
export { PieArcPlot };
|
package/modern/PieChart/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './PieChart';
|
|
2
|
+
export * from './PiePlot';
|
|
3
|
+
export * from './PieArcPlot';
|
|
4
|
+
export * from './PieArcLabelPlot';
|
|
3
5
|
export * from './PieArc';
|
|
4
6
|
export * from './PieArcLabel';
|
|
@@ -78,7 +78,7 @@ process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
|
78
78
|
color: PropTypes.string.isRequired,
|
|
79
79
|
markerSize: PropTypes.number.isRequired,
|
|
80
80
|
series: PropTypes.shape({
|
|
81
|
-
color: PropTypes.string,
|
|
81
|
+
color: PropTypes.string.isRequired,
|
|
82
82
|
data: PropTypes.arrayOf(PropTypes.shape({
|
|
83
83
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
84
84
|
x: PropTypes.number.isRequired,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
3
|
-
export
|
|
1
|
+
export * from './ScatterChart';
|
|
2
|
+
export * from './ScatterPlot';
|
|
3
|
+
export * from './Scatter';
|
package/modern/index.js
CHANGED
|
@@ -2,9 +2,9 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
function defaultizeValueFormatter(series, defaultValueFormatter) {
|
|
3
3
|
const defaultizedSeries = {};
|
|
4
4
|
Object.keys(series).forEach(seriesId => {
|
|
5
|
-
defaultizedSeries[seriesId] = _extends({
|
|
6
|
-
valueFormatter: defaultValueFormatter
|
|
7
|
-
}
|
|
5
|
+
defaultizedSeries[seriesId] = _extends({}, series[seriesId], {
|
|
6
|
+
valueFormatter: series[seriesId].valueFormatter ?? defaultValueFormatter
|
|
7
|
+
});
|
|
8
8
|
});
|
|
9
9
|
return defaultizedSeries;
|
|
10
10
|
}
|
package/package.json
CHANGED
|
@@ -24,6 +24,7 @@ export interface ChartsComponents {
|
|
|
24
24
|
};
|
|
25
25
|
MuiChartsTooltip?: {
|
|
26
26
|
defaultProps?: ComponentsProps['MuiChartsTooltip'];
|
|
27
|
+
styleOverrides?: ComponentsOverrides['MuiChartsTooltip'];
|
|
27
28
|
};
|
|
28
29
|
MuiChartsSurface?: {
|
|
29
30
|
defaultProps?: ComponentsProps['MuiChartsSurface'];
|
|
@@ -2,6 +2,7 @@ import { BarElementClassKey } from '../BarChart/BarElement';
|
|
|
2
2
|
import { ChartsAxisClassKey } from '../ChartsAxis';
|
|
3
3
|
import { ChartsAxisHighlightClassKey } from '../ChartsAxisHighlight';
|
|
4
4
|
import { ChartsLegendClassKey } from '../ChartsLegend';
|
|
5
|
+
import { ChartsTooltipClassKey } from '../ChartsTooltip';
|
|
5
6
|
import { AreaElementClassKey, LineElementClassKey, MarkElementClassKey } from '../LineChart';
|
|
6
7
|
|
|
7
8
|
// prettier-ignore
|
|
@@ -9,6 +10,7 @@ export interface PickersComponentNameToClassKey {
|
|
|
9
10
|
MuiChartsAxis: ChartsAxisClassKey;
|
|
10
11
|
MuiChartsAxisHighlight: ChartsAxisHighlightClassKey;
|
|
11
12
|
MuiChartsLegend: ChartsLegendClassKey;
|
|
13
|
+
MuiChartsTooltip: ChartsTooltipClassKey;
|
|
12
14
|
|
|
13
15
|
// BarChart components
|
|
14
16
|
MuiBarElement: BarElementClassKey;
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export interface ChartsTooltipClasses {
|
|
2
|
-
/** Styles applied to the root element. */
|
|
3
|
-
root: string;
|
|
4
|
-
/** Styles applied to the markCell element. */
|
|
5
|
-
markCell: string;
|
|
6
|
-
/** Styles applied to the labelCell element. */
|
|
7
|
-
labelCell: string;
|
|
8
|
-
/** Styles applied to the valueCell element. */
|
|
9
|
-
valueCell: string;
|
|
10
|
-
}
|
|
11
|
-
export type ChartsTooltipClassKey = keyof ChartsTooltipClasses;
|
|
12
|
-
export declare function getTooltipUtilityClass(slot: string): string;
|
|
13
|
-
export declare const tooltipClasses: ChartsTooltipClasses;
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getTooltipUtilityClass = getTooltipUtilityClass;
|
|
7
|
-
exports.tooltipClasses = void 0;
|
|
8
|
-
var _utils = require("@mui/utils");
|
|
9
|
-
function getTooltipUtilityClass(slot) {
|
|
10
|
-
return (0, _utils.unstable_generateUtilityClass)('MuiChartsTooltip', slot);
|
|
11
|
-
}
|
|
12
|
-
const tooltipClasses = exports.tooltipClasses = (0, _utils.unstable_generateUtilityClasses)('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
-
export function getTooltipUtilityClass(slot) {
|
|
3
|
-
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
-
}
|
|
5
|
-
export const tooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
-
export function getTooltipUtilityClass(slot) {
|
|
3
|
-
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
-
}
|
|
5
|
-
export var tooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
-
export function getTooltipUtilityClass(slot) {
|
|
3
|
-
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
-
}
|
|
5
|
-
export const tooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'markCell', 'labelCell', 'valueCell']);
|