@mui/x-charts 6.0.0-alpha.6 → 6.0.0-alpha.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +18 -2
- package/BarChart/BarChart.js +60 -11
- package/BarChart/BarElement.d.ts +22 -0
- package/BarChart/BarElement.js +21 -10
- package/BarChart/BarPlot.d.ts +14 -1
- package/BarChart/BarPlot.js +23 -4
- package/CHANGELOG.md +62 -0
- package/ChartsAxis/ChartsAxis.d.ts +11 -1
- package/ChartsAxis/ChartsAxis.js +51 -6
- package/ChartsLegend/ChartsLegend.d.ts +25 -2
- package/ChartsLegend/ChartsLegend.js +49 -17
- package/ChartsTooltip/ChartsTooltipTable.d.ts +2 -9
- package/ChartsXAxis/ChartsXAxis.js +44 -9
- package/ChartsYAxis/ChartsYAxis.js +44 -9
- package/LineChart/AreaElement.d.ts +22 -0
- package/LineChart/AreaElement.js +31 -11
- package/LineChart/AreaPlot.d.ts +14 -1
- package/LineChart/AreaPlot.js +29 -3
- package/LineChart/LineChart.d.ts +20 -2
- package/LineChart/LineChart.js +62 -10
- package/LineChart/LineElement.d.ts +22 -0
- package/LineChart/LineElement.js +31 -10
- package/LineChart/LinePlot.d.ts +14 -1
- package/LineChart/LinePlot.js +35 -4
- package/LineChart/MarkPlot.d.ts +24 -1
- package/LineChart/MarkPlot.js +25 -3
- package/PieChart/PieArcLabel.js +0 -1
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +51 -9
- package/PieChart/PiePlot.d.ts +27 -1
- package/PieChart/PiePlot.js +29 -6
- package/ScatterChart/ScatterChart.d.ts +18 -2
- package/ScatterChart/ScatterChart.js +55 -9
- package/ScatterChart/ScatterPlot.d.ts +24 -1
- package/ScatterChart/ScatterPlot.js +28 -4
- package/SparkLineChart/SparkLineChart.d.ts +18 -0
- package/SparkLineChart/SparkLineChart.js +28 -5
- package/colorPalettes/colorPalettes.js +2 -2
- package/context/CartesianContextProvider.js +14 -8
- package/esm/BarChart/BarChart.js +60 -11
- package/esm/BarChart/BarElement.js +21 -11
- package/esm/BarChart/BarPlot.js +23 -4
- package/esm/ChartsAxis/ChartsAxis.js +51 -6
- package/esm/ChartsLegend/ChartsLegend.js +47 -14
- package/esm/ChartsXAxis/ChartsXAxis.js +45 -9
- package/esm/ChartsYAxis/ChartsYAxis.js +45 -9
- package/esm/LineChart/AreaElement.js +31 -11
- package/esm/LineChart/AreaPlot.js +31 -4
- package/esm/LineChart/LineChart.js +62 -10
- package/esm/LineChart/LineElement.js +31 -11
- package/esm/LineChart/LinePlot.js +43 -8
- package/esm/LineChart/MarkPlot.js +28 -4
- package/esm/PieChart/PieArcLabel.js +0 -1
- package/esm/PieChart/PieChart.js +51 -9
- package/esm/PieChart/PiePlot.js +31 -6
- package/esm/ScatterChart/ScatterChart.js +55 -9
- package/esm/ScatterChart/ScatterPlot.js +29 -4
- package/esm/SparkLineChart/SparkLineChart.js +28 -5
- package/esm/colorPalettes/colorPalettes.js +2 -2
- package/esm/context/CartesianContextProvider.js +14 -8
- package/esm/hooks/useTicks.js +9 -6
- package/esm/internals/components/AxisSharedComponents.js +10 -10
- package/hooks/useTicks.d.ts +20 -5
- package/hooks/useTicks.js +9 -6
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +4 -4
- package/internals/components/AxisSharedComponents.js +15 -15
- package/legacy/BarChart/BarChart.js +60 -11
- package/legacy/BarChart/BarElement.js +20 -10
- package/legacy/BarChart/BarPlot.js +23 -4
- package/legacy/ChartsAxis/ChartsAxis.js +51 -6
- package/legacy/ChartsLegend/ChartsLegend.js +46 -15
- package/legacy/ChartsXAxis/ChartsXAxis.js +45 -9
- package/legacy/ChartsYAxis/ChartsYAxis.js +45 -9
- package/legacy/LineChart/AreaElement.js +30 -10
- package/legacy/LineChart/AreaPlot.js +29 -4
- package/legacy/LineChart/LineChart.js +62 -10
- package/legacy/LineChart/LineElement.js +30 -10
- package/legacy/LineChart/LinePlot.js +36 -5
- package/legacy/LineChart/MarkPlot.js +26 -4
- package/legacy/PieChart/PieArcLabel.js +0 -1
- package/legacy/PieChart/PieChart.js +51 -9
- package/legacy/PieChart/PiePlot.js +29 -6
- package/legacy/ScatterChart/ScatterChart.js +55 -9
- package/legacy/ScatterChart/ScatterPlot.js +27 -4
- package/legacy/SparkLineChart/SparkLineChart.js +28 -5
- package/legacy/colorPalettes/colorPalettes.js +2 -2
- package/legacy/context/CartesianContextProvider.js +14 -8
- package/legacy/hooks/useTicks.js +9 -9
- package/legacy/index.js +1 -1
- package/legacy/internals/components/AxisSharedComponents.js +10 -10
- package/models/axis.d.ts +24 -1
- package/modern/BarChart/BarChart.js +60 -11
- package/modern/BarChart/BarElement.js +20 -11
- package/modern/BarChart/BarPlot.js +23 -4
- package/modern/ChartsAxis/ChartsAxis.js +51 -6
- package/modern/ChartsLegend/ChartsLegend.js +46 -14
- package/modern/ChartsXAxis/ChartsXAxis.js +44 -9
- package/modern/ChartsYAxis/ChartsYAxis.js +44 -9
- package/modern/LineChart/AreaElement.js +30 -11
- package/modern/LineChart/AreaPlot.js +31 -4
- package/modern/LineChart/LineChart.js +62 -10
- package/modern/LineChart/LineElement.js +30 -11
- package/modern/LineChart/LinePlot.js +37 -5
- package/modern/LineChart/MarkPlot.js +27 -4
- package/modern/PieChart/PieArcLabel.js +0 -1
- package/modern/PieChart/PieChart.js +51 -9
- package/modern/PieChart/PiePlot.js +30 -6
- package/modern/ScatterChart/ScatterChart.js +55 -9
- package/modern/ScatterChart/ScatterPlot.js +28 -4
- package/modern/SparkLineChart/SparkLineChart.js +28 -5
- package/modern/colorPalettes/colorPalettes.js +2 -2
- package/modern/context/CartesianContextProvider.js +14 -8
- package/modern/hooks/useTicks.js +9 -6
- package/modern/index.js +1 -1
- package/modern/internals/components/AxisSharedComponents.js +10 -10
- package/package.json +2 -2
- package/themeAugmentation/components.d.ts +0 -10
- package/themeAugmentation/overrides.d.ts +0 -2
|
@@ -9,7 +9,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
9
9
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
10
10
|
import useTicks from '../hooks/useTicks';
|
|
11
11
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
12
|
-
import {
|
|
12
|
+
import { ChartsLine, ChartsTick, ChartsTickLabel, ChartsLabel, AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
15
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -34,6 +34,7 @@ var defaultProps = {
|
|
|
34
34
|
tickSize: 6
|
|
35
35
|
};
|
|
36
36
|
function ChartsXAxis(inProps) {
|
|
37
|
+
var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
|
|
37
38
|
var props = useThemeProps({
|
|
38
39
|
props: _extends({}, defaultProps, inProps),
|
|
39
40
|
name: 'MuiChartsXAxis'
|
|
@@ -51,7 +52,9 @@ function ChartsXAxis(inProps) {
|
|
|
51
52
|
label = defaultizedProps.label,
|
|
52
53
|
labelFontSize = defaultizedProps.labelFontSize,
|
|
53
54
|
tickSizeProp = defaultizedProps.tickSize,
|
|
54
|
-
valueFormatter = defaultizedProps.valueFormatter
|
|
55
|
+
valueFormatter = defaultizedProps.valueFormatter,
|
|
56
|
+
slots = defaultizedProps.slots,
|
|
57
|
+
slotProps = defaultizedProps.slotProps;
|
|
55
58
|
var theme = useTheme();
|
|
56
59
|
var classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
57
60
|
theme: theme
|
|
@@ -72,14 +75,18 @@ function ChartsXAxis(inProps) {
|
|
|
72
75
|
x: left + width / 2,
|
|
73
76
|
y: positionSigne * (tickFontSize + tickSize + 10)
|
|
74
77
|
};
|
|
78
|
+
var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
|
|
79
|
+
var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
|
|
80
|
+
var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
|
|
81
|
+
var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
|
|
75
82
|
return /*#__PURE__*/_jsxs(AxisRoot, {
|
|
76
83
|
transform: "translate(0, ".concat(position === 'bottom' ? top + height : top, ")"),
|
|
77
84
|
className: classes.root,
|
|
78
|
-
children: [!disableLine && /*#__PURE__*/_jsx(Line, {
|
|
85
|
+
children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
|
|
79
86
|
x1: xScale.range()[0],
|
|
80
87
|
x2: xScale.range()[1],
|
|
81
88
|
className: classes.line
|
|
82
|
-
}), xTicks.map(function (_ref, index) {
|
|
89
|
+
}, slotProps == null ? void 0 : slotProps.axisLine)), xTicks.map(function (_ref, index) {
|
|
83
90
|
var formattedValue = _ref.formattedValue,
|
|
84
91
|
offset = _ref.offset,
|
|
85
92
|
labelOffset = _ref.labelOffset;
|
|
@@ -88,26 +95,28 @@ function ChartsXAxis(inProps) {
|
|
|
88
95
|
return /*#__PURE__*/_jsxs("g", {
|
|
89
96
|
transform: "translate(".concat(offset, ", 0)"),
|
|
90
97
|
className: classes.tickContainer,
|
|
91
|
-
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
|
|
98
|
+
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
92
99
|
y2: positionSigne * tickSize,
|
|
93
100
|
className: classes.tick
|
|
94
|
-
}), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
|
|
101
|
+
}, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
95
102
|
x: xTickLabel,
|
|
96
103
|
y: yTickLabel,
|
|
97
104
|
"transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
|
|
98
105
|
sx: {
|
|
99
106
|
fontSize: tickFontSize
|
|
100
107
|
},
|
|
101
|
-
className: classes.tickLabel
|
|
108
|
+
className: classes.tickLabel
|
|
109
|
+
}, slotProps == null ? void 0 : slotProps.axisTickLabel, {
|
|
102
110
|
children: formattedValue
|
|
103
|
-
})]
|
|
111
|
+
}))]
|
|
104
112
|
}, index);
|
|
105
113
|
}), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
|
|
106
114
|
sx: {
|
|
107
115
|
fontSize: labelFontSize,
|
|
108
116
|
transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
|
|
109
117
|
},
|
|
110
|
-
className: classes.label
|
|
118
|
+
className: classes.label
|
|
119
|
+
}, slotProps == null ? void 0 : slotProps.axisLabel, {
|
|
111
120
|
children: label
|
|
112
121
|
}))]
|
|
113
122
|
});
|
|
@@ -153,6 +162,16 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
153
162
|
* Position of the axis.
|
|
154
163
|
*/
|
|
155
164
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
165
|
+
/**
|
|
166
|
+
* The props used for each component slot.
|
|
167
|
+
* @default {}
|
|
168
|
+
*/
|
|
169
|
+
slotProps: PropTypes.object,
|
|
170
|
+
/**
|
|
171
|
+
* Overridable component slots.
|
|
172
|
+
* @default {}
|
|
173
|
+
*/
|
|
174
|
+
slots: PropTypes.object,
|
|
156
175
|
/**
|
|
157
176
|
* The stroke color of the axis line.
|
|
158
177
|
* @default 'currentColor'
|
|
@@ -163,6 +182,23 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
163
182
|
* @default 12
|
|
164
183
|
*/
|
|
165
184
|
tickFontSize: PropTypes.number,
|
|
185
|
+
/**
|
|
186
|
+
* Maximal step between two ticks.
|
|
187
|
+
* When using time data, the value is assumed to be in ms.
|
|
188
|
+
* Not supported by categorical axis (band, points).
|
|
189
|
+
*/
|
|
190
|
+
tickMaxStep: PropTypes.number,
|
|
191
|
+
/**
|
|
192
|
+
* Maximal step between two ticks.
|
|
193
|
+
* When using time data, the value is assumed to be in ms.
|
|
194
|
+
* Not supported by categorical axis (band, points).
|
|
195
|
+
*/
|
|
196
|
+
tickMinStep: PropTypes.number,
|
|
197
|
+
/**
|
|
198
|
+
* The number of ticks. This number is not guaranted.
|
|
199
|
+
* Not supported by categorical axis (band, points).
|
|
200
|
+
*/
|
|
201
|
+
tickNumber: PropTypes.number,
|
|
166
202
|
/**
|
|
167
203
|
* The size of the ticks.
|
|
168
204
|
* @default 6
|
|
@@ -8,7 +8,7 @@ import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
|
8
8
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
9
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
10
10
|
import useTicks from '../hooks/useTicks';
|
|
11
|
-
import {
|
|
11
|
+
import { ChartsLine, ChartsTick, ChartsTickLabel, ChartsLabel, AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
12
12
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -34,6 +34,7 @@ var defaultProps = {
|
|
|
34
34
|
tickSize: 6
|
|
35
35
|
};
|
|
36
36
|
function ChartsYAxis(inProps) {
|
|
37
|
+
var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
|
|
37
38
|
var props = useThemeProps({
|
|
38
39
|
props: _extends({}, defaultProps, inProps),
|
|
39
40
|
name: 'MuiChartsYAxis'
|
|
@@ -51,7 +52,9 @@ function ChartsYAxis(inProps) {
|
|
|
51
52
|
label = defaultizedProps.label,
|
|
52
53
|
labelFontSize = defaultizedProps.labelFontSize,
|
|
53
54
|
tickSizeProp = defaultizedProps.tickSize,
|
|
54
|
-
valueFormatter = defaultizedProps.valueFormatter
|
|
55
|
+
valueFormatter = defaultizedProps.valueFormatter,
|
|
56
|
+
slots = defaultizedProps.slots,
|
|
57
|
+
slotProps = defaultizedProps.slotProps;
|
|
55
58
|
var theme = useTheme();
|
|
56
59
|
var classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
57
60
|
theme: theme
|
|
@@ -72,14 +75,18 @@ function ChartsYAxis(inProps) {
|
|
|
72
75
|
x: positionSigne * (tickFontSize + tickSize + 10),
|
|
73
76
|
y: top + height / 2
|
|
74
77
|
};
|
|
78
|
+
var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : ChartsLine;
|
|
79
|
+
var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : ChartsTick;
|
|
80
|
+
var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsTickLabel;
|
|
81
|
+
var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsLabel;
|
|
75
82
|
return /*#__PURE__*/_jsxs(AxisRoot, {
|
|
76
83
|
transform: "translate(".concat(position === 'right' ? left + width : left, ", 0)"),
|
|
77
84
|
className: classes.root,
|
|
78
|
-
children: [!disableLine && /*#__PURE__*/_jsx(Line, {
|
|
85
|
+
children: [!disableLine && /*#__PURE__*/_jsx(Line, _extends({
|
|
79
86
|
y1: yScale.range()[0],
|
|
80
87
|
y2: yScale.range()[1],
|
|
81
88
|
className: classes.line
|
|
82
|
-
}), yTicks.map(function (_ref, index) {
|
|
89
|
+
}, slotProps == null ? void 0 : slotProps.axisLine)), yTicks.map(function (_ref, index) {
|
|
83
90
|
var formattedValue = _ref.formattedValue,
|
|
84
91
|
offset = _ref.offset,
|
|
85
92
|
labelOffset = _ref.labelOffset;
|
|
@@ -88,19 +95,20 @@ function ChartsYAxis(inProps) {
|
|
|
88
95
|
return /*#__PURE__*/_jsxs("g", {
|
|
89
96
|
transform: "translate(0, ".concat(offset, ")"),
|
|
90
97
|
className: classes.tickContainer,
|
|
91
|
-
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, {
|
|
98
|
+
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
92
99
|
x2: positionSigne * tickSize,
|
|
93
100
|
className: classes.tick
|
|
94
|
-
}), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, {
|
|
101
|
+
}, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
95
102
|
x: xTickLabel,
|
|
96
103
|
y: yTickLabel,
|
|
97
104
|
"transform-origin": "".concat(xTickLabel, "px ").concat(yTickLabel, "px"),
|
|
98
105
|
sx: {
|
|
99
106
|
fontSize: tickFontSize
|
|
100
107
|
},
|
|
101
|
-
className: classes.tickLabel
|
|
108
|
+
className: classes.tickLabel
|
|
109
|
+
}, slotProps == null ? void 0 : slotProps.axisTickLabel, {
|
|
102
110
|
children: formattedValue.toLocaleString()
|
|
103
|
-
})]
|
|
111
|
+
}))]
|
|
104
112
|
}, index);
|
|
105
113
|
}), label && /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, {
|
|
106
114
|
sx: {
|
|
@@ -108,7 +116,8 @@ function ChartsYAxis(inProps) {
|
|
|
108
116
|
transform: "rotate(".concat(positionSigne * 90, "deg)"),
|
|
109
117
|
transformOrigin: "".concat(labelRefPoint.x, "px ").concat(labelRefPoint.y, "px")
|
|
110
118
|
},
|
|
111
|
-
className: classes.label
|
|
119
|
+
className: classes.label
|
|
120
|
+
}, slotProps == null ? void 0 : slotProps.axisLabel, {
|
|
112
121
|
children: label
|
|
113
122
|
}))]
|
|
114
123
|
});
|
|
@@ -154,6 +163,16 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
154
163
|
* Position of the axis.
|
|
155
164
|
*/
|
|
156
165
|
position: PropTypes.oneOf(['left', 'right']),
|
|
166
|
+
/**
|
|
167
|
+
* The props used for each component slot.
|
|
168
|
+
* @default {}
|
|
169
|
+
*/
|
|
170
|
+
slotProps: PropTypes.object,
|
|
171
|
+
/**
|
|
172
|
+
* Overridable component slots.
|
|
173
|
+
* @default {}
|
|
174
|
+
*/
|
|
175
|
+
slots: PropTypes.object,
|
|
157
176
|
/**
|
|
158
177
|
* The stroke color of the axis line.
|
|
159
178
|
* @default 'currentColor'
|
|
@@ -164,6 +183,23 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
164
183
|
* @default 12
|
|
165
184
|
*/
|
|
166
185
|
tickFontSize: PropTypes.number,
|
|
186
|
+
/**
|
|
187
|
+
* Maximal step between two ticks.
|
|
188
|
+
* When using time data, the value is assumed to be in ms.
|
|
189
|
+
* Not supported by categorical axis (band, points).
|
|
190
|
+
*/
|
|
191
|
+
tickMaxStep: PropTypes.number,
|
|
192
|
+
/**
|
|
193
|
+
* Maximal step between two ticks.
|
|
194
|
+
* When using time data, the value is assumed to be in ms.
|
|
195
|
+
* Not supported by categorical axis (band, points).
|
|
196
|
+
*/
|
|
197
|
+
tickMinStep: PropTypes.number,
|
|
198
|
+
/**
|
|
199
|
+
* The number of ticks. This number is not guaranted.
|
|
200
|
+
* Not supported by categorical axis (band, points).
|
|
201
|
+
*/
|
|
202
|
+
tickNumber: PropTypes.number,
|
|
167
203
|
/**
|
|
168
204
|
* The size of the ticks.
|
|
169
205
|
* @default 6
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["id", "classes", "color", "highlightScope"];
|
|
3
|
+
var _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
7
8
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
8
9
|
import { styled } from '@mui/material/styles';
|
|
9
10
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
@@ -25,7 +26,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
25
26
|
};
|
|
26
27
|
return composeClasses(slots, getAreaElementUtilityClass, classes);
|
|
27
28
|
};
|
|
28
|
-
var AreaElementPath = styled('path', {
|
|
29
|
+
export var AreaElementPath = styled('path', {
|
|
29
30
|
name: 'MuiAreaElement',
|
|
30
31
|
slot: 'Root',
|
|
31
32
|
overridesResolver: function overridesResolver(_, styles) {
|
|
@@ -56,10 +57,13 @@ AreaElementPath.propTypes = {
|
|
|
56
57
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
57
58
|
};
|
|
58
59
|
function AreaElement(props) {
|
|
60
|
+
var _slots$area;
|
|
59
61
|
var id = props.id,
|
|
60
62
|
innerClasses = props.classes,
|
|
61
63
|
color = props.color,
|
|
62
64
|
highlightScope = props.highlightScope,
|
|
65
|
+
slots = props.slots,
|
|
66
|
+
slotProps = props.slotProps,
|
|
63
67
|
other = _objectWithoutProperties(props, _excluded);
|
|
64
68
|
var getInteractionItemProps = useInteractionItemProps(highlightScope);
|
|
65
69
|
var _React$useContext = React.useContext(InteractionContext),
|
|
@@ -80,13 +84,19 @@ function AreaElement(props) {
|
|
|
80
84
|
isHighlighted: isHighlighted
|
|
81
85
|
};
|
|
82
86
|
var classes = useUtilityClasses(ownerState);
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
87
|
+
var Area = (_slots$area = slots == null ? void 0 : slots.area) != null ? _slots$area : AreaElementPath;
|
|
88
|
+
var areaProps = useSlotProps({
|
|
89
|
+
elementType: Area,
|
|
90
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.area,
|
|
91
|
+
additionalProps: _extends({}, other, getInteractionItemProps({
|
|
92
|
+
type: 'line',
|
|
93
|
+
seriesId: id
|
|
94
|
+
}), {
|
|
95
|
+
className: classes.root
|
|
96
|
+
}),
|
|
97
|
+
ownerState: ownerState
|
|
98
|
+
});
|
|
99
|
+
return /*#__PURE__*/_jsx(Area, _extends({}, areaProps));
|
|
90
100
|
}
|
|
91
101
|
process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
|
|
92
102
|
// ----------------------------- Warning --------------------------------
|
|
@@ -97,6 +107,16 @@ process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
|
|
|
97
107
|
highlightScope: PropTypes.shape({
|
|
98
108
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
99
109
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
100
|
-
})
|
|
110
|
+
}),
|
|
111
|
+
/**
|
|
112
|
+
* The props used for each component slot.
|
|
113
|
+
* @default {}
|
|
114
|
+
*/
|
|
115
|
+
slotProps: PropTypes.object,
|
|
116
|
+
/**
|
|
117
|
+
* Overridable component slots.
|
|
118
|
+
* @default {}
|
|
119
|
+
*/
|
|
120
|
+
slots: PropTypes.object
|
|
101
121
|
} : void 0;
|
|
102
122
|
export { AreaElement };
|
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
+
var _excluded = ["slots", "slotProps"];
|
|
2
4
|
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
3
6
|
import { area as d3Area } from 'd3-shape';
|
|
4
7
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
5
8
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
@@ -7,7 +10,10 @@ import { AreaElement } from './AreaElement';
|
|
|
7
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
8
11
|
import getCurveFactory from '../internals/getCurve';
|
|
9
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
-
|
|
13
|
+
function AreaPlot(props) {
|
|
14
|
+
var slots = props.slots,
|
|
15
|
+
slotProps = props.slotProps,
|
|
16
|
+
other = _objectWithoutProperties(props, _excluded);
|
|
11
17
|
var seriesData = React.useContext(SeriesContext).line;
|
|
12
18
|
var axisData = React.useContext(CartesianContext);
|
|
13
19
|
if (seriesData === undefined) {
|
|
@@ -21,7 +27,7 @@ export function AreaPlot(props) {
|
|
|
21
27
|
yAxisIds = axisData.yAxisIds;
|
|
22
28
|
var defaultXAxisId = xAxisIds[0];
|
|
23
29
|
var defaultYAxisId = yAxisIds[0];
|
|
24
|
-
return /*#__PURE__*/_jsx("g", _extends({},
|
|
30
|
+
return /*#__PURE__*/_jsx("g", _extends({}, other, {
|
|
25
31
|
children: stackingGroups.flatMap(function (_ref) {
|
|
26
32
|
var groupIds = _ref.ids;
|
|
27
33
|
return groupIds.flatMap(function (seriesId) {
|
|
@@ -55,9 +61,28 @@ export function AreaPlot(props) {
|
|
|
55
61
|
id: seriesId,
|
|
56
62
|
d: areaPath.curve(curve)(d3Data) || undefined,
|
|
57
63
|
color: series[seriesId].color,
|
|
58
|
-
highlightScope: series[seriesId].highlightScope
|
|
64
|
+
highlightScope: series[seriesId].highlightScope,
|
|
65
|
+
slots: slots,
|
|
66
|
+
slotProps: slotProps
|
|
59
67
|
}, seriesId);
|
|
60
68
|
});
|
|
61
69
|
})
|
|
62
70
|
}));
|
|
63
|
-
}
|
|
71
|
+
}
|
|
72
|
+
process.env.NODE_ENV !== "production" ? AreaPlot.propTypes = {
|
|
73
|
+
// ----------------------------- Warning --------------------------------
|
|
74
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
75
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
76
|
+
// ----------------------------------------------------------------------
|
|
77
|
+
/**
|
|
78
|
+
* The props used for each component slot.
|
|
79
|
+
* @default {}
|
|
80
|
+
*/
|
|
81
|
+
slotProps: PropTypes.object,
|
|
82
|
+
/**
|
|
83
|
+
* Overridable component slots.
|
|
84
|
+
* @default {}
|
|
85
|
+
*/
|
|
86
|
+
slots: PropTypes.object
|
|
87
|
+
} : void 0;
|
|
88
|
+
export { AreaPlot };
|
|
@@ -35,7 +35,9 @@ var LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
35
35
|
leftAxis = props.leftAxis,
|
|
36
36
|
rightAxis = props.rightAxis,
|
|
37
37
|
bottomAxis = props.bottomAxis,
|
|
38
|
-
children = props.children
|
|
38
|
+
children = props.children,
|
|
39
|
+
slots = props.slots,
|
|
40
|
+
slotProps = props.slotProps;
|
|
39
41
|
var id = useId();
|
|
40
42
|
var clipPathId = "".concat(id, "-clip-path");
|
|
41
43
|
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
@@ -67,13 +69,27 @@ var LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
67
69
|
disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
|
|
68
70
|
children: [/*#__PURE__*/_jsxs("g", {
|
|
69
71
|
clipPath: "url(#".concat(clipPathId, ")"),
|
|
70
|
-
children: [/*#__PURE__*/_jsx(AreaPlot, {
|
|
72
|
+
children: [/*#__PURE__*/_jsx(AreaPlot, {
|
|
73
|
+
slots: slots,
|
|
74
|
+
slotProps: slotProps
|
|
75
|
+
}), /*#__PURE__*/_jsx(LinePlot, {
|
|
76
|
+
slots: slots,
|
|
77
|
+
slotProps: slotProps
|
|
78
|
+
})]
|
|
71
79
|
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
72
80
|
topAxis: topAxis,
|
|
73
81
|
leftAxis: leftAxis,
|
|
74
82
|
rightAxis: rightAxis,
|
|
75
|
-
bottomAxis: bottomAxis
|
|
76
|
-
|
|
83
|
+
bottomAxis: bottomAxis,
|
|
84
|
+
slots: slots,
|
|
85
|
+
slotProps: slotProps
|
|
86
|
+
}), /*#__PURE__*/_jsx(MarkPlot, {
|
|
87
|
+
slots: slots,
|
|
88
|
+
slotProps: slotProps
|
|
89
|
+
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
90
|
+
slots: slots,
|
|
91
|
+
slotProps: slotProps
|
|
92
|
+
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
77
93
|
id: clipPathId
|
|
78
94
|
}), children]
|
|
79
95
|
});
|
|
@@ -101,8 +117,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
101
117
|
label: PropTypes.string,
|
|
102
118
|
labelFontSize: PropTypes.number,
|
|
103
119
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
120
|
+
slotProps: PropTypes.object,
|
|
121
|
+
slots: PropTypes.object,
|
|
104
122
|
stroke: PropTypes.string,
|
|
105
123
|
tickFontSize: PropTypes.number,
|
|
124
|
+
tickMaxStep: PropTypes.number,
|
|
125
|
+
tickMinStep: PropTypes.number,
|
|
126
|
+
tickNumber: PropTypes.number,
|
|
106
127
|
tickSize: PropTypes.number
|
|
107
128
|
}), PropTypes.string]),
|
|
108
129
|
children: PropTypes.node,
|
|
@@ -129,8 +150,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
129
150
|
label: PropTypes.string,
|
|
130
151
|
labelFontSize: PropTypes.number,
|
|
131
152
|
position: PropTypes.oneOf(['left', 'right']),
|
|
153
|
+
slotProps: PropTypes.object,
|
|
154
|
+
slots: PropTypes.object,
|
|
132
155
|
stroke: PropTypes.string,
|
|
133
156
|
tickFontSize: PropTypes.number,
|
|
157
|
+
tickMaxStep: PropTypes.number,
|
|
158
|
+
tickMinStep: PropTypes.number,
|
|
159
|
+
tickNumber: PropTypes.number,
|
|
134
160
|
tickSize: PropTypes.number
|
|
135
161
|
}), PropTypes.string]),
|
|
136
162
|
legend: PropTypes.shape({
|
|
@@ -147,6 +173,8 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
147
173
|
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
148
174
|
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
149
175
|
}),
|
|
176
|
+
slotProps: PropTypes.object,
|
|
177
|
+
slots: PropTypes.object,
|
|
150
178
|
spacing: PropTypes.number
|
|
151
179
|
}),
|
|
152
180
|
margin: PropTypes.shape({
|
|
@@ -169,8 +197,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
169
197
|
label: PropTypes.string,
|
|
170
198
|
labelFontSize: PropTypes.number,
|
|
171
199
|
position: PropTypes.oneOf(['left', 'right']),
|
|
200
|
+
slotProps: PropTypes.object,
|
|
201
|
+
slots: PropTypes.object,
|
|
172
202
|
stroke: PropTypes.string,
|
|
173
203
|
tickFontSize: PropTypes.number,
|
|
204
|
+
tickMaxStep: PropTypes.number,
|
|
205
|
+
tickMinStep: PropTypes.number,
|
|
206
|
+
tickNumber: PropTypes.number,
|
|
174
207
|
tickSize: PropTypes.number
|
|
175
208
|
}), PropTypes.string]),
|
|
176
209
|
series: PropTypes.arrayOf(PropTypes.shape({
|
|
@@ -193,6 +226,16 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
193
226
|
xAxisKey: PropTypes.string,
|
|
194
227
|
yAxisKey: PropTypes.string
|
|
195
228
|
})).isRequired,
|
|
229
|
+
/**
|
|
230
|
+
* The props used for each component slot.
|
|
231
|
+
* @default {}
|
|
232
|
+
*/
|
|
233
|
+
slotProps: PropTypes.object,
|
|
234
|
+
/**
|
|
235
|
+
* Overridable component slots.
|
|
236
|
+
* @default {}
|
|
237
|
+
*/
|
|
238
|
+
slots: PropTypes.object,
|
|
196
239
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
197
240
|
title: PropTypes.string,
|
|
198
241
|
tooltip: PropTypes.shape({
|
|
@@ -215,8 +258,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
215
258
|
label: PropTypes.string,
|
|
216
259
|
labelFontSize: PropTypes.number,
|
|
217
260
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
261
|
+
slotProps: PropTypes.object,
|
|
262
|
+
slots: PropTypes.object,
|
|
218
263
|
stroke: PropTypes.string,
|
|
219
264
|
tickFontSize: PropTypes.number,
|
|
265
|
+
tickMaxStep: PropTypes.number,
|
|
266
|
+
tickMinStep: PropTypes.number,
|
|
267
|
+
tickNumber: PropTypes.number,
|
|
220
268
|
tickSize: PropTypes.number
|
|
221
269
|
}), PropTypes.string]),
|
|
222
270
|
viewBox: PropTypes.shape({
|
|
@@ -239,15 +287,17 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
239
287
|
label: PropTypes.string,
|
|
240
288
|
labelFontSize: PropTypes.number,
|
|
241
289
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
242
|
-
maxTicks: PropTypes.number,
|
|
243
290
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
244
|
-
minTicks: PropTypes.number,
|
|
245
291
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
246
292
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
293
|
+
slotProps: PropTypes.object,
|
|
294
|
+
slots: PropTypes.object,
|
|
247
295
|
stroke: PropTypes.string,
|
|
248
296
|
tickFontSize: PropTypes.number,
|
|
297
|
+
tickMaxStep: PropTypes.number,
|
|
298
|
+
tickMinStep: PropTypes.number,
|
|
299
|
+
tickNumber: PropTypes.number,
|
|
249
300
|
tickSize: PropTypes.number,
|
|
250
|
-
tickSpacing: PropTypes.number,
|
|
251
301
|
valueFormatter: PropTypes.func
|
|
252
302
|
})),
|
|
253
303
|
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
@@ -263,15 +313,17 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
263
313
|
label: PropTypes.string,
|
|
264
314
|
labelFontSize: PropTypes.number,
|
|
265
315
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
266
|
-
maxTicks: PropTypes.number,
|
|
267
316
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
268
|
-
minTicks: PropTypes.number,
|
|
269
317
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
270
318
|
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
319
|
+
slotProps: PropTypes.object,
|
|
320
|
+
slots: PropTypes.object,
|
|
271
321
|
stroke: PropTypes.string,
|
|
272
322
|
tickFontSize: PropTypes.number,
|
|
323
|
+
tickMaxStep: PropTypes.number,
|
|
324
|
+
tickMinStep: PropTypes.number,
|
|
325
|
+
tickNumber: PropTypes.number,
|
|
273
326
|
tickSize: PropTypes.number,
|
|
274
|
-
tickSpacing: PropTypes.number,
|
|
275
327
|
valueFormatter: PropTypes.func
|
|
276
328
|
}))
|
|
277
329
|
} : void 0;
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["id", "classes", "color", "highlightScope"];
|
|
3
|
+
var _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { color as d3Color } from 'd3-color';
|
|
7
7
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
8
9
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
10
|
import { styled } from '@mui/material/styles';
|
|
10
11
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
@@ -25,7 +26,7 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
25
26
|
};
|
|
26
27
|
return composeClasses(slots, getLineElementUtilityClass, classes);
|
|
27
28
|
};
|
|
28
|
-
var LineElementPath = styled('path', {
|
|
29
|
+
export var LineElementPath = styled('path', {
|
|
29
30
|
name: 'MuiLineElement',
|
|
30
31
|
slot: 'Root',
|
|
31
32
|
overridesResolver: function overridesResolver(_, styles) {
|
|
@@ -58,10 +59,13 @@ LineElementPath.propTypes = {
|
|
|
58
59
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
59
60
|
};
|
|
60
61
|
function LineElement(props) {
|
|
62
|
+
var _slots$line;
|
|
61
63
|
var id = props.id,
|
|
62
64
|
innerClasses = props.classes,
|
|
63
65
|
color = props.color,
|
|
64
66
|
highlightScope = props.highlightScope,
|
|
67
|
+
slots = props.slots,
|
|
68
|
+
slotProps = props.slotProps,
|
|
65
69
|
other = _objectWithoutProperties(props, _excluded);
|
|
66
70
|
var getInteractionItemProps = useInteractionItemProps(highlightScope);
|
|
67
71
|
var _React$useContext = React.useContext(InteractionContext),
|
|
@@ -82,13 +86,19 @@ function LineElement(props) {
|
|
|
82
86
|
isHighlighted: isHighlighted
|
|
83
87
|
};
|
|
84
88
|
var classes = useUtilityClasses(ownerState);
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
89
|
+
var Line = (_slots$line = slots == null ? void 0 : slots.line) != null ? _slots$line : LineElementPath;
|
|
90
|
+
var lineProps = useSlotProps({
|
|
91
|
+
elementType: Line,
|
|
92
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.line,
|
|
93
|
+
additionalProps: _extends({}, other, getInteractionItemProps({
|
|
94
|
+
type: 'line',
|
|
95
|
+
seriesId: id
|
|
96
|
+
}), {
|
|
97
|
+
className: classes.root
|
|
98
|
+
}),
|
|
99
|
+
ownerState: ownerState
|
|
100
|
+
});
|
|
101
|
+
return /*#__PURE__*/_jsx(Line, _extends({}, lineProps));
|
|
92
102
|
}
|
|
93
103
|
process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
|
|
94
104
|
// ----------------------------- Warning --------------------------------
|
|
@@ -99,6 +109,16 @@ process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
|
|
|
99
109
|
highlightScope: PropTypes.shape({
|
|
100
110
|
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
101
111
|
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
102
|
-
})
|
|
112
|
+
}),
|
|
113
|
+
/**
|
|
114
|
+
* The props used for each component slot.
|
|
115
|
+
* @default {}
|
|
116
|
+
*/
|
|
117
|
+
slotProps: PropTypes.object,
|
|
118
|
+
/**
|
|
119
|
+
* Overridable component slots.
|
|
120
|
+
* @default {}
|
|
121
|
+
*/
|
|
122
|
+
slots: PropTypes.object
|
|
103
123
|
} : void 0;
|
|
104
124
|
export { LineElement };
|