@mui/x-charts 7.0.0-alpha.2 → 7.0.0-alpha.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 +2 -1
- package/BarChart/index.js +15 -4
- package/CHANGELOG.md +241 -0
- package/ChartsLegend/index.d.ts +1 -0
- package/ChartsLegend/index.js +11 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +5 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +93 -73
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +38 -57
- 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/index.d.ts +4 -0
- package/ChartsTooltip/index.js +44 -0
- package/ChartsYAxis/ChartsYAxis.js +6 -4
- package/LineChart/extremums.js +25 -8
- package/LineChart/index.d.ts +1 -1
- package/LineChart/index.js +11 -11
- 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 +3 -1
- package/PieChart/index.js +26 -4
- package/README.md +0 -1
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/index.d.ts +1 -1
- package/ScatterChart/index.js +8 -8
- package/esm/BarChart/BarElement.js +26 -2
- package/esm/BarChart/index.js +2 -1
- package/esm/ChartsLegend/index.js +2 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +95 -75
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +40 -58
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +168 -0
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
- package/esm/ChartsTooltip/index.js +5 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +6 -4
- package/esm/LineChart/extremums.js +25 -8
- package/esm/LineChart/index.js +1 -1
- 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 +3 -1
- package/esm/ScatterChart/Scatter.js +1 -1
- package/esm/ScatterChart/index.js +1 -1
- 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 +2 -1
- package/legacy/ChartsLegend/index.js +2 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +95 -74
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +40 -55
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +89 -0
- package/legacy/ChartsTooltip/index.js +5 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +6 -4
- package/legacy/LineChart/extremums.js +29 -14
- package/legacy/LineChart/index.js +1 -1
- 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 +3 -1
- package/legacy/ScatterChart/Scatter.js +1 -1
- package/legacy/ScatterChart/index.js +1 -1
- 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 +2 -1
- package/modern/ChartsLegend/index.js +2 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +95 -74
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +40 -58
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +167 -0
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +92 -0
- package/modern/ChartsTooltip/index.js +5 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +6 -4
- package/modern/LineChart/extremums.js +25 -8
- package/modern/LineChart/index.js +1 -1
- 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 +3 -1
- package/modern/ScatterChart/Scatter.js +1 -1
- package/modern/ScatterChart/index.js +1 -1
- package/modern/index.js +1 -1
- package/modern/internals/defaultizeValueFormatter.js +3 -3
- package/package.json +2 -2
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import Typography from '@mui/material/Typography';
|
|
5
|
+
import { ChartsTooltipCell, ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipMark, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
|
+
function DefaultChartsAxisTooltipContent(props) {
|
|
9
|
+
var _axis$valueFormatter;
|
|
10
|
+
var series = props.series,
|
|
11
|
+
axis = props.axis,
|
|
12
|
+
dataIndex = props.dataIndex,
|
|
13
|
+
axisValue = props.axisValue,
|
|
14
|
+
sx = props.sx,
|
|
15
|
+
classes = props.classes;
|
|
16
|
+
if (dataIndex == null) {
|
|
17
|
+
return null;
|
|
18
|
+
}
|
|
19
|
+
var axisFormatter = (_axis$valueFormatter = axis.valueFormatter) != null ? _axis$valueFormatter : function (v) {
|
|
20
|
+
return v.toLocaleString();
|
|
21
|
+
};
|
|
22
|
+
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
23
|
+
sx: sx,
|
|
24
|
+
className: classes.root,
|
|
25
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
26
|
+
className: classes.table,
|
|
27
|
+
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
28
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
|
|
29
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
30
|
+
colSpan: 3,
|
|
31
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
32
|
+
children: axisFormatter(axisValue)
|
|
33
|
+
})
|
|
34
|
+
})
|
|
35
|
+
})
|
|
36
|
+
}), /*#__PURE__*/_jsx("tbody", {
|
|
37
|
+
children: series.map(function (_ref) {
|
|
38
|
+
var color = _ref.color,
|
|
39
|
+
id = _ref.id,
|
|
40
|
+
label = _ref.label,
|
|
41
|
+
valueFormatter = _ref.valueFormatter,
|
|
42
|
+
data = _ref.data;
|
|
43
|
+
var formattedValue = valueFormatter(data[dataIndex]);
|
|
44
|
+
if (formattedValue == null) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
48
|
+
className: classes.row,
|
|
49
|
+
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
50
|
+
className: clsx(classes.markCell, classes.cell),
|
|
51
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
52
|
+
ownerState: {
|
|
53
|
+
color: color
|
|
54
|
+
},
|
|
55
|
+
boxShadow: 1,
|
|
56
|
+
className: classes.mark
|
|
57
|
+
})
|
|
58
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
59
|
+
className: clsx(classes.labelCell, classes.cell),
|
|
60
|
+
children: label ? /*#__PURE__*/_jsx(Typography, {
|
|
61
|
+
children: label
|
|
62
|
+
}) : null
|
|
63
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
64
|
+
className: clsx(classes.valueCell, classes.cell),
|
|
65
|
+
children: /*#__PURE__*/_jsx(Typography, {
|
|
66
|
+
children: formattedValue
|
|
67
|
+
})
|
|
68
|
+
})]
|
|
69
|
+
}, id);
|
|
70
|
+
})
|
|
71
|
+
})]
|
|
72
|
+
})
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propTypes = {
|
|
76
|
+
// ----------------------------- Warning --------------------------------
|
|
77
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
78
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
79
|
+
// ----------------------------------------------------------------------
|
|
80
|
+
/**
|
|
81
|
+
* The properties of the triggered axis.
|
|
82
|
+
*/
|
|
83
|
+
axis: PropTypes.shape({
|
|
84
|
+
axisId: PropTypes.string,
|
|
85
|
+
classes: PropTypes.object,
|
|
86
|
+
data: PropTypes.array,
|
|
87
|
+
dataKey: PropTypes.string,
|
|
88
|
+
disableLine: PropTypes.bool,
|
|
89
|
+
disableTicks: PropTypes.bool,
|
|
90
|
+
fill: PropTypes.string,
|
|
91
|
+
hideTooltip: PropTypes.bool,
|
|
92
|
+
id: PropTypes.string.isRequired,
|
|
93
|
+
label: PropTypes.string,
|
|
94
|
+
labelFontSize: PropTypes.number,
|
|
95
|
+
labelStyle: PropTypes.object,
|
|
96
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
97
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
98
|
+
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
99
|
+
scale: PropTypes.func.isRequired,
|
|
100
|
+
scaleType: PropTypes.oneOf(['time']).isRequired,
|
|
101
|
+
slotProps: PropTypes.object,
|
|
102
|
+
slots: PropTypes.object,
|
|
103
|
+
stroke: PropTypes.string,
|
|
104
|
+
tickFontSize: PropTypes.number,
|
|
105
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
106
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
107
|
+
tickLabelStyle: PropTypes.object,
|
|
108
|
+
tickMaxStep: PropTypes.number,
|
|
109
|
+
tickMinStep: PropTypes.number,
|
|
110
|
+
tickNumber: PropTypes.number.isRequired,
|
|
111
|
+
tickSize: PropTypes.number,
|
|
112
|
+
valueFormatter: PropTypes.func
|
|
113
|
+
}).isRequired,
|
|
114
|
+
/**
|
|
115
|
+
* Data identifying the triggered axis.
|
|
116
|
+
*/
|
|
117
|
+
axisData: PropTypes.shape({
|
|
118
|
+
x: PropTypes.shape({
|
|
119
|
+
index: PropTypes.number,
|
|
120
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
|
|
121
|
+
}),
|
|
122
|
+
y: PropTypes.shape({
|
|
123
|
+
index: PropTypes.number,
|
|
124
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
|
|
125
|
+
})
|
|
126
|
+
}).isRequired,
|
|
127
|
+
/**
|
|
128
|
+
* The value associated to the current mouse position.
|
|
129
|
+
*/
|
|
130
|
+
axisValue: PropTypes.any.isRequired,
|
|
131
|
+
/**
|
|
132
|
+
* Override or extend the styles applied to the component.
|
|
133
|
+
*/
|
|
134
|
+
classes: PropTypes.object.isRequired,
|
|
135
|
+
/**
|
|
136
|
+
* The index of the data item triggered.
|
|
137
|
+
*/
|
|
138
|
+
dataIndex: PropTypes.number,
|
|
139
|
+
/**
|
|
140
|
+
* The series linked to the triggered axis.
|
|
141
|
+
*/
|
|
142
|
+
series: PropTypes.arrayOf(PropTypes.shape({
|
|
143
|
+
area: PropTypes.bool,
|
|
144
|
+
color: PropTypes.string.isRequired,
|
|
145
|
+
connectNulls: PropTypes.bool,
|
|
146
|
+
curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
147
|
+
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
148
|
+
dataKey: PropTypes.string,
|
|
149
|
+
disableHighlight: PropTypes.bool,
|
|
150
|
+
highlightScope: PropTypes.shape({
|
|
151
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
152
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
153
|
+
}),
|
|
154
|
+
id: PropTypes.string.isRequired,
|
|
155
|
+
label: PropTypes.string,
|
|
156
|
+
showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
157
|
+
stack: PropTypes.string,
|
|
158
|
+
stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
159
|
+
stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
160
|
+
type: PropTypes.oneOf(['line']).isRequired,
|
|
161
|
+
valueFormatter: PropTypes.func.isRequired,
|
|
162
|
+
xAxisKey: PropTypes.string,
|
|
163
|
+
yAxisKey: PropTypes.string
|
|
164
|
+
})).isRequired,
|
|
165
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
166
|
+
} : void 0;
|
|
167
|
+
export { DefaultChartsAxisTooltipContent };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
function DefaultChartsItemTooltipContent(props) {
|
|
8
|
+
var series = props.series,
|
|
9
|
+
itemData = props.itemData,
|
|
10
|
+
sx = props.sx,
|
|
11
|
+
classes = props.classes;
|
|
12
|
+
if (itemData.dataIndex === undefined) {
|
|
13
|
+
return null;
|
|
14
|
+
}
|
|
15
|
+
var _ref = series.type === 'pie' ? {
|
|
16
|
+
color: series.data[itemData.dataIndex].color,
|
|
17
|
+
displayedLabel: series.data[itemData.dataIndex].label
|
|
18
|
+
} : {
|
|
19
|
+
color: series.color,
|
|
20
|
+
displayedLabel: series.label
|
|
21
|
+
},
|
|
22
|
+
displayedLabel = _ref.displayedLabel,
|
|
23
|
+
color = _ref.color;
|
|
24
|
+
|
|
25
|
+
// TODO: Manage to let TS understand series.data and series.valueFormatter are coherent
|
|
26
|
+
// @ts-ignore
|
|
27
|
+
var formattedValue = series.valueFormatter(series.data[itemData.dataIndex]);
|
|
28
|
+
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
29
|
+
sx: sx,
|
|
30
|
+
className: classes.root,
|
|
31
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
|
|
32
|
+
className: classes.table,
|
|
33
|
+
children: /*#__PURE__*/_jsx("tbody", {
|
|
34
|
+
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
35
|
+
className: classes.row,
|
|
36
|
+
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
37
|
+
className: clsx(classes.markCell, classes.cell),
|
|
38
|
+
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
39
|
+
ownerState: {
|
|
40
|
+
color: color
|
|
41
|
+
},
|
|
42
|
+
className: classes.mark
|
|
43
|
+
})
|
|
44
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
45
|
+
className: clsx(classes.labelCell, classes.cell),
|
|
46
|
+
children: displayedLabel
|
|
47
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
48
|
+
className: clsx(classes.valueCell, classes.cell),
|
|
49
|
+
children: formattedValue
|
|
50
|
+
})]
|
|
51
|
+
})
|
|
52
|
+
})
|
|
53
|
+
})
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propTypes = {
|
|
57
|
+
// ----------------------------- Warning --------------------------------
|
|
58
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
59
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
60
|
+
// ----------------------------------------------------------------------
|
|
61
|
+
/**
|
|
62
|
+
* Override or extend the styles applied to the component.
|
|
63
|
+
*/
|
|
64
|
+
classes: PropTypes.object.isRequired,
|
|
65
|
+
/**
|
|
66
|
+
* The data used to identify the triggered item.
|
|
67
|
+
*/
|
|
68
|
+
itemData: PropTypes.shape({
|
|
69
|
+
dataIndex: PropTypes.number,
|
|
70
|
+
seriesId: PropTypes.string.isRequired,
|
|
71
|
+
type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
|
|
72
|
+
}).isRequired,
|
|
73
|
+
/**
|
|
74
|
+
* The series linked to the triggered axis.
|
|
75
|
+
*/
|
|
76
|
+
series: PropTypes.shape({
|
|
77
|
+
color: PropTypes.string,
|
|
78
|
+
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
79
|
+
highlightScope: PropTypes.shape({
|
|
80
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
81
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
82
|
+
}),
|
|
83
|
+
id: PropTypes.string.isRequired,
|
|
84
|
+
type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired,
|
|
85
|
+
valueFormatter: PropTypes.func.isRequired
|
|
86
|
+
}).isRequired,
|
|
87
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
88
|
+
} : void 0;
|
|
89
|
+
export { DefaultChartsItemTooltipContent };
|
|
@@ -1,2 +1,6 @@
|
|
|
1
1
|
export * from './ChartsTooltip';
|
|
2
|
-
export * from './chartsTooltipClasses';
|
|
2
|
+
export * from './chartsTooltipClasses';
|
|
3
|
+
export * from './ChartsAxisTooltipContent';
|
|
4
|
+
export * from './ChartsItemTooltipContent';
|
|
5
|
+
export * from './DefaultChartsAxisTooltipContent';
|
|
6
|
+
export * from './DefaultChartsItemTooltipContent';
|
|
@@ -65,6 +65,8 @@ function ChartsYAxis(inProps) {
|
|
|
65
65
|
tickFontSize = defaultizedProps.tickFontSize,
|
|
66
66
|
label = defaultizedProps.label,
|
|
67
67
|
labelFontSize = defaultizedProps.labelFontSize,
|
|
68
|
+
labelStyle = defaultizedProps.labelStyle,
|
|
69
|
+
tickLabelStyle = defaultizedProps.tickLabelStyle,
|
|
68
70
|
tickSizeProp = defaultizedProps.tickSize,
|
|
69
71
|
valueFormatter = defaultizedProps.valueFormatter,
|
|
70
72
|
slots = defaultizedProps.slots,
|
|
@@ -97,11 +99,11 @@ function ChartsYAxis(inProps) {
|
|
|
97
99
|
elementType: TickLabel,
|
|
98
100
|
externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
|
|
99
101
|
additionalProps: {
|
|
100
|
-
style: {
|
|
102
|
+
style: _extends({
|
|
101
103
|
fontSize: tickFontSize,
|
|
102
104
|
textAnchor: position === 'right' ? 'start' : 'end',
|
|
103
105
|
dominantBaseline: 'central'
|
|
104
|
-
},
|
|
106
|
+
}, tickLabelStyle),
|
|
105
107
|
className: classes.tickLabel
|
|
106
108
|
},
|
|
107
109
|
ownerState: {}
|
|
@@ -110,12 +112,12 @@ function ChartsYAxis(inProps) {
|
|
|
110
112
|
elementType: Label,
|
|
111
113
|
externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
|
|
112
114
|
additionalProps: {
|
|
113
|
-
style: {
|
|
115
|
+
style: _extends({
|
|
114
116
|
fontSize: labelFontSize,
|
|
115
117
|
angle: positionSign * 90,
|
|
116
118
|
textAnchor: 'middle',
|
|
117
119
|
dominantBaseline: 'auto'
|
|
118
|
-
}
|
|
120
|
+
}, labelStyle)
|
|
119
121
|
},
|
|
120
122
|
ownerState: {}
|
|
121
123
|
});
|
|
@@ -7,6 +7,21 @@ export var getExtremumX = function getExtremumX(params) {
|
|
|
7
7
|
var maxX = Math.max.apply(Math, _toConsumableArray((_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(function (seriesAcc, stackedValue) {
|
|
15
|
+
var _getValues = getValues(stackedValue),
|
|
16
|
+
_getValues2 = _slicedToArray(_getValues, 2),
|
|
17
|
+
base = _getValues2[0],
|
|
18
|
+
value = _getValues2[1];
|
|
19
|
+
if (seriesAcc[0] === null) {
|
|
20
|
+
return [Math.min(base, value), Math.max(base, value)];
|
|
21
|
+
}
|
|
22
|
+
return [Math.min(base, value, seriesAcc[0]), Math.max(base, value, seriesAcc[1])];
|
|
23
|
+
}, getValues(stackedData[0]));
|
|
24
|
+
}
|
|
10
25
|
export var getExtremumY = function getExtremumY(params) {
|
|
11
26
|
var series = params.series,
|
|
12
27
|
axis = params.axis,
|
|
@@ -14,26 +29,26 @@ export var getExtremumY = function getExtremumY(params) {
|
|
|
14
29
|
return Object.keys(series).filter(function (seriesId) {
|
|
15
30
|
return series[seriesId].yAxisKey === axis.id || isDefaultAxis && series[seriesId].yAxisKey === undefined;
|
|
16
31
|
}).reduce(function (acc, seriesId) {
|
|
17
|
-
var
|
|
32
|
+
var _series$seriesId = series[seriesId],
|
|
33
|
+
area = _series$seriesId.area,
|
|
34
|
+
stackedData = _series$seriesId.stackedData;
|
|
35
|
+
var isArea = area !== undefined;
|
|
18
36
|
var getValues = isArea ? function (d) {
|
|
19
37
|
return d;
|
|
20
38
|
} : function (d) {
|
|
21
39
|
return [d[1], d[1]];
|
|
22
|
-
}; //
|
|
40
|
+
}; // Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
23
41
|
|
|
24
|
-
var
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
}, getValues(series[seriesId].stackedData[0])),
|
|
31
|
-
_series$seriesId$stac2 = _slicedToArray(_series$seriesId$stac, 2),
|
|
32
|
-
seriesMin = _series$seriesId$stac2[0],
|
|
33
|
-
seriesMax = _series$seriesId$stac2[1];
|
|
34
|
-
if (acc[0] === null || acc[1] === null) {
|
|
35
|
-
return [seriesMin, seriesMax];
|
|
42
|
+
var seriesExtremums = getSeriesExtremums(getValues, stackedData);
|
|
43
|
+
if (acc[0] === null) {
|
|
44
|
+
return seriesExtremums;
|
|
45
|
+
}
|
|
46
|
+
if (seriesExtremums[0] === null) {
|
|
47
|
+
return acc;
|
|
36
48
|
}
|
|
49
|
+
var _seriesExtremums = _slicedToArray(seriesExtremums, 2),
|
|
50
|
+
seriesMin = _seriesExtremums[0],
|
|
51
|
+
seriesMax = _seriesExtremums[1];
|
|
37
52
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
38
53
|
}, [null, null]);
|
|
39
54
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
export * from './LineChart';
|
|
1
2
|
export * from './LinePlot';
|
|
2
3
|
export * from './AreaPlot';
|
|
3
4
|
export * from './MarkPlot';
|
|
4
5
|
export * from './LineHighlightPlot';
|
|
5
|
-
export * from './LineChart';
|
|
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 _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _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';
|
|
@@ -38,7 +39,7 @@ var PieArcRoot = styled(animated.path, {
|
|
|
38
39
|
strokeLinejoin: 'round'
|
|
39
40
|
};
|
|
40
41
|
});
|
|
41
|
-
|
|
42
|
+
function PieArc(props) {
|
|
42
43
|
var id = props.id,
|
|
43
44
|
dataIndex = props.dataIndex,
|
|
44
45
|
innerClasses = props.classes,
|
|
@@ -83,4 +84,19 @@ export default function PieArc(props) {
|
|
|
83
84
|
seriesId: id,
|
|
84
85
|
dataIndex: dataIndex
|
|
85
86
|
})));
|
|
86
|
-
}
|
|
87
|
+
}
|
|
88
|
+
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
89
|
+
// ----------------------------- Warning --------------------------------
|
|
90
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
91
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
92
|
+
// ----------------------------------------------------------------------
|
|
93
|
+
classes: PropTypes.object,
|
|
94
|
+
dataIndex: PropTypes.number.isRequired,
|
|
95
|
+
highlightScope: PropTypes.shape({
|
|
96
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
97
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
98
|
+
}),
|
|
99
|
+
isFaded: PropTypes.bool.isRequired,
|
|
100
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
101
|
+
} : void 0;
|
|
102
|
+
export { PieArc };
|
|
@@ -3,9 +3,9 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
4
|
var _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
6
7
|
import { animated, to } from '@react-spring/web';
|
|
7
8
|
import { arc as d3Arc } from 'd3-shape';
|
|
8
|
-
import PropTypes from 'prop-types';
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
11
11
|
import { styled } from '@mui/material/styles';
|
|
@@ -64,7 +64,7 @@ var getLabelPosition = function getLabelPosition(formattedArcLabel, variable) {
|
|
|
64
64
|
return y;
|
|
65
65
|
};
|
|
66
66
|
};
|
|
67
|
-
|
|
67
|
+
function PieArcLabel(props) {
|
|
68
68
|
var id = props.id,
|
|
69
69
|
innerClasses = props.classes,
|
|
70
70
|
color = props.color,
|
|
@@ -103,12 +103,8 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
|
103
103
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
104
104
|
// ----------------------------------------------------------------------
|
|
105
105
|
classes: PropTypes.object,
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
}),
|
|
112
|
-
innerRadius: PropTypes.number,
|
|
113
|
-
outerRadius: PropTypes.number.isRequired
|
|
114
|
-
} : void 0;
|
|
106
|
+
formattedArcLabel: PropTypes.string,
|
|
107
|
+
isFaded: PropTypes.bool.isRequired,
|
|
108
|
+
isHighlighted: PropTypes.bool.isRequired
|
|
109
|
+
} : void 0;
|
|
110
|
+
export { PieArcLabel };
|
|
@@ -3,10 +3,11 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _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
|
var 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
|
var slots = props.slots,
|
|
29
30
|
slotProps = props.slotProps,
|
|
@@ -90,4 +91,92 @@ export function PieArcLabelPlot(props) {
|
|
|
90
91
|
}, slotProps == null ? void 0 : slotProps.pieArcLabel));
|
|
91
92
|
})
|
|
92
93
|
}));
|
|
93
|
-
}
|
|
94
|
+
}
|
|
95
|
+
process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
96
|
+
// ----------------------------- Warning --------------------------------
|
|
97
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
98
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
99
|
+
// ----------------------------------------------------------------------
|
|
100
|
+
/**
|
|
101
|
+
* The label displayed into the arc.
|
|
102
|
+
*/
|
|
103
|
+
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
104
|
+
/**
|
|
105
|
+
* The minimal angle required to display the arc label.
|
|
106
|
+
*/
|
|
107
|
+
arcLabelMinAngle: PropTypes.number,
|
|
108
|
+
/**
|
|
109
|
+
* The radius applied to arc corners (similar to border radius).
|
|
110
|
+
* @default 0
|
|
111
|
+
*/
|
|
112
|
+
cornerRadius: PropTypes.number,
|
|
113
|
+
data: PropTypes.arrayOf(PropTypes.shape({
|
|
114
|
+
color: PropTypes.string.isRequired,
|
|
115
|
+
endAngle: PropTypes.number.isRequired,
|
|
116
|
+
formattedValue: PropTypes.string.isRequired,
|
|
117
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
118
|
+
index: PropTypes.number.isRequired,
|
|
119
|
+
label: PropTypes.string,
|
|
120
|
+
padAngle: PropTypes.number.isRequired,
|
|
121
|
+
startAngle: PropTypes.number.isRequired,
|
|
122
|
+
value: PropTypes.number.isRequired
|
|
123
|
+
})).isRequired,
|
|
124
|
+
/**
|
|
125
|
+
* Override the arc attibutes when it is faded.
|
|
126
|
+
*/
|
|
127
|
+
faded: PropTypes.shape({
|
|
128
|
+
additionalRadius: PropTypes.number,
|
|
129
|
+
color: PropTypes.string,
|
|
130
|
+
cornerRadius: PropTypes.number,
|
|
131
|
+
innerRadius: PropTypes.number,
|
|
132
|
+
outerRadius: PropTypes.number,
|
|
133
|
+
paddingAngle: PropTypes.number
|
|
134
|
+
}),
|
|
135
|
+
/**
|
|
136
|
+
* Override the arc attibutes when it is highlighted.
|
|
137
|
+
*/
|
|
138
|
+
highlighted: PropTypes.shape({
|
|
139
|
+
additionalRadius: PropTypes.number,
|
|
140
|
+
color: PropTypes.string,
|
|
141
|
+
cornerRadius: PropTypes.number,
|
|
142
|
+
innerRadius: PropTypes.number,
|
|
143
|
+
outerRadius: PropTypes.number,
|
|
144
|
+
paddingAngle: PropTypes.number
|
|
145
|
+
}),
|
|
146
|
+
highlightScope: PropTypes.shape({
|
|
147
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
148
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
149
|
+
}),
|
|
150
|
+
id: PropTypes.string.isRequired,
|
|
151
|
+
/**
|
|
152
|
+
* The radius between circle center and the begining of the arc.
|
|
153
|
+
* @default 0
|
|
154
|
+
*/
|
|
155
|
+
innerRadius: PropTypes.number,
|
|
156
|
+
/**
|
|
157
|
+
* The radius between circle center and the end of the arc.
|
|
158
|
+
* @default R_max The maximal radius that fit into the drawing area.
|
|
159
|
+
*/
|
|
160
|
+
outerRadius: PropTypes.number.isRequired,
|
|
161
|
+
/**
|
|
162
|
+
* The padding angle (deg) between two arcs.
|
|
163
|
+
* @default 0
|
|
164
|
+
*/
|
|
165
|
+
paddingAngle: PropTypes.number,
|
|
166
|
+
/**
|
|
167
|
+
* If `true`, animations are skiped.
|
|
168
|
+
* @default false
|
|
169
|
+
*/
|
|
170
|
+
skipAnimation: PropTypes.bool,
|
|
171
|
+
/**
|
|
172
|
+
* The props used for each component slot.
|
|
173
|
+
* @default {}
|
|
174
|
+
*/
|
|
175
|
+
slotProps: PropTypes.object,
|
|
176
|
+
/**
|
|
177
|
+
* Overridable component slots.
|
|
178
|
+
* @default {}
|
|
179
|
+
*/
|
|
180
|
+
slots: PropTypes.object
|
|
181
|
+
} : void 0;
|
|
182
|
+
export { PieArcLabelPlot };
|
|
@@ -3,12 +3,13 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _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
|
var slots = props.slots,
|
|
14
15
|
slotProps = props.slotProps,
|
|
@@ -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 };
|