@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
|
@@ -71,7 +71,7 @@ export function useMouseTracker() {
|
|
|
71
71
|
}, [svgRef]);
|
|
72
72
|
return mousePosition;
|
|
73
73
|
}
|
|
74
|
-
export function
|
|
74
|
+
export function getTooltipHasData(trigger, displayedData) {
|
|
75
75
|
if (trigger === 'item') {
|
|
76
76
|
return displayedData !== null;
|
|
77
77
|
}
|
|
@@ -75,6 +75,8 @@ function ChartsYAxis(inProps) {
|
|
|
75
75
|
tickFontSize,
|
|
76
76
|
label,
|
|
77
77
|
labelFontSize,
|
|
78
|
+
labelStyle,
|
|
79
|
+
tickLabelStyle,
|
|
78
80
|
tickSize: tickSizeProp,
|
|
79
81
|
valueFormatter,
|
|
80
82
|
slots,
|
|
@@ -109,11 +111,11 @@ function ChartsYAxis(inProps) {
|
|
|
109
111
|
elementType: TickLabel,
|
|
110
112
|
externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
|
|
111
113
|
additionalProps: {
|
|
112
|
-
style: {
|
|
114
|
+
style: _extends({
|
|
113
115
|
fontSize: tickFontSize,
|
|
114
116
|
textAnchor: position === 'right' ? 'start' : 'end',
|
|
115
117
|
dominantBaseline: 'central'
|
|
116
|
-
},
|
|
118
|
+
}, tickLabelStyle),
|
|
117
119
|
className: classes.tickLabel
|
|
118
120
|
},
|
|
119
121
|
ownerState: {}
|
|
@@ -122,12 +124,12 @@ function ChartsYAxis(inProps) {
|
|
|
122
124
|
elementType: Label,
|
|
123
125
|
externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
|
|
124
126
|
additionalProps: {
|
|
125
|
-
style: {
|
|
127
|
+
style: _extends({
|
|
126
128
|
fontSize: labelFontSize,
|
|
127
129
|
angle: positionSign * 90,
|
|
128
130
|
textAnchor: 'middle',
|
|
129
131
|
dominantBaseline: 'auto'
|
|
130
|
-
}
|
|
132
|
+
}, labelStyle)
|
|
131
133
|
},
|
|
132
134
|
ownerState: {}
|
|
133
135
|
});
|
|
@@ -7,6 +7,18 @@ export const getExtremumX = params => {
|
|
|
7
7
|
const maxX = Math.max(...((_axis$data2 = axis.data) != null ? _axis$data2 : []));
|
|
8
8
|
return [minX, maxX];
|
|
9
9
|
};
|
|
10
|
+
function getSeriesExtremums(getValues, stackedData) {
|
|
11
|
+
if (stackedData.length === 0) {
|
|
12
|
+
return [null, null];
|
|
13
|
+
}
|
|
14
|
+
return stackedData.reduce((seriesAcc, stackedValue) => {
|
|
15
|
+
const [base, value] = getValues(stackedValue);
|
|
16
|
+
if (seriesAcc[0] === null) {
|
|
17
|
+
return [Math.min(base, value), Math.max(base, value)];
|
|
18
|
+
}
|
|
19
|
+
return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
|
|
20
|
+
}, getValues(stackedData[0]));
|
|
21
|
+
}
|
|
10
22
|
export const getExtremumY = params => {
|
|
11
23
|
const {
|
|
12
24
|
series,
|
|
@@ -14,16 +26,21 @@ export const getExtremumY = params => {
|
|
|
14
26
|
isDefaultAxis
|
|
15
27
|
} = params;
|
|
16
28
|
return Object.keys(series).filter(seriesId => series[seriesId].yAxisKey === axis.id || isDefaultAxis && series[seriesId].yAxisKey === undefined).reduce((acc, seriesId) => {
|
|
17
|
-
const
|
|
18
|
-
|
|
29
|
+
const {
|
|
30
|
+
area,
|
|
31
|
+
stackedData
|
|
32
|
+
} = series[seriesId];
|
|
33
|
+
const isArea = area !== undefined;
|
|
34
|
+
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]).
|
|
19
35
|
|
|
20
|
-
const
|
|
21
|
-
|
|
22
|
-
return
|
|
23
|
-
}
|
|
24
|
-
if (
|
|
25
|
-
return
|
|
36
|
+
const seriesExtremums = getSeriesExtremums(getValues, stackedData);
|
|
37
|
+
if (acc[0] === null) {
|
|
38
|
+
return seriesExtremums;
|
|
39
|
+
}
|
|
40
|
+
if (seriesExtremums[0] === null) {
|
|
41
|
+
return acc;
|
|
26
42
|
}
|
|
43
|
+
const [seriesMin, seriesMax] = seriesExtremums;
|
|
27
44
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
28
45
|
}, [null, null]);
|
|
29
46
|
};
|
package/esm/LineChart/index.js
CHANGED
|
@@ -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';
|
package/esm/PieChart/PieArc.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 = ["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) {
|
|
@@ -23,7 +24,7 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
|
23
24
|
}
|
|
24
25
|
return arcLabel(item);
|
|
25
26
|
}
|
|
26
|
-
|
|
27
|
+
function PieArcLabelPlot(props) {
|
|
27
28
|
var _slots$pieArcLabel;
|
|
28
29
|
const {
|
|
29
30
|
slots,
|
|
@@ -89,4 +90,92 @@ export function PieArcLabelPlot(props) {
|
|
|
89
90
|
}, slotProps == null ? void 0 : slotProps.pieArcLabel));
|
|
90
91
|
})
|
|
91
92
|
}));
|
|
92
|
-
}
|
|
93
|
+
}
|
|
94
|
+
process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
95
|
+
// ----------------------------- Warning --------------------------------
|
|
96
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
97
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
98
|
+
// ----------------------------------------------------------------------
|
|
99
|
+
/**
|
|
100
|
+
* The label displayed into the arc.
|
|
101
|
+
*/
|
|
102
|
+
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
103
|
+
/**
|
|
104
|
+
* The minimal angle required to display the arc label.
|
|
105
|
+
*/
|
|
106
|
+
arcLabelMinAngle: PropTypes.number,
|
|
107
|
+
/**
|
|
108
|
+
* The radius applied to arc corners (similar to border radius).
|
|
109
|
+
* @default 0
|
|
110
|
+
*/
|
|
111
|
+
cornerRadius: PropTypes.number,
|
|
112
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
113
|
+
color: PropTypes.string.isRequired,
|
|
114
|
+
endAngle: PropTypes.number.isRequired,
|
|
115
|
+
formattedValue: PropTypes.string.isRequired,
|
|
116
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
117
|
+
index: PropTypes.number.isRequired,
|
|
118
|
+
label: PropTypes.string,
|
|
119
|
+
padAngle: PropTypes.number.isRequired,
|
|
120
|
+
startAngle: PropTypes.number.isRequired,
|
|
121
|
+
value: PropTypes.number.isRequired
|
|
122
|
+
})).isRequired,
|
|
123
|
+
/**
|
|
124
|
+
* Override the arc attibutes when it is faded.
|
|
125
|
+
*/
|
|
126
|
+
faded: PropTypes.shape({
|
|
127
|
+
additionalRadius: PropTypes.number,
|
|
128
|
+
color: PropTypes.string,
|
|
129
|
+
cornerRadius: PropTypes.number,
|
|
130
|
+
innerRadius: PropTypes.number,
|
|
131
|
+
outerRadius: PropTypes.number,
|
|
132
|
+
paddingAngle: PropTypes.number
|
|
133
|
+
}),
|
|
134
|
+
/**
|
|
135
|
+
* Override the arc attibutes when it is highlighted.
|
|
136
|
+
*/
|
|
137
|
+
highlighted: PropTypes.shape({
|
|
138
|
+
additionalRadius: PropTypes.number,
|
|
139
|
+
color: PropTypes.string,
|
|
140
|
+
cornerRadius: PropTypes.number,
|
|
141
|
+
innerRadius: PropTypes.number,
|
|
142
|
+
outerRadius: PropTypes.number,
|
|
143
|
+
paddingAngle: PropTypes.number
|
|
144
|
+
}),
|
|
145
|
+
highlightScope: PropTypes.shape({
|
|
146
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
147
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
148
|
+
}),
|
|
149
|
+
id: PropTypes.string.isRequired,
|
|
150
|
+
/**
|
|
151
|
+
* The radius between circle center and the begining of the arc.
|
|
152
|
+
* @default 0
|
|
153
|
+
*/
|
|
154
|
+
innerRadius: PropTypes.number,
|
|
155
|
+
/**
|
|
156
|
+
* The radius between circle center and the end of the arc.
|
|
157
|
+
* @default R_max The maximal radius that fit into the drawing area.
|
|
158
|
+
*/
|
|
159
|
+
outerRadius: PropTypes.number.isRequired,
|
|
160
|
+
/**
|
|
161
|
+
* The padding angle (deg) between two arcs.
|
|
162
|
+
* @default 0
|
|
163
|
+
*/
|
|
164
|
+
paddingAngle: PropTypes.number,
|
|
165
|
+
/**
|
|
166
|
+
* If `true`, animations are skiped.
|
|
167
|
+
* @default false
|
|
168
|
+
*/
|
|
169
|
+
skipAnimation: PropTypes.bool,
|
|
170
|
+
/**
|
|
171
|
+
* The props used for each component slot.
|
|
172
|
+
* @default {}
|
|
173
|
+
*/
|
|
174
|
+
slotProps: PropTypes.object,
|
|
175
|
+
/**
|
|
176
|
+
* Overridable component slots.
|
|
177
|
+
* @default {}
|
|
178
|
+
*/
|
|
179
|
+
slots: PropTypes.object
|
|
180
|
+
} : void 0;
|
|
181
|
+
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
|
var _slots$pieArc;
|
|
13
14
|
const {
|
|
14
15
|
slots,
|
|
@@ -81,4 +82,91 @@ export function PieArcPlot(props) {
|
|
|
81
82
|
}, slotProps == null ? void 0 : slotProps.pieArc));
|
|
82
83
|
})
|
|
83
84
|
}));
|
|
84
|
-
}
|
|
85
|
+
}
|
|
86
|
+
process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
87
|
+
// ----------------------------- Warning --------------------------------
|
|
88
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
89
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
90
|
+
// ----------------------------------------------------------------------
|
|
91
|
+
/**
|
|
92
|
+
* The radius applied to arc corners (similar to border radius).
|
|
93
|
+
* @default 0
|
|
94
|
+
*/
|
|
95
|
+
cornerRadius: PropTypes.number,
|
|
96
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
97
|
+
color: PropTypes.string.isRequired,
|
|
98
|
+
endAngle: PropTypes.number.isRequired,
|
|
99
|
+
formattedValue: PropTypes.string.isRequired,
|
|
100
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
101
|
+
index: PropTypes.number.isRequired,
|
|
102
|
+
label: PropTypes.string,
|
|
103
|
+
padAngle: PropTypes.number.isRequired,
|
|
104
|
+
startAngle: PropTypes.number.isRequired,
|
|
105
|
+
value: PropTypes.number.isRequired
|
|
106
|
+
})).isRequired,
|
|
107
|
+
/**
|
|
108
|
+
* Override the arc attibutes when it is faded.
|
|
109
|
+
*/
|
|
110
|
+
faded: PropTypes.shape({
|
|
111
|
+
additionalRadius: PropTypes.number,
|
|
112
|
+
color: PropTypes.string,
|
|
113
|
+
cornerRadius: PropTypes.number,
|
|
114
|
+
innerRadius: PropTypes.number,
|
|
115
|
+
outerRadius: PropTypes.number,
|
|
116
|
+
paddingAngle: PropTypes.number
|
|
117
|
+
}),
|
|
118
|
+
/**
|
|
119
|
+
* Override the arc attibutes when it is highlighted.
|
|
120
|
+
*/
|
|
121
|
+
highlighted: PropTypes.shape({
|
|
122
|
+
additionalRadius: PropTypes.number,
|
|
123
|
+
color: PropTypes.string,
|
|
124
|
+
cornerRadius: PropTypes.number,
|
|
125
|
+
innerRadius: PropTypes.number,
|
|
126
|
+
outerRadius: PropTypes.number,
|
|
127
|
+
paddingAngle: PropTypes.number
|
|
128
|
+
}),
|
|
129
|
+
highlightScope: PropTypes.shape({
|
|
130
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
131
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
132
|
+
}),
|
|
133
|
+
id: PropTypes.string.isRequired,
|
|
134
|
+
/**
|
|
135
|
+
* The radius between circle center and the begining of the arc.
|
|
136
|
+
* @default 0
|
|
137
|
+
*/
|
|
138
|
+
innerRadius: PropTypes.number,
|
|
139
|
+
/**
|
|
140
|
+
* Callback fired when a pie item is clicked.
|
|
141
|
+
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
142
|
+
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
143
|
+
* @param {DefaultizedPieValueType} item The pie item.
|
|
144
|
+
*/
|
|
145
|
+
onClick: PropTypes.func,
|
|
146
|
+
/**
|
|
147
|
+
* The radius between circle center and the end of the arc.
|
|
148
|
+
* @default R_max The maximal radius that fit into the drawing area.
|
|
149
|
+
*/
|
|
150
|
+
outerRadius: PropTypes.number.isRequired,
|
|
151
|
+
/**
|
|
152
|
+
* The padding angle (deg) between two arcs.
|
|
153
|
+
* @default 0
|
|
154
|
+
*/
|
|
155
|
+
paddingAngle: PropTypes.number,
|
|
156
|
+
/**
|
|
157
|
+
* If `true`, animations are skiped.
|
|
158
|
+
* @default false
|
|
159
|
+
*/
|
|
160
|
+
skipAnimation: PropTypes.bool,
|
|
161
|
+
/**
|
|
162
|
+
* The props used for each component slot.
|
|
163
|
+
* @default {}
|
|
164
|
+
*/
|
|
165
|
+
slotProps: PropTypes.object,
|
|
166
|
+
/**
|
|
167
|
+
* Overridable component slots.
|
|
168
|
+
* @default {}
|
|
169
|
+
*/
|
|
170
|
+
slots: PropTypes.object
|
|
171
|
+
} : void 0;
|
|
172
|
+
export { PieArcPlot };
|
package/esm/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';
|
|
@@ -2,9 +2,10 @@ 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
|
-
|
|
6
|
-
|
|
7
|
-
|
|
5
|
+
var _series$seriesId$valu;
|
|
6
|
+
defaultizedSeries[seriesId] = _extends({}, series[seriesId], {
|
|
7
|
+
valueFormatter: (_series$seriesId$valu = series[seriesId].valueFormatter) != null ? _series$seriesId$valu : defaultValueFormatter
|
|
8
|
+
});
|
|
8
9
|
});
|
|
9
10
|
return defaultizedSeries;
|
|
10
11
|
}
|
package/index.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
declare function defaultizeValueFormatter<ISeries extends {
|
|
1
|
+
declare function defaultizeValueFormatter<ISeries extends {
|
|
2
|
+
valueFormatter?: IFormatter;
|
|
3
|
+
}, IFormatter extends (v: any) => string>(series: {
|
|
2
4
|
[id: string]: ISeries;
|
|
3
5
|
}, defaultValueFormatter: IFormatter): {
|
|
4
6
|
[id: string]: ISeries & {
|
|
@@ -9,9 +9,9 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
9
9
|
function defaultizeValueFormatter(series, defaultValueFormatter) {
|
|
10
10
|
const defaultizedSeries = {};
|
|
11
11
|
Object.keys(series).forEach(seriesId => {
|
|
12
|
-
defaultizedSeries[seriesId] = (0, _extends2.default)({
|
|
13
|
-
valueFormatter: defaultValueFormatter
|
|
14
|
-
}
|
|
12
|
+
defaultizedSeries[seriesId] = (0, _extends2.default)({}, series[seriesId], {
|
|
13
|
+
valueFormatter: series[seriesId].valueFormatter ?? defaultValueFormatter
|
|
14
|
+
});
|
|
15
15
|
});
|
|
16
16
|
return defaultizedSeries;
|
|
17
17
|
}
|
|
@@ -2,6 +2,7 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style"];
|
|
4
4
|
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
5
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
6
7
|
import { useSlotProps } from '@mui/base/utils';
|
|
7
8
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
@@ -40,7 +41,7 @@ export var BarElementPath = styled(animated.rect, {
|
|
|
40
41
|
opacity: ownerState.isFaded && 0.3 || 1
|
|
41
42
|
};
|
|
42
43
|
});
|
|
43
|
-
|
|
44
|
+
function BarElement(props) {
|
|
44
45
|
var _slots$bar;
|
|
45
46
|
var id = props.id,
|
|
46
47
|
dataIndex = props.dataIndex,
|
|
@@ -88,4 +89,27 @@ export function BarElement(props) {
|
|
|
88
89
|
ownerState: ownerState
|
|
89
90
|
});
|
|
90
91
|
return /*#__PURE__*/_jsx(Bar, _extends({}, barProps));
|
|
91
|
-
}
|
|
92
|
+
}
|
|
93
|
+
process.env.NODE_ENV !== "production" ? BarElement.propTypes = {
|
|
94
|
+
// ----------------------------- Warning --------------------------------
|
|
95
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
96
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
97
|
+
// ----------------------------------------------------------------------
|
|
98
|
+
classes: PropTypes.object,
|
|
99
|
+
dataIndex: PropTypes.number.isRequired,
|
|
100
|
+
highlightScope: PropTypes.shape({
|
|
101
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
102
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
103
|
+
}),
|
|
104
|
+
/**
|
|
105
|
+
* The props used for each component slot.
|
|
106
|
+
* @default {}
|
|
107
|
+
*/
|
|
108
|
+
slotProps: PropTypes.object,
|
|
109
|
+
/**
|
|
110
|
+
* Overridable component slots.
|
|
111
|
+
* @default {}
|
|
112
|
+
*/
|
|
113
|
+
slots: PropTypes.object
|
|
114
|
+
} : void 0;
|
|
115
|
+
export { BarElement };
|
package/legacy/BarChart/index.js
CHANGED
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export
|
|
2
|
-
export
|
|
1
|
+
export * from './BarChart';
|
|
2
|
+
export * from './BarPlot';
|
|
3
|
+
export * from './BarElement';
|