@mui/x-charts 6.0.0-alpha.6 → 6.0.0-alpha.8
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 +19 -2
- package/BarChart/BarChart.js +84 -22
- package/BarChart/BarElement.d.ts +22 -0
- package/BarChart/BarElement.js +21 -10
- package/BarChart/BarPlot.d.ts +14 -1
- package/BarChart/BarPlot.js +48 -19
- package/BarChart/extremums.js +19 -3
- package/BarChart/formatter.js +3 -1
- package/CHANGELOG.md +213 -28
- package/ChartsAxis/ChartsAxis.d.ts +11 -1
- package/ChartsAxis/ChartsAxis.js +51 -6
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +3 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
- package/ChartsLegend/ChartsLegend.d.ts +25 -2
- package/ChartsLegend/ChartsLegend.js +49 -17
- package/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
- 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 +63 -11
- 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 +29 -4
- package/PieChart/PieArcLabel.js +0 -1
- package/PieChart/PieChart.d.ts +14 -2
- package/PieChart/PieChart.js +52 -10
- package/PieChart/PiePlot.d.ts +27 -1
- package/PieChart/PiePlot.js +29 -6
- package/ScatterChart/ScatterChart.d.ts +18 -2
- package/ScatterChart/ScatterChart.js +56 -10
- package/ScatterChart/ScatterPlot.d.ts +24 -1
- package/ScatterChart/ScatterPlot.js +28 -4
- package/SparkLineChart/SparkLineChart.d.ts +18 -0
- package/SparkLineChart/SparkLineChart.js +29 -6
- package/colorPalettes/colorPalettes.js +2 -2
- package/context/CartesianContextProvider.js +18 -12
- package/esm/BarChart/BarChart.js +88 -26
- package/esm/BarChart/BarElement.js +21 -11
- package/esm/BarChart/BarPlot.js +49 -20
- package/esm/BarChart/extremums.js +18 -2
- package/esm/BarChart/formatter.js +3 -1
- package/esm/ChartsAxis/ChartsAxis.js +51 -6
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
- package/esm/ChartsLegend/ChartsLegend.js +47 -14
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
- 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 +63 -11
- package/esm/LineChart/LineElement.js +31 -11
- package/esm/LineChart/LinePlot.js +43 -8
- package/esm/LineChart/MarkPlot.js +32 -5
- package/esm/PieChart/PieArcLabel.js +0 -1
- package/esm/PieChart/PieChart.js +52 -10
- package/esm/PieChart/PiePlot.js +31 -6
- package/esm/ScatterChart/ScatterChart.js +56 -10
- package/esm/ScatterChart/ScatterPlot.js +29 -4
- package/esm/SparkLineChart/SparkLineChart.js +29 -6
- package/esm/colorPalettes/colorPalettes.js +2 -2
- package/esm/context/CartesianContextProvider.js +18 -12
- package/esm/hooks/useAxisEvents.js +21 -38
- package/esm/hooks/useTicks.js +11 -8
- package/esm/internals/components/AxisSharedComponents.js +10 -10
- package/hooks/useAxisEvents.js +21 -38
- package/hooks/useTicks.d.ts +20 -5
- package/hooks/useTicks.js +11 -8
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +4 -4
- package/internals/components/AxisSharedComponents.js +15 -15
- package/internals/defaultizeColor.d.ts +1 -0
- package/legacy/BarChart/BarChart.js +93 -29
- package/legacy/BarChart/BarElement.js +20 -10
- package/legacy/BarChart/BarPlot.js +49 -20
- package/legacy/BarChart/extremums.js +22 -2
- package/legacy/BarChart/formatter.js +3 -1
- package/legacy/ChartsAxis/ChartsAxis.js +51 -6
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
- package/legacy/ChartsLegend/ChartsLegend.js +46 -15
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
- 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 +63 -11
- package/legacy/LineChart/LineElement.js +30 -10
- package/legacy/LineChart/LinePlot.js +36 -5
- package/legacy/LineChart/MarkPlot.js +30 -5
- package/legacy/PieChart/PieArcLabel.js +0 -1
- package/legacy/PieChart/PieChart.js +52 -10
- package/legacy/PieChart/PiePlot.js +29 -6
- package/legacy/ScatterChart/ScatterChart.js +56 -10
- package/legacy/ScatterChart/ScatterPlot.js +27 -4
- package/legacy/SparkLineChart/SparkLineChart.js +29 -6
- package/legacy/colorPalettes/colorPalettes.js +2 -2
- package/legacy/context/CartesianContextProvider.js +18 -12
- package/legacy/hooks/useAxisEvents.js +21 -37
- package/legacy/hooks/useTicks.js +11 -11
- package/legacy/index.js +1 -1
- package/legacy/internals/components/AxisSharedComponents.js +10 -10
- package/models/axis.d.ts +24 -1
- package/models/seriesType/bar.d.ts +6 -1
- package/modern/BarChart/BarChart.js +85 -23
- package/modern/BarChart/BarElement.js +20 -11
- package/modern/BarChart/BarPlot.js +48 -19
- package/modern/BarChart/extremums.js +18 -2
- package/modern/BarChart/formatter.js +3 -1
- package/modern/ChartsAxis/ChartsAxis.js +51 -6
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +11 -3
- package/modern/ChartsLegend/ChartsLegend.js +46 -14
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +13 -9
- 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 +63 -11
- package/modern/LineChart/LineElement.js +30 -11
- package/modern/LineChart/LinePlot.js +37 -5
- package/modern/LineChart/MarkPlot.js +31 -5
- package/modern/PieChart/PieArcLabel.js +0 -1
- package/modern/PieChart/PieChart.js +52 -10
- package/modern/PieChart/PiePlot.js +30 -6
- package/modern/ScatterChart/ScatterChart.js +56 -10
- package/modern/ScatterChart/ScatterPlot.js +28 -4
- package/modern/SparkLineChart/SparkLineChart.js +29 -6
- package/modern/colorPalettes/colorPalettes.js +2 -2
- package/modern/context/CartesianContextProvider.js +18 -12
- package/modern/hooks/useAxisEvents.js +21 -38
- package/modern/hooks/useTicks.js +11 -8
- package/modern/index.js +1 -1
- package/modern/internals/components/AxisSharedComponents.js +10 -10
- package/package.json +5 -5
- package/themeAugmentation/components.d.ts +0 -10
- package/themeAugmentation/overrides.d.ts +0 -2
package/PieChart/PieChart.js
CHANGED
|
@@ -52,7 +52,9 @@ function PieChart(props) {
|
|
|
52
52
|
leftAxis = null,
|
|
53
53
|
rightAxis = null,
|
|
54
54
|
bottomAxis = null,
|
|
55
|
-
children
|
|
55
|
+
children,
|
|
56
|
+
slots,
|
|
57
|
+
slotProps
|
|
56
58
|
} = props;
|
|
57
59
|
const margin = (0, _extends2.default)({}, defaultMargin, marginProps);
|
|
58
60
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
@@ -75,8 +77,16 @@ function PieChart(props) {
|
|
|
75
77
|
topAxis: topAxis,
|
|
76
78
|
leftAxis: leftAxis,
|
|
77
79
|
rightAxis: rightAxis,
|
|
78
|
-
bottomAxis: bottomAxis
|
|
79
|
-
|
|
80
|
+
bottomAxis: bottomAxis,
|
|
81
|
+
slots: slots,
|
|
82
|
+
slotProps: slotProps
|
|
83
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PiePlot.PiePlot, {
|
|
84
|
+
slots: slots,
|
|
85
|
+
slotProps: slotProps
|
|
86
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
87
|
+
slots: slots,
|
|
88
|
+
slotProps: slotProps
|
|
89
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip)), children]
|
|
80
90
|
});
|
|
81
91
|
}
|
|
82
92
|
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
@@ -86,7 +96,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
86
96
|
// ----------------------------------------------------------------------
|
|
87
97
|
axisHighlight: _propTypes.default.shape({
|
|
88
98
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
89
|
-
y: _propTypes.default.oneOf(['line', 'none'])
|
|
99
|
+
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
90
100
|
}),
|
|
91
101
|
/**
|
|
92
102
|
* Indicate which axis to display the bottom of the charts.
|
|
@@ -102,8 +112,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
102
112
|
label: _propTypes.default.string,
|
|
103
113
|
labelFontSize: _propTypes.default.number,
|
|
104
114
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
115
|
+
slotProps: _propTypes.default.object,
|
|
116
|
+
slots: _propTypes.default.object,
|
|
105
117
|
stroke: _propTypes.default.string,
|
|
106
118
|
tickFontSize: _propTypes.default.number,
|
|
119
|
+
tickMaxStep: _propTypes.default.number,
|
|
120
|
+
tickMinStep: _propTypes.default.number,
|
|
121
|
+
tickNumber: _propTypes.default.number,
|
|
107
122
|
tickSize: _propTypes.default.number
|
|
108
123
|
}), _propTypes.default.string]),
|
|
109
124
|
children: _propTypes.default.node,
|
|
@@ -130,8 +145,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
130
145
|
label: _propTypes.default.string,
|
|
131
146
|
labelFontSize: _propTypes.default.number,
|
|
132
147
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
148
|
+
slotProps: _propTypes.default.object,
|
|
149
|
+
slots: _propTypes.default.object,
|
|
133
150
|
stroke: _propTypes.default.string,
|
|
134
151
|
tickFontSize: _propTypes.default.number,
|
|
152
|
+
tickMaxStep: _propTypes.default.number,
|
|
153
|
+
tickMinStep: _propTypes.default.number,
|
|
154
|
+
tickNumber: _propTypes.default.number,
|
|
135
155
|
tickSize: _propTypes.default.number
|
|
136
156
|
}), _propTypes.default.string]),
|
|
137
157
|
legend: _propTypes.default.shape({
|
|
@@ -148,6 +168,8 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
148
168
|
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
149
169
|
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
150
170
|
}),
|
|
171
|
+
slotProps: _propTypes.default.object,
|
|
172
|
+
slots: _propTypes.default.object,
|
|
151
173
|
spacing: _propTypes.default.number
|
|
152
174
|
}),
|
|
153
175
|
margin: _propTypes.default.shape({
|
|
@@ -170,8 +192,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
170
192
|
label: _propTypes.default.string,
|
|
171
193
|
labelFontSize: _propTypes.default.number,
|
|
172
194
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
195
|
+
slotProps: _propTypes.default.object,
|
|
196
|
+
slots: _propTypes.default.object,
|
|
173
197
|
stroke: _propTypes.default.string,
|
|
174
198
|
tickFontSize: _propTypes.default.number,
|
|
199
|
+
tickMaxStep: _propTypes.default.number,
|
|
200
|
+
tickMinStep: _propTypes.default.number,
|
|
201
|
+
tickNumber: _propTypes.default.number,
|
|
175
202
|
tickSize: _propTypes.default.number
|
|
176
203
|
}), _propTypes.default.string]),
|
|
177
204
|
series: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -213,6 +240,12 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
213
240
|
type: _propTypes.default.oneOf(['pie']),
|
|
214
241
|
valueFormatter: _propTypes.default.func
|
|
215
242
|
})).isRequired,
|
|
243
|
+
/**
|
|
244
|
+
* The props used for each component slot.
|
|
245
|
+
* @default {}
|
|
246
|
+
*/
|
|
247
|
+
slotProps: _propTypes.default.object,
|
|
248
|
+
slots: _propTypes.default.object,
|
|
216
249
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
217
250
|
title: _propTypes.default.string,
|
|
218
251
|
tooltip: _propTypes.default.shape({
|
|
@@ -235,8 +268,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
235
268
|
label: _propTypes.default.string,
|
|
236
269
|
labelFontSize: _propTypes.default.number,
|
|
237
270
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
271
|
+
slotProps: _propTypes.default.object,
|
|
272
|
+
slots: _propTypes.default.object,
|
|
238
273
|
stroke: _propTypes.default.string,
|
|
239
274
|
tickFontSize: _propTypes.default.number,
|
|
275
|
+
tickMaxStep: _propTypes.default.number,
|
|
276
|
+
tickMinStep: _propTypes.default.number,
|
|
277
|
+
tickNumber: _propTypes.default.number,
|
|
240
278
|
tickSize: _propTypes.default.number
|
|
241
279
|
}), _propTypes.default.string]),
|
|
242
280
|
viewBox: _propTypes.default.shape({
|
|
@@ -259,15 +297,17 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
259
297
|
label: _propTypes.default.string,
|
|
260
298
|
labelFontSize: _propTypes.default.number,
|
|
261
299
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
262
|
-
maxTicks: _propTypes.default.number,
|
|
263
300
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
264
|
-
minTicks: _propTypes.default.number,
|
|
265
301
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
266
302
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
303
|
+
slotProps: _propTypes.default.object,
|
|
304
|
+
slots: _propTypes.default.object,
|
|
267
305
|
stroke: _propTypes.default.string,
|
|
268
306
|
tickFontSize: _propTypes.default.number,
|
|
307
|
+
tickMaxStep: _propTypes.default.number,
|
|
308
|
+
tickMinStep: _propTypes.default.number,
|
|
309
|
+
tickNumber: _propTypes.default.number,
|
|
269
310
|
tickSize: _propTypes.default.number,
|
|
270
|
-
tickSpacing: _propTypes.default.number,
|
|
271
311
|
valueFormatter: _propTypes.default.func
|
|
272
312
|
})),
|
|
273
313
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -283,15 +323,17 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
283
323
|
label: _propTypes.default.string,
|
|
284
324
|
labelFontSize: _propTypes.default.number,
|
|
285
325
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
286
|
-
maxTicks: _propTypes.default.number,
|
|
287
326
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
288
|
-
minTicks: _propTypes.default.number,
|
|
289
327
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
290
328
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
329
|
+
slotProps: _propTypes.default.object,
|
|
330
|
+
slots: _propTypes.default.object,
|
|
291
331
|
stroke: _propTypes.default.string,
|
|
292
332
|
tickFontSize: _propTypes.default.number,
|
|
333
|
+
tickMaxStep: _propTypes.default.number,
|
|
334
|
+
tickMinStep: _propTypes.default.number,
|
|
335
|
+
tickNumber: _propTypes.default.number,
|
|
293
336
|
tickSize: _propTypes.default.number,
|
|
294
|
-
tickSpacing: _propTypes.default.number,
|
|
295
337
|
valueFormatter: _propTypes.default.func
|
|
296
338
|
}))
|
|
297
339
|
} : void 0;
|
package/PieChart/PiePlot.d.ts
CHANGED
|
@@ -1,2 +1,28 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import { PieArcProps } from './PieArc';
|
|
3
|
+
import { PieArcLabelProps } from './PieArcLabel';
|
|
4
|
+
export interface PiePlotSlotsComponent {
|
|
5
|
+
pieArc?: React.JSXElementConstructor<PieArcProps>;
|
|
6
|
+
pieArcLabel?: React.JSXElementConstructor<PieArcLabelProps>;
|
|
7
|
+
}
|
|
8
|
+
export interface PiePlotSlotComponentProps {
|
|
9
|
+
pieArc?: Partial<PieArcProps>;
|
|
10
|
+
pieArcLabel?: Partial<PieArcLabelProps>;
|
|
11
|
+
}
|
|
12
|
+
export interface PiePlotProps {
|
|
13
|
+
/**
|
|
14
|
+
* Overridable component slots.
|
|
15
|
+
* @default {}
|
|
16
|
+
*/
|
|
17
|
+
slots?: PiePlotSlotsComponent;
|
|
18
|
+
/**
|
|
19
|
+
* The props used for each component slot.
|
|
20
|
+
* @default {}
|
|
21
|
+
*/
|
|
22
|
+
slotProps?: PiePlotSlotComponentProps;
|
|
23
|
+
}
|
|
24
|
+
declare function PiePlot(props: PiePlotProps): React.JSX.Element | null;
|
|
25
|
+
declare namespace PiePlot {
|
|
26
|
+
var propTypes: any;
|
|
27
|
+
}
|
|
28
|
+
export { PiePlot };
|
package/PieChart/PiePlot.js
CHANGED
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.PiePlot = PiePlot;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
11
|
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
11
12
|
var _PieArc = _interopRequireDefault(require("./PieArc"));
|
|
12
13
|
var _PieArcLabel = _interopRequireDefault(require("./PieArcLabel"));
|
|
@@ -28,7 +29,11 @@ function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
|
28
29
|
}
|
|
29
30
|
return arcLabel(item);
|
|
30
31
|
}
|
|
31
|
-
function PiePlot() {
|
|
32
|
+
function PiePlot(props) {
|
|
33
|
+
const {
|
|
34
|
+
slots,
|
|
35
|
+
slotProps
|
|
36
|
+
} = props;
|
|
32
37
|
const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).pie;
|
|
33
38
|
const {
|
|
34
39
|
left,
|
|
@@ -48,6 +53,8 @@ function PiePlot() {
|
|
|
48
53
|
series,
|
|
49
54
|
seriesOrder
|
|
50
55
|
} = seriesData;
|
|
56
|
+
const Arc = slots?.pieArc ?? _PieArc.default;
|
|
57
|
+
const ArcLabel = slots?.pieArcLabel ?? _PieArcLabel.default;
|
|
51
58
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
52
59
|
children: seriesOrder.map(seriesId => {
|
|
53
60
|
const {
|
|
@@ -66,7 +73,7 @@ function PiePlot() {
|
|
|
66
73
|
transform: `translate(${cx === undefined ? center.x : left + cx}, ${cy === undefined ? center.y : top + cy})`,
|
|
67
74
|
children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
68
75
|
children: [data.map((item, index) => {
|
|
69
|
-
return /*#__PURE__*/(0, React.createElement)(
|
|
76
|
+
return /*#__PURE__*/(0, React.createElement)(Arc, (0, _extends2.default)({}, item, {
|
|
70
77
|
key: item.id,
|
|
71
78
|
innerRadius: innerRadius,
|
|
72
79
|
outerRadius: outerRadius ?? availableRadius,
|
|
@@ -77,9 +84,9 @@ function PiePlot() {
|
|
|
77
84
|
highlightScope: series[seriesId].highlightScope,
|
|
78
85
|
highlighted: highlighted,
|
|
79
86
|
faded: faded
|
|
80
|
-
}));
|
|
87
|
+
}, slotProps?.pieArc));
|
|
81
88
|
}), data.map((item, index) => {
|
|
82
|
-
return /*#__PURE__*/(0, React.createElement)(
|
|
89
|
+
return /*#__PURE__*/(0, React.createElement)(ArcLabel, (0, _extends2.default)({}, item, {
|
|
83
90
|
key: item.id,
|
|
84
91
|
innerRadius: innerRadius,
|
|
85
92
|
outerRadius: outerRadius ?? availableRadius,
|
|
@@ -89,10 +96,26 @@ function PiePlot() {
|
|
|
89
96
|
dataIndex: index,
|
|
90
97
|
highlightScope: series[seriesId].highlightScope,
|
|
91
98
|
formattedArcLabel: getItemLabel(arcLabel, arcLabelMinAngle, item)
|
|
92
|
-
}));
|
|
99
|
+
}, slotProps?.pieArcLabel));
|
|
93
100
|
})]
|
|
94
101
|
})
|
|
95
102
|
}, seriesId);
|
|
96
103
|
})
|
|
97
104
|
});
|
|
98
|
-
}
|
|
105
|
+
}
|
|
106
|
+
process.env.NODE_ENV !== "production" ? PiePlot.propTypes = {
|
|
107
|
+
// ----------------------------- Warning --------------------------------
|
|
108
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
109
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
110
|
+
// ----------------------------------------------------------------------
|
|
111
|
+
/**
|
|
112
|
+
* The props used for each component slot.
|
|
113
|
+
* @default {}
|
|
114
|
+
*/
|
|
115
|
+
slotProps: _propTypes.default.object,
|
|
116
|
+
/**
|
|
117
|
+
* Overridable component slots.
|
|
118
|
+
* @default {}
|
|
119
|
+
*/
|
|
120
|
+
slots: _propTypes.default.object
|
|
121
|
+
} : void 0;
|
|
@@ -1,16 +1,32 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import { ScatterPlotSlotComponentProps, ScatterPlotSlotsComponent } from './ScatterPlot';
|
|
2
3
|
import { ResponsiveChartContainerProps } from '../ResponsiveChartContainer';
|
|
3
4
|
import { ChartsAxisProps } from '../ChartsAxis';
|
|
4
5
|
import { ScatterSeriesType } from '../models/seriesType/scatter';
|
|
5
6
|
import { MakeOptional } from '../models/helpers';
|
|
6
7
|
import { ChartsTooltipProps } from '../ChartsTooltip';
|
|
7
|
-
import { ChartsLegendProps } from '../ChartsLegend';
|
|
8
|
+
import { ChartsLegendProps, ChartsLegendSlotComponentProps, ChartsLegendSlotsComponent } from '../ChartsLegend';
|
|
8
9
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
9
|
-
|
|
10
|
+
import { ChartsAxisSlotsComponent, ChartsAxisSlotComponentProps } from '../models/axis';
|
|
11
|
+
export interface ScatterChartSlotsComponent extends ChartsAxisSlotsComponent, ScatterPlotSlotsComponent, ChartsLegendSlotsComponent {
|
|
12
|
+
}
|
|
13
|
+
export interface ScatterChartSlotComponentProps extends ChartsAxisSlotComponentProps, ScatterPlotSlotComponentProps, ChartsLegendSlotComponentProps {
|
|
14
|
+
}
|
|
15
|
+
export interface ScatterChartProps extends Omit<ResponsiveChartContainerProps, 'series'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'> {
|
|
10
16
|
series: MakeOptional<ScatterSeriesType, 'type'>[];
|
|
11
17
|
tooltip?: ChartsTooltipProps;
|
|
12
18
|
axisHighlight?: ChartsAxisHighlightProps;
|
|
13
19
|
legend?: ChartsLegendProps;
|
|
20
|
+
/**
|
|
21
|
+
* Overridable component slots.
|
|
22
|
+
* @default {}
|
|
23
|
+
*/
|
|
24
|
+
slots?: ScatterChartSlotsComponent;
|
|
25
|
+
/**
|
|
26
|
+
* The props used for each component slot.
|
|
27
|
+
* @default {}
|
|
28
|
+
*/
|
|
29
|
+
slotProps?: ScatterChartSlotComponentProps;
|
|
14
30
|
}
|
|
15
31
|
declare const ScatterChart: React.ForwardRefExoticComponent<ScatterChartProps & React.RefAttributes<unknown>>;
|
|
16
32
|
export { ScatterChart };
|
|
@@ -34,7 +34,9 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props,
|
|
|
34
34
|
leftAxis,
|
|
35
35
|
rightAxis,
|
|
36
36
|
bottomAxis,
|
|
37
|
-
children
|
|
37
|
+
children,
|
|
38
|
+
slots,
|
|
39
|
+
slotProps
|
|
38
40
|
} = props;
|
|
39
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
40
42
|
ref: ref,
|
|
@@ -52,8 +54,16 @@ const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props,
|
|
|
52
54
|
topAxis: topAxis,
|
|
53
55
|
leftAxis: leftAxis,
|
|
54
56
|
rightAxis: rightAxis,
|
|
55
|
-
bottomAxis: bottomAxis
|
|
56
|
-
|
|
57
|
+
bottomAxis: bottomAxis,
|
|
58
|
+
slots: slots,
|
|
59
|
+
slotProps: slotProps
|
|
60
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ScatterPlot.ScatterPlot, {
|
|
61
|
+
slots: slots,
|
|
62
|
+
slotProps: slotProps
|
|
63
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
64
|
+
slots: slots,
|
|
65
|
+
slotProps: slotProps
|
|
66
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({
|
|
57
67
|
x: "none",
|
|
58
68
|
y: "none"
|
|
59
69
|
}, axisHighlight)), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({
|
|
@@ -69,7 +79,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
69
79
|
// ----------------------------------------------------------------------
|
|
70
80
|
axisHighlight: _propTypes.default.shape({
|
|
71
81
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
72
|
-
y: _propTypes.default.oneOf(['line', 'none'])
|
|
82
|
+
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
73
83
|
}),
|
|
74
84
|
/**
|
|
75
85
|
* Indicate which axis to display the bottom of the charts.
|
|
@@ -85,8 +95,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
85
95
|
label: _propTypes.default.string,
|
|
86
96
|
labelFontSize: _propTypes.default.number,
|
|
87
97
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
98
|
+
slotProps: _propTypes.default.object,
|
|
99
|
+
slots: _propTypes.default.object,
|
|
88
100
|
stroke: _propTypes.default.string,
|
|
89
101
|
tickFontSize: _propTypes.default.number,
|
|
102
|
+
tickMaxStep: _propTypes.default.number,
|
|
103
|
+
tickMinStep: _propTypes.default.number,
|
|
104
|
+
tickNumber: _propTypes.default.number,
|
|
90
105
|
tickSize: _propTypes.default.number
|
|
91
106
|
}), _propTypes.default.string]),
|
|
92
107
|
children: _propTypes.default.node,
|
|
@@ -113,8 +128,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
113
128
|
label: _propTypes.default.string,
|
|
114
129
|
labelFontSize: _propTypes.default.number,
|
|
115
130
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
131
|
+
slotProps: _propTypes.default.object,
|
|
132
|
+
slots: _propTypes.default.object,
|
|
116
133
|
stroke: _propTypes.default.string,
|
|
117
134
|
tickFontSize: _propTypes.default.number,
|
|
135
|
+
tickMaxStep: _propTypes.default.number,
|
|
136
|
+
tickMinStep: _propTypes.default.number,
|
|
137
|
+
tickNumber: _propTypes.default.number,
|
|
118
138
|
tickSize: _propTypes.default.number
|
|
119
139
|
}), _propTypes.default.string]),
|
|
120
140
|
legend: _propTypes.default.shape({
|
|
@@ -131,6 +151,8 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
131
151
|
horizontal: _propTypes.default.oneOf(['left', 'middle', 'right']).isRequired,
|
|
132
152
|
vertical: _propTypes.default.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
133
153
|
}),
|
|
154
|
+
slotProps: _propTypes.default.object,
|
|
155
|
+
slots: _propTypes.default.object,
|
|
134
156
|
spacing: _propTypes.default.number
|
|
135
157
|
}),
|
|
136
158
|
margin: _propTypes.default.shape({
|
|
@@ -153,8 +175,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
153
175
|
label: _propTypes.default.string,
|
|
154
176
|
labelFontSize: _propTypes.default.number,
|
|
155
177
|
position: _propTypes.default.oneOf(['left', 'right']),
|
|
178
|
+
slotProps: _propTypes.default.object,
|
|
179
|
+
slots: _propTypes.default.object,
|
|
156
180
|
stroke: _propTypes.default.string,
|
|
157
181
|
tickFontSize: _propTypes.default.number,
|
|
182
|
+
tickMaxStep: _propTypes.default.number,
|
|
183
|
+
tickMinStep: _propTypes.default.number,
|
|
184
|
+
tickNumber: _propTypes.default.number,
|
|
158
185
|
tickSize: _propTypes.default.number
|
|
159
186
|
}), _propTypes.default.string]),
|
|
160
187
|
series: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -176,6 +203,16 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
176
203
|
xAxisKey: _propTypes.default.string,
|
|
177
204
|
yAxisKey: _propTypes.default.string
|
|
178
205
|
})).isRequired,
|
|
206
|
+
/**
|
|
207
|
+
* The props used for each component slot.
|
|
208
|
+
* @default {}
|
|
209
|
+
*/
|
|
210
|
+
slotProps: _propTypes.default.object,
|
|
211
|
+
/**
|
|
212
|
+
* Overridable component slots.
|
|
213
|
+
* @default {}
|
|
214
|
+
*/
|
|
215
|
+
slots: _propTypes.default.object,
|
|
179
216
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
180
217
|
title: _propTypes.default.string,
|
|
181
218
|
tooltip: _propTypes.default.shape({
|
|
@@ -198,8 +235,13 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
198
235
|
label: _propTypes.default.string,
|
|
199
236
|
labelFontSize: _propTypes.default.number,
|
|
200
237
|
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
238
|
+
slotProps: _propTypes.default.object,
|
|
239
|
+
slots: _propTypes.default.object,
|
|
201
240
|
stroke: _propTypes.default.string,
|
|
202
241
|
tickFontSize: _propTypes.default.number,
|
|
242
|
+
tickMaxStep: _propTypes.default.number,
|
|
243
|
+
tickMinStep: _propTypes.default.number,
|
|
244
|
+
tickNumber: _propTypes.default.number,
|
|
203
245
|
tickSize: _propTypes.default.number
|
|
204
246
|
}), _propTypes.default.string]),
|
|
205
247
|
viewBox: _propTypes.default.shape({
|
|
@@ -222,15 +264,17 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
222
264
|
label: _propTypes.default.string,
|
|
223
265
|
labelFontSize: _propTypes.default.number,
|
|
224
266
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
225
|
-
maxTicks: _propTypes.default.number,
|
|
226
267
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
227
|
-
minTicks: _propTypes.default.number,
|
|
228
268
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
229
269
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
270
|
+
slotProps: _propTypes.default.object,
|
|
271
|
+
slots: _propTypes.default.object,
|
|
230
272
|
stroke: _propTypes.default.string,
|
|
231
273
|
tickFontSize: _propTypes.default.number,
|
|
274
|
+
tickMaxStep: _propTypes.default.number,
|
|
275
|
+
tickMinStep: _propTypes.default.number,
|
|
276
|
+
tickNumber: _propTypes.default.number,
|
|
232
277
|
tickSize: _propTypes.default.number,
|
|
233
|
-
tickSpacing: _propTypes.default.number,
|
|
234
278
|
valueFormatter: _propTypes.default.func
|
|
235
279
|
})),
|
|
236
280
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
@@ -246,15 +290,17 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
246
290
|
label: _propTypes.default.string,
|
|
247
291
|
labelFontSize: _propTypes.default.number,
|
|
248
292
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
249
|
-
maxTicks: _propTypes.default.number,
|
|
250
293
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
251
|
-
minTicks: _propTypes.default.number,
|
|
252
294
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
253
295
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
296
|
+
slotProps: _propTypes.default.object,
|
|
297
|
+
slots: _propTypes.default.object,
|
|
254
298
|
stroke: _propTypes.default.string,
|
|
255
299
|
tickFontSize: _propTypes.default.number,
|
|
300
|
+
tickMaxStep: _propTypes.default.number,
|
|
301
|
+
tickMinStep: _propTypes.default.number,
|
|
302
|
+
tickNumber: _propTypes.default.number,
|
|
256
303
|
tickSize: _propTypes.default.number,
|
|
257
|
-
tickSpacing: _propTypes.default.number,
|
|
258
304
|
valueFormatter: _propTypes.default.func
|
|
259
305
|
}))
|
|
260
306
|
} : void 0;
|
|
@@ -1,2 +1,25 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
|
|
2
|
+
import { ScatterProps } from './Scatter';
|
|
3
|
+
export interface ScatterPlotSlotsComponent {
|
|
4
|
+
scatter?: React.JSXElementConstructor<ScatterProps>;
|
|
5
|
+
}
|
|
6
|
+
export interface ScatterPlotSlotComponentProps {
|
|
7
|
+
scatter?: Partial<ScatterProps>;
|
|
8
|
+
}
|
|
9
|
+
export interface ScatterPlotProps {
|
|
10
|
+
/**
|
|
11
|
+
* Overridable component slots.
|
|
12
|
+
* @default {}
|
|
13
|
+
*/
|
|
14
|
+
slots?: ScatterPlotSlotsComponent;
|
|
15
|
+
/**
|
|
16
|
+
* The props used for each component slot.
|
|
17
|
+
* @default {}
|
|
18
|
+
*/
|
|
19
|
+
slotProps?: ScatterPlotSlotComponentProps;
|
|
20
|
+
}
|
|
21
|
+
declare function ScatterPlot(props: ScatterPlotProps): React.JSX.Element | null;
|
|
22
|
+
declare namespace ScatterPlot {
|
|
23
|
+
var propTypes: any;
|
|
24
|
+
}
|
|
25
|
+
export { ScatterPlot };
|
|
@@ -1,17 +1,24 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
3
4
|
Object.defineProperty(exports, "__esModule", {
|
|
4
5
|
value: true
|
|
5
6
|
});
|
|
6
7
|
exports.ScatterPlot = ScatterPlot;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
7
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
8
11
|
var _Scatter = require("./Scatter");
|
|
9
12
|
var _SeriesContextProvider = require("../context/SeriesContextProvider");
|
|
10
13
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
11
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
12
15
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
13
16
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
function ScatterPlot() {
|
|
17
|
+
function ScatterPlot(props) {
|
|
18
|
+
const {
|
|
19
|
+
slots,
|
|
20
|
+
slotProps
|
|
21
|
+
} = props;
|
|
15
22
|
const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).scatter;
|
|
16
23
|
const axisData = React.useContext(_CartesianContextProvider.CartesianContext);
|
|
17
24
|
if (seriesData === undefined) {
|
|
@@ -29,6 +36,7 @@ function ScatterPlot() {
|
|
|
29
36
|
} = axisData;
|
|
30
37
|
const defaultXAxisId = xAxisIds[0];
|
|
31
38
|
const defaultYAxisId = yAxisIds[0];
|
|
39
|
+
const ScatterItems = slots?.scatter ?? _Scatter.Scatter;
|
|
32
40
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(React.Fragment, {
|
|
33
41
|
children: seriesOrder.map(seriesId => {
|
|
34
42
|
const {
|
|
@@ -40,13 +48,29 @@ function ScatterPlot() {
|
|
|
40
48
|
} = series[seriesId];
|
|
41
49
|
const xScale = xAxis[xAxisKey ?? defaultXAxisId].scale;
|
|
42
50
|
const yScale = yAxis[yAxisKey ?? defaultYAxisId].scale;
|
|
43
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
51
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(ScatterItems, (0, _extends2.default)({
|
|
44
52
|
xScale: xScale,
|
|
45
53
|
yScale: yScale,
|
|
46
54
|
color: color,
|
|
47
55
|
markerSize: markerSize ?? 4,
|
|
48
56
|
series: series[seriesId]
|
|
49
|
-
}, id);
|
|
57
|
+
}, slotProps?.scatter), id);
|
|
50
58
|
})
|
|
51
59
|
});
|
|
52
|
-
}
|
|
60
|
+
}
|
|
61
|
+
process.env.NODE_ENV !== "production" ? ScatterPlot.propTypes = {
|
|
62
|
+
// ----------------------------- Warning --------------------------------
|
|
63
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
65
|
+
// ----------------------------------------------------------------------
|
|
66
|
+
/**
|
|
67
|
+
* The props used for each component slot.
|
|
68
|
+
* @default {}
|
|
69
|
+
*/
|
|
70
|
+
slotProps: _propTypes.default.object,
|
|
71
|
+
/**
|
|
72
|
+
* Overridable component slots.
|
|
73
|
+
* @default {}
|
|
74
|
+
*/
|
|
75
|
+
slots: _propTypes.default.object
|
|
76
|
+
} : void 0;
|
|
@@ -5,6 +5,14 @@ import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
|
5
5
|
import { AxisConfig } from '../models/axis';
|
|
6
6
|
import { MakeOptional } from '../models/helpers';
|
|
7
7
|
import { LineSeriesType } from '../models/seriesType/line';
|
|
8
|
+
import { AreaPlotSlotsComponent, AreaPlotSlotComponentProps } from '../LineChart/AreaPlot';
|
|
9
|
+
import { LinePlotSlotsComponent, LinePlotSlotComponentProps } from '../LineChart/LinePlot';
|
|
10
|
+
import { MarkPlotSlotsComponent, MarkPlotSlotComponentProps } from '../LineChart/MarkPlot';
|
|
11
|
+
import { BarPlotSlotsComponent, BarPlotSlotComponentProps } from '../BarChart/BarPlot';
|
|
12
|
+
export interface SparkLineChartSlotsComponent extends AreaPlotSlotsComponent, LinePlotSlotsComponent, MarkPlotSlotsComponent, BarPlotSlotsComponent {
|
|
13
|
+
}
|
|
14
|
+
export interface SparkLineChartSlotComponentProps extends AreaPlotSlotComponentProps, LinePlotSlotComponentProps, MarkPlotSlotComponentProps, BarPlotSlotComponentProps {
|
|
15
|
+
}
|
|
8
16
|
export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps, 'series' | 'xAxis' | 'yAxis'> {
|
|
9
17
|
/**
|
|
10
18
|
* The xAxis configuration.
|
|
@@ -50,6 +58,16 @@ export interface SparkLineChartProps extends Omit<ResponsiveChartContainerProps,
|
|
|
50
58
|
* @default 'linear'
|
|
51
59
|
*/
|
|
52
60
|
curve?: LineSeriesType['curve'];
|
|
61
|
+
/**
|
|
62
|
+
* Overridable component slots.
|
|
63
|
+
* @default {}
|
|
64
|
+
*/
|
|
65
|
+
slots?: SparkLineChartSlotsComponent;
|
|
66
|
+
/**
|
|
67
|
+
* The props used for each component slot.
|
|
68
|
+
* @default {}
|
|
69
|
+
*/
|
|
70
|
+
slotProps?: SparkLineChartSlotComponentProps;
|
|
53
71
|
}
|
|
54
72
|
declare const SparkLineChart: React.ForwardRefExoticComponent<SparkLineChartProps & React.RefAttributes<unknown>>;
|
|
55
73
|
export { SparkLineChart };
|
|
@@ -45,6 +45,8 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
45
45
|
showHighlight,
|
|
46
46
|
axisHighlight: inAxisHighlight,
|
|
47
47
|
children,
|
|
48
|
+
slots,
|
|
49
|
+
slotProps,
|
|
48
50
|
data,
|
|
49
51
|
plotType = 'line',
|
|
50
52
|
valueFormatter = v => v.toString(),
|
|
@@ -81,8 +83,17 @@ const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(pro
|
|
|
81
83
|
colors: colors,
|
|
82
84
|
sx: sx,
|
|
83
85
|
disableAxisListener: (!showTooltip || tooltip?.trigger !== 'axis') && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
84
|
-
children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
|
|
85
|
-
|
|
86
|
+
children: [plotType === 'bar' && /*#__PURE__*/(0, _jsxRuntime.jsx)(_BarChart.BarPlot, {
|
|
87
|
+
slots: slots,
|
|
88
|
+
slotProps: slotProps
|
|
89
|
+
}), plotType === 'line' && /*#__PURE__*/(0, _jsxRuntime.jsxs)(React.Fragment, {
|
|
90
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.AreaPlot, {
|
|
91
|
+
slots: slots,
|
|
92
|
+
slotProps: slotProps
|
|
93
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineChart.LinePlot, {
|
|
94
|
+
slots: slots,
|
|
95
|
+
slotProps: slotProps
|
|
96
|
+
}), showHighlight && /*#__PURE__*/(0, _jsxRuntime.jsx)(SparkLineMarkPlot, {})]
|
|
86
97
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxisHighlight.ChartsAxisHighlight, (0, _extends2.default)({}, axisHighlight)), showTooltip && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({}, tooltip)), children]
|
|
87
98
|
});
|
|
88
99
|
});
|
|
@@ -100,7 +111,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
100
111
|
area: _propTypes.default.bool,
|
|
101
112
|
axisHighlight: _propTypes.default.shape({
|
|
102
113
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
103
|
-
y: _propTypes.default.oneOf(['line', 'none'])
|
|
114
|
+
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
104
115
|
}),
|
|
105
116
|
children: _propTypes.default.node,
|
|
106
117
|
className: _propTypes.default.string,
|
|
@@ -143,6 +154,16 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
143
154
|
* @default false
|
|
144
155
|
*/
|
|
145
156
|
showTooltip: _propTypes.default.bool,
|
|
157
|
+
/**
|
|
158
|
+
* The props used for each component slot.
|
|
159
|
+
* @default {}
|
|
160
|
+
*/
|
|
161
|
+
slotProps: _propTypes.default.object,
|
|
162
|
+
/**
|
|
163
|
+
* Overridable component slots.
|
|
164
|
+
* @default {}
|
|
165
|
+
*/
|
|
166
|
+
slots: _propTypes.default.object,
|
|
146
167
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
147
168
|
title: _propTypes.default.string,
|
|
148
169
|
tooltip: _propTypes.default.shape({
|
|
@@ -181,15 +202,17 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
181
202
|
label: _propTypes.default.string,
|
|
182
203
|
labelFontSize: _propTypes.default.number,
|
|
183
204
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
184
|
-
maxTicks: _propTypes.default.number,
|
|
185
205
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
186
|
-
minTicks: _propTypes.default.number,
|
|
187
206
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
188
207
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
208
|
+
slotProps: _propTypes.default.object,
|
|
209
|
+
slots: _propTypes.default.object,
|
|
189
210
|
stroke: _propTypes.default.string,
|
|
190
211
|
tickFontSize: _propTypes.default.number,
|
|
212
|
+
tickMaxStep: _propTypes.default.number,
|
|
213
|
+
tickMinStep: _propTypes.default.number,
|
|
214
|
+
tickNumber: _propTypes.default.number,
|
|
191
215
|
tickSize: _propTypes.default.number,
|
|
192
|
-
tickSpacing: _propTypes.default.number,
|
|
193
216
|
valueFormatter: _propTypes.default.func
|
|
194
217
|
})
|
|
195
218
|
} : void 0;
|