@mui/x-charts 7.0.0-beta.0 → 7.0.0-beta.2
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 +2 -1
- package/BarChart/BarChart.js +33 -12
- package/BarChart/BarElement.d.ts +20 -13
- package/BarChart/BarElement.js +7 -3
- package/BarChart/BarPlot.d.ts +11 -6
- package/BarChart/BarPlot.js +28 -15
- package/BarChart/formatter.js +1 -1
- package/CHANGELOG.md +406 -1
- package/ChartContainer/ChartContainer.js +6 -4
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsLegend/ChartsLegend.d.ts +5 -54
- package/ChartsLegend/ChartsLegend.js +2 -307
- package/ChartsLegend/DefaultChartsLegend.d.ts +60 -0
- package/ChartsLegend/DefaultChartsLegend.js +294 -0
- package/ChartsLegend/index.d.ts +1 -0
- package/ChartsLegend/index.js +11 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.d.ts +20 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +83 -0
- package/ChartsOnAxisClickHandler/index.d.ts +1 -0
- package/ChartsOnAxisClickHandler/index.js +16 -0
- package/ChartsOnAxisClickHandler/package.json +6 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsReferenceLine/common.d.ts +2 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -5
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsTooltip/utils.d.ts +4 -1
- package/ChartsTooltip/utils.js +15 -0
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +7 -0
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/ChartsXAxis/ChartsXAxis.js +13 -9
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/LineChart/AnimatedArea.d.ts +1361 -0
- package/LineChart/AnimatedArea.js +111 -0
- package/LineChart/AnimatedLine.d.ts +1361 -0
- package/LineChart/AnimatedLine.js +113 -0
- package/LineChart/AreaElement.d.ts +19 -18
- package/LineChart/AreaElement.js +17 -34
- package/LineChart/AreaPlot.d.ts +12 -7
- package/LineChart/AreaPlot.js +91 -58
- package/LineChart/LineChart.d.ts +13 -4
- package/LineChart/LineChart.js +45 -14
- package/LineChart/LineElement.d.ts +19 -18
- package/LineChart/LineElement.js +16 -36
- package/LineChart/LineHighlightElement.d.ts +3 -2
- package/LineChart/LineHighlightElement.js +5 -3
- package/LineChart/LinePlot.d.ts +12 -7
- package/LineChart/LinePlot.js +89 -56
- package/LineChart/MarkElement.d.ts +8 -4
- package/LineChart/MarkElement.js +27 -13
- package/LineChart/MarkPlot.d.ts +8 -1
- package/LineChart/MarkPlot.js +80 -51
- package/LineChart/formatter.js +1 -1
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +22 -0
- package/PieChart/PieArc.d.ts +3 -2
- package/PieChart/PieArc.js +1 -0
- package/PieChart/PieArcLabel.d.ts +3 -2
- package/PieChart/PieArcLabel.js +1 -0
- package/PieChart/PieArcLabelPlot.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +2 -2
- package/PieChart/PieArcPlot.d.ts +2 -2
- package/PieChart/PieArcPlot.js +7 -7
- package/PieChart/PieChart.d.ts +1 -1
- package/PieChart/PieChart.js +14 -12
- package/PieChart/PiePlot.d.ts +1 -1
- package/PieChart/PiePlot.js +4 -4
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/ScatterChart/Scatter.d.ts +7 -1
- package/ScatterChart/Scatter.js +17 -3
- package/ScatterChart/ScatterChart.d.ts +8 -2
- package/ScatterChart/ScatterChart.js +21 -10
- package/ScatterChart/ScatterPlot.d.ts +1 -1
- package/ScatterChart/ScatterPlot.js +10 -2
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +7 -4
- package/context/CartesianContextProvider.js +8 -6
- package/context/DrawingProvider.d.ts +6 -1
- package/context/DrawingProvider.js +9 -2
- package/context/InteractionProvider.d.ts +3 -3
- package/esm/BarChart/BarChart.js +33 -12
- package/esm/BarChart/BarElement.js +7 -3
- package/esm/BarChart/BarPlot.js +27 -15
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartContainer/ChartContainer.js +6 -4
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +2 -307
- package/esm/ChartsLegend/DefaultChartsLegend.js +286 -0
- package/esm/ChartsLegend/index.js +1 -0
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +77 -0
- package/esm/ChartsOnAxisClickHandler/index.js +1 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +8 -5
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsTooltip/utils.js +12 -0
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/esm/ChartsXAxis/ChartsXAxis.js +13 -9
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/LineChart/AnimatedArea.js +103 -0
- package/esm/LineChart/AnimatedLine.js +105 -0
- package/esm/LineChart/AreaElement.js +16 -33
- package/esm/LineChart/AreaPlot.js +92 -59
- package/esm/LineChart/LineChart.js +45 -14
- package/esm/LineChart/LineElement.js +16 -35
- package/esm/LineChart/LineHighlightElement.js +5 -3
- package/esm/LineChart/LinePlot.js +90 -57
- package/esm/LineChart/MarkElement.js +27 -13
- package/esm/LineChart/MarkPlot.js +80 -51
- package/esm/LineChart/formatter.js +1 -1
- package/esm/LineChart/index.js +2 -0
- package/esm/PieChart/PieArc.js +1 -0
- package/esm/PieChart/PieArcLabel.js +1 -0
- package/esm/PieChart/PieArcLabelPlot.js +2 -2
- package/esm/PieChart/PieArcPlot.js +7 -7
- package/esm/PieChart/PieChart.js +14 -12
- package/esm/PieChart/PiePlot.js +4 -4
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/esm/ScatterChart/Scatter.js +17 -3
- package/esm/ScatterChart/ScatterChart.js +21 -10
- package/esm/ScatterChart/ScatterPlot.js +10 -2
- package/esm/SparkLineChart/SparkLineChart.js +7 -4
- package/esm/context/CartesianContextProvider.js +8 -6
- package/esm/context/DrawingProvider.js +9 -2
- package/esm/hooks/useDrawingArea.js +7 -3
- package/esm/index.js +1 -0
- package/esm/internals/geometry.js +1 -1
- package/esm/internals/useAnimatedPath.js +29 -0
- package/esm/internals/utils.js +7 -0
- package/hooks/useDrawingArea.d.ts +2 -0
- package/hooks/useDrawingArea.js +7 -3
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/defaultizeColor.d.ts +16 -16
- package/internals/defaultizeValueFormatter.d.ts +4 -7
- package/internals/geometry.js +1 -1
- package/internals/stackSeries.d.ts +4 -7
- package/internals/useAnimatedPath.d.ts +1 -0
- package/internals/useAnimatedPath.js +38 -0
- package/internals/utils.d.ts +4 -0
- package/internals/utils.js +8 -0
- package/legacy/BarChart/BarChart.js +33 -12
- package/legacy/BarChart/BarElement.js +6 -2
- package/legacy/BarChart/BarPlot.js +28 -14
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartContainer/ChartContainer.js +6 -4
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsLegend/ChartsLegend.js +2 -323
- package/legacy/ChartsLegend/DefaultChartsLegend.js +302 -0
- package/legacy/ChartsLegend/index.js +1 -0
- package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +75 -0
- package/legacy/ChartsOnAxisClickHandler/index.js +1 -0
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +6 -7
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +8 -5
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/legacy/ChartsTooltip/utils.js +12 -0
- package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +88 -44
- package/legacy/ChartsXAxis/ChartsXAxis.js +12 -8
- package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
- package/legacy/LineChart/AnimatedArea.js +102 -0
- package/legacy/LineChart/AnimatedLine.js +104 -0
- package/legacy/LineChart/AreaElement.js +15 -35
- package/legacy/LineChart/AreaPlot.js +102 -66
- package/legacy/LineChart/LineChart.js +45 -14
- package/legacy/LineChart/LineElement.js +15 -37
- package/legacy/LineChart/LineHighlightElement.js +5 -3
- package/legacy/LineChart/LinePlot.js +97 -63
- package/legacy/LineChart/MarkElement.js +30 -12
- package/legacy/LineChart/MarkPlot.js +83 -53
- package/legacy/LineChart/formatter.js +1 -1
- package/legacy/LineChart/index.js +2 -0
- package/legacy/PieChart/PieArc.js +1 -0
- package/legacy/PieChart/PieArcLabel.js +1 -0
- package/legacy/PieChart/PieArcLabelPlot.js +2 -2
- package/legacy/PieChart/PieArcPlot.js +7 -7
- package/legacy/PieChart/PieChart.js +14 -12
- package/legacy/PieChart/PiePlot.js +4 -4
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/legacy/ScatterChart/Scatter.js +19 -3
- package/legacy/ScatterChart/ScatterChart.js +21 -10
- package/legacy/ScatterChart/ScatterPlot.js +10 -2
- package/legacy/SparkLineChart/SparkLineChart.js +8 -5
- package/legacy/context/CartesianContextProvider.js +8 -6
- package/legacy/context/DrawingProvider.js +11 -2
- package/legacy/hooks/useDrawingArea.js +7 -3
- package/legacy/index.js +2 -1
- package/legacy/internals/geometry.js +1 -1
- package/legacy/internals/useAnimatedPath.js +32 -0
- package/legacy/internals/utils.js +7 -0
- package/models/axis.d.ts +7 -2
- package/models/seriesType/common.d.ts +2 -1
- package/models/seriesType/config.d.ts +7 -12
- package/models/seriesType/line.d.ts +2 -2
- package/models/seriesType/pie.d.ts +7 -3
- package/models/seriesType/scatter.d.ts +5 -2
- package/modern/BarChart/BarChart.js +33 -12
- package/modern/BarChart/BarElement.js +7 -3
- package/modern/BarChart/BarPlot.js +27 -15
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartContainer/ChartContainer.js +6 -4
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsLegend/ChartsLegend.js +2 -307
- package/modern/ChartsLegend/DefaultChartsLegend.js +286 -0
- package/modern/ChartsLegend/index.js +1 -0
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +75 -0
- package/modern/ChartsOnAxisClickHandler/index.js +1 -0
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +6 -5
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -5
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsTooltip/utils.js +12 -0
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- package/modern/ChartsXAxis/ChartsXAxis.js +13 -9
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/LineChart/AnimatedArea.js +103 -0
- package/modern/LineChart/AnimatedLine.js +105 -0
- package/modern/LineChart/AreaElement.js +16 -33
- package/modern/LineChart/AreaPlot.js +91 -58
- package/modern/LineChart/LineChart.js +45 -14
- package/modern/LineChart/LineElement.js +16 -35
- package/modern/LineChart/LineHighlightElement.js +5 -3
- package/modern/LineChart/LinePlot.js +89 -56
- package/modern/LineChart/MarkElement.js +27 -13
- package/modern/LineChart/MarkPlot.js +80 -51
- package/modern/LineChart/formatter.js +1 -1
- package/modern/LineChart/index.js +2 -0
- package/modern/PieChart/PieArc.js +1 -0
- package/modern/PieChart/PieArcLabel.js +1 -0
- package/modern/PieChart/PieArcLabelPlot.js +2 -2
- package/modern/PieChart/PieArcPlot.js +7 -7
- package/modern/PieChart/PieChart.js +14 -12
- package/modern/PieChart/PiePlot.js +4 -4
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +6 -4
- package/modern/ScatterChart/Scatter.js +17 -3
- package/modern/ScatterChart/ScatterChart.js +21 -10
- package/modern/ScatterChart/ScatterPlot.js +10 -2
- package/modern/SparkLineChart/SparkLineChart.js +7 -4
- package/modern/context/CartesianContextProvider.js +8 -6
- package/modern/context/DrawingProvider.js +9 -2
- package/modern/hooks/useDrawingArea.js +7 -3
- package/modern/index.js +2 -1
- package/modern/internals/geometry.js +1 -1
- package/modern/internals/useAnimatedPath.js +29 -0
- package/modern/internals/utils.js +7 -0
- package/package.json +6 -5
package/LineChart/MarkElement.js
CHANGED
|
@@ -16,11 +16,12 @@ var _generateUtilityClass = _interopRequireDefault(require("@mui/utils/generateU
|
|
|
16
16
|
var _styles = require("@mui/material/styles");
|
|
17
17
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
18
18
|
var _d3Shape = require("d3-shape");
|
|
19
|
+
var _web = require("@react-spring/web");
|
|
19
20
|
var _utils = require("../internals/utils");
|
|
20
21
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
21
22
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
22
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
-
const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "highlightScope"];
|
|
24
|
+
const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "highlightScope", "onClick", "skipAnimation"];
|
|
24
25
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
26
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
27
|
function getMarkElementUtilityClass(slot) {
|
|
@@ -39,7 +40,7 @@ const useUtilityClasses = ownerState => {
|
|
|
39
40
|
};
|
|
40
41
|
return (0, _composeClasses.default)(slots, getMarkElementUtilityClass, classes);
|
|
41
42
|
};
|
|
42
|
-
const MarkElementPath = (0, _styles.styled)(
|
|
43
|
+
const MarkElementPath = (0, _styles.styled)(_web.animated.path, {
|
|
43
44
|
name: 'MuiMarkElement',
|
|
44
45
|
slot: 'Root',
|
|
45
46
|
overridesResolver: (_, styles) => styles.root
|
|
@@ -47,8 +48,6 @@ const MarkElementPath = (0, _styles.styled)('path', {
|
|
|
47
48
|
ownerState,
|
|
48
49
|
theme
|
|
49
50
|
}) => ({
|
|
50
|
-
transform: `translate(${ownerState.x}px, ${ownerState.y}px)`,
|
|
51
|
-
transformOrigin: `${ownerState.x}px ${ownerState.y}px`,
|
|
52
51
|
fill: (theme.vars || theme).palette.background.paper,
|
|
53
52
|
stroke: ownerState.color,
|
|
54
53
|
strokeWidth: 2
|
|
@@ -64,9 +63,7 @@ MarkElementPath.propTypes = {
|
|
|
64
63
|
color: _propTypes.default.string.isRequired,
|
|
65
64
|
id: _propTypes.default.string.isRequired,
|
|
66
65
|
isFaded: _propTypes.default.bool.isRequired,
|
|
67
|
-
isHighlighted: _propTypes.default.bool.isRequired
|
|
68
|
-
x: _propTypes.default.number.isRequired,
|
|
69
|
-
y: _propTypes.default.number.isRequired
|
|
66
|
+
isHighlighted: _propTypes.default.bool.isRequired
|
|
70
67
|
}).isRequired,
|
|
71
68
|
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])
|
|
72
69
|
};
|
|
@@ -89,7 +86,9 @@ function MarkElement(props) {
|
|
|
89
86
|
color,
|
|
90
87
|
shape,
|
|
91
88
|
dataIndex,
|
|
92
|
-
highlightScope
|
|
89
|
+
highlightScope,
|
|
90
|
+
onClick,
|
|
91
|
+
skipAnimation
|
|
93
92
|
} = props,
|
|
94
93
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
95
94
|
const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(highlightScope);
|
|
@@ -105,20 +104,29 @@ function MarkElement(props) {
|
|
|
105
104
|
type: 'line',
|
|
106
105
|
seriesId: id
|
|
107
106
|
}, highlightScope);
|
|
107
|
+
const position = (0, _web.useSpring)({
|
|
108
|
+
x,
|
|
109
|
+
y,
|
|
110
|
+
immediate: skipAnimation
|
|
111
|
+
});
|
|
108
112
|
const ownerState = {
|
|
109
113
|
id,
|
|
110
114
|
classes: innerClasses,
|
|
111
115
|
isHighlighted,
|
|
112
116
|
isFaded,
|
|
113
|
-
color
|
|
114
|
-
x,
|
|
115
|
-
y
|
|
117
|
+
color
|
|
116
118
|
};
|
|
117
119
|
const classes = useUtilityClasses(ownerState);
|
|
118
120
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(MarkElementPath, (0, _extends2.default)({}, other, {
|
|
121
|
+
style: {
|
|
122
|
+
transform: (0, _web.to)([position.x, position.y], (pX, pY) => `translate(${pX}px, ${pY}px)`),
|
|
123
|
+
transformOrigin: (0, _web.to)([position.x, position.y], (pX, pY) => `${pX}px ${pY}px`)
|
|
124
|
+
},
|
|
119
125
|
ownerState: ownerState,
|
|
120
126
|
className: classes.root,
|
|
121
|
-
d: (0, _d3Shape.symbol)(_d3Shape.symbolsFill[(0, _utils.getSymbol)(shape)])()
|
|
127
|
+
d: (0, _d3Shape.symbol)(_d3Shape.symbolsFill[(0, _utils.getSymbol)(shape)])(),
|
|
128
|
+
onClick: onClick,
|
|
129
|
+
cursor: onClick ? 'pointer' : 'unset'
|
|
122
130
|
}, getInteractionItemProps({
|
|
123
131
|
type: 'line',
|
|
124
132
|
seriesId: id,
|
|
@@ -139,8 +147,14 @@ process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
|
|
|
139
147
|
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
140
148
|
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
141
149
|
}),
|
|
150
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
142
151
|
/**
|
|
143
152
|
* The shape of the marker.
|
|
144
153
|
*/
|
|
145
|
-
shape: _propTypes.default.oneOf(['circle', 'cross', 'diamond', 'square', 'star', 'triangle', 'wye']).isRequired
|
|
154
|
+
shape: _propTypes.default.oneOf(['circle', 'cross', 'diamond', 'square', 'star', 'triangle', 'wye']).isRequired,
|
|
155
|
+
/**
|
|
156
|
+
* If `true`, animations are skipped.
|
|
157
|
+
* @default false
|
|
158
|
+
*/
|
|
159
|
+
skipAnimation: _propTypes.default.bool
|
|
146
160
|
} : void 0;
|
package/LineChart/MarkPlot.d.ts
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { MarkElementProps } from './MarkElement';
|
|
3
|
+
import { LineItemIdentifier } from '../models/seriesType/line';
|
|
3
4
|
export interface MarkPlotSlots {
|
|
4
5
|
mark?: React.JSXElementConstructor<MarkElementProps>;
|
|
5
6
|
}
|
|
6
7
|
export interface MarkPlotSlotProps {
|
|
7
8
|
mark?: Partial<MarkElementProps>;
|
|
8
9
|
}
|
|
9
|
-
export interface MarkPlotProps extends React.SVGAttributes<SVGSVGElement> {
|
|
10
|
+
export interface MarkPlotProps extends React.SVGAttributes<SVGSVGElement>, Pick<MarkElementProps, 'skipAnimation'> {
|
|
10
11
|
/**
|
|
11
12
|
* Overridable component slots.
|
|
12
13
|
* @default {}
|
|
@@ -17,6 +18,12 @@ export interface MarkPlotProps extends React.SVGAttributes<SVGSVGElement> {
|
|
|
17
18
|
* @default {}
|
|
18
19
|
*/
|
|
19
20
|
slotProps?: MarkPlotSlotProps;
|
|
21
|
+
/**
|
|
22
|
+
* Callback fired when a line mark item is clicked.
|
|
23
|
+
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
24
|
+
* @param {LineItemIdentifier} lineItemIdentifier The line mark item identifier.
|
|
25
|
+
*/
|
|
26
|
+
onItemClick?: (event: React.MouseEvent<SVGElement, MouseEvent>, lineItemIdentifier: LineItemIdentifier) => void;
|
|
20
27
|
}
|
|
21
28
|
/**
|
|
22
29
|
* Demos:
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -14,8 +14,10 @@ var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
|
14
14
|
var _MarkElement = require("./MarkElement");
|
|
15
15
|
var _useScale = require("../hooks/useScale");
|
|
16
16
|
var _constants = require("../constants");
|
|
17
|
+
var _DrawingProvider = require("../context/DrawingProvider");
|
|
18
|
+
var _utils = require("../internals/utils");
|
|
17
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["slots", "slotProps"];
|
|
20
|
+
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
19
21
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
22
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
21
23
|
/**
|
|
@@ -31,11 +33,16 @@ function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e;
|
|
|
31
33
|
function MarkPlot(props) {
|
|
32
34
|
const {
|
|
33
35
|
slots,
|
|
34
|
-
slotProps
|
|
36
|
+
slotProps,
|
|
37
|
+
skipAnimation,
|
|
38
|
+
onItemClick
|
|
35
39
|
} = props,
|
|
36
40
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
37
41
|
const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).line;
|
|
38
42
|
const axisData = React.useContext(_CartesianContextProvider.CartesianContext);
|
|
43
|
+
const {
|
|
44
|
+
chartId
|
|
45
|
+
} = React.useContext(_DrawingProvider.DrawingContext);
|
|
39
46
|
const Mark = slots?.mark ?? _MarkElement.MarkElement;
|
|
40
47
|
if (seriesData === undefined) {
|
|
41
48
|
return null;
|
|
@@ -56,7 +63,7 @@ function MarkPlot(props) {
|
|
|
56
63
|
children: stackingGroups.flatMap(({
|
|
57
64
|
ids: groupIds
|
|
58
65
|
}) => {
|
|
59
|
-
return groupIds.
|
|
66
|
+
return groupIds.map(seriesId => {
|
|
60
67
|
const {
|
|
61
68
|
xAxisKey = defaultXAxisId,
|
|
62
69
|
yAxisKey = defaultYAxisId,
|
|
@@ -87,59 +94,70 @@ function MarkPlot(props) {
|
|
|
87
94
|
if (xData === undefined) {
|
|
88
95
|
throw new Error(`MUI X Charts: ${xAxisKey === _constants.DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisKey}"`} should have data property to be able to display a line plot.`);
|
|
89
96
|
}
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
value
|
|
105
|
-
}) => {
|
|
106
|
-
if (value === null || y === null) {
|
|
107
|
-
// Remove missing data point
|
|
108
|
-
return false;
|
|
109
|
-
}
|
|
110
|
-
if (!isInRange({
|
|
111
|
-
x,
|
|
112
|
-
y
|
|
113
|
-
})) {
|
|
114
|
-
// Remove out of range
|
|
115
|
-
return false;
|
|
116
|
-
}
|
|
117
|
-
if (showMark === true) {
|
|
118
|
-
return true;
|
|
119
|
-
}
|
|
120
|
-
return showMark({
|
|
97
|
+
const clipId = (0, _utils.cleanId)(`${chartId}-${seriesId}-line-clip`); // We assume that if displaying line mark, the line will also be rendered
|
|
98
|
+
|
|
99
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
100
|
+
clipPath: `url(#${clipId})`,
|
|
101
|
+
children: xData?.map((x, index) => {
|
|
102
|
+
const value = data[index] == null ? null : stackedData[index][1];
|
|
103
|
+
return {
|
|
104
|
+
x: xScale(x),
|
|
105
|
+
y: value === null ? null : yScale(value),
|
|
106
|
+
position: x,
|
|
107
|
+
value,
|
|
108
|
+
index
|
|
109
|
+
};
|
|
110
|
+
}).filter(({
|
|
121
111
|
x,
|
|
122
112
|
y,
|
|
123
113
|
index,
|
|
124
114
|
position,
|
|
125
115
|
value
|
|
126
|
-
})
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
116
|
+
}) => {
|
|
117
|
+
if (value === null || y === null) {
|
|
118
|
+
// Remove missing data point
|
|
119
|
+
return false;
|
|
120
|
+
}
|
|
121
|
+
if (!isInRange({
|
|
122
|
+
x,
|
|
123
|
+
y
|
|
124
|
+
})) {
|
|
125
|
+
// Remove out of range
|
|
126
|
+
return false;
|
|
127
|
+
}
|
|
128
|
+
if (showMark === true) {
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
131
|
+
return showMark({
|
|
132
|
+
x,
|
|
133
|
+
y,
|
|
134
|
+
index,
|
|
135
|
+
position,
|
|
136
|
+
value
|
|
137
|
+
});
|
|
138
|
+
}).map(({
|
|
139
|
+
x,
|
|
140
|
+
y,
|
|
141
|
+
index
|
|
142
|
+
}) => {
|
|
143
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Mark, (0, _extends2.default)({
|
|
144
|
+
id: seriesId,
|
|
145
|
+
dataIndex: index,
|
|
146
|
+
shape: "circle",
|
|
147
|
+
color: series[seriesId].color,
|
|
148
|
+
x: x,
|
|
149
|
+
y: y // Don't know why TS doesn't get from the filter that y can't be null
|
|
150
|
+
,
|
|
151
|
+
highlightScope: series[seriesId].highlightScope,
|
|
152
|
+
skipAnimation: skipAnimation,
|
|
153
|
+
onClick: onItemClick && (event => onItemClick(event, {
|
|
154
|
+
type: 'line',
|
|
155
|
+
seriesId,
|
|
156
|
+
dataIndex: index
|
|
157
|
+
}))
|
|
158
|
+
}, slotProps?.mark), `${seriesId}-${index}`);
|
|
159
|
+
})
|
|
160
|
+
}, seriesId);
|
|
143
161
|
});
|
|
144
162
|
})
|
|
145
163
|
}));
|
|
@@ -149,6 +167,17 @@ process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
|
|
|
149
167
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
150
168
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
151
169
|
// ----------------------------------------------------------------------
|
|
170
|
+
/**
|
|
171
|
+
* Callback fired when a line mark item is clicked.
|
|
172
|
+
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
173
|
+
* @param {LineItemIdentifier} lineItemIdentifier The line mark item identifier.
|
|
174
|
+
*/
|
|
175
|
+
onItemClick: _propTypes.default.func,
|
|
176
|
+
/**
|
|
177
|
+
* If `true`, animations are skipped.
|
|
178
|
+
* @default false
|
|
179
|
+
*/
|
|
180
|
+
skipAnimation: _propTypes.default.bool,
|
|
152
181
|
/**
|
|
153
182
|
* The props used for each component slot.
|
|
154
183
|
* @default {}
|
package/LineChart/formatter.js
CHANGED
|
@@ -76,7 +76,7 @@ const formatter = (params, dataset) => {
|
|
|
76
76
|
return {
|
|
77
77
|
seriesOrder,
|
|
78
78
|
stackingGroups,
|
|
79
|
-
series: (0, _defaultizeValueFormatter.default)(completedSeries, v => v
|
|
79
|
+
series: (0, _defaultizeValueFormatter.default)(completedSeries, v => v == null ? '' : v.toLocaleString())
|
|
80
80
|
};
|
|
81
81
|
};
|
|
82
82
|
var _default = exports.default = formatter;
|
package/LineChart/index.d.ts
CHANGED
|
@@ -4,6 +4,8 @@ export * from './AreaPlot';
|
|
|
4
4
|
export * from './MarkPlot';
|
|
5
5
|
export * from './LineHighlightPlot';
|
|
6
6
|
export * from './AreaElement';
|
|
7
|
+
export * from './AnimatedArea';
|
|
7
8
|
export * from './LineElement';
|
|
9
|
+
export * from './AnimatedLine';
|
|
8
10
|
export * from './MarkElement';
|
|
9
11
|
export * from './LineHighlightElement';
|
package/LineChart/index.js
CHANGED
|
@@ -69,6 +69,17 @@ Object.keys(_AreaElement).forEach(function (key) {
|
|
|
69
69
|
}
|
|
70
70
|
});
|
|
71
71
|
});
|
|
72
|
+
var _AnimatedArea = require("./AnimatedArea");
|
|
73
|
+
Object.keys(_AnimatedArea).forEach(function (key) {
|
|
74
|
+
if (key === "default" || key === "__esModule") return;
|
|
75
|
+
if (key in exports && exports[key] === _AnimatedArea[key]) return;
|
|
76
|
+
Object.defineProperty(exports, key, {
|
|
77
|
+
enumerable: true,
|
|
78
|
+
get: function () {
|
|
79
|
+
return _AnimatedArea[key];
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
});
|
|
72
83
|
var _LineElement = require("./LineElement");
|
|
73
84
|
Object.keys(_LineElement).forEach(function (key) {
|
|
74
85
|
if (key === "default" || key === "__esModule") return;
|
|
@@ -80,6 +91,17 @@ Object.keys(_LineElement).forEach(function (key) {
|
|
|
80
91
|
}
|
|
81
92
|
});
|
|
82
93
|
});
|
|
94
|
+
var _AnimatedLine = require("./AnimatedLine");
|
|
95
|
+
Object.keys(_AnimatedLine).forEach(function (key) {
|
|
96
|
+
if (key === "default" || key === "__esModule") return;
|
|
97
|
+
if (key in exports && exports[key] === _AnimatedLine[key]) return;
|
|
98
|
+
Object.defineProperty(exports, key, {
|
|
99
|
+
enumerable: true,
|
|
100
|
+
get: function () {
|
|
101
|
+
return _AnimatedLine[key];
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
});
|
|
83
105
|
var _MarkElement = require("./MarkElement");
|
|
84
106
|
Object.keys(_MarkElement).forEach(function (key) {
|
|
85
107
|
if (key === "default" || key === "__esModule") return;
|
package/PieChart/PieArc.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SpringValue } from '@react-spring/web';
|
|
3
3
|
import { HighlightScope } from '../context/HighlightProvider';
|
|
4
|
+
import { PieItemId } from '../models';
|
|
4
5
|
export interface PieArcClasses {
|
|
5
6
|
/** Styles applied to the root element. */
|
|
6
7
|
root: string;
|
|
@@ -11,7 +12,7 @@ export interface PieArcClasses {
|
|
|
11
12
|
}
|
|
12
13
|
export type PieArcClassKey = keyof PieArcClasses;
|
|
13
14
|
interface PieArcOwnerState {
|
|
14
|
-
id:
|
|
15
|
+
id: PieItemId;
|
|
15
16
|
dataIndex: number;
|
|
16
17
|
color: string;
|
|
17
18
|
isFaded: boolean;
|
|
@@ -20,7 +21,7 @@ interface PieArcOwnerState {
|
|
|
20
21
|
}
|
|
21
22
|
export declare function getPieArcUtilityClass(slot: string): string;
|
|
22
23
|
export declare const pieArcClasses: PieArcClasses;
|
|
23
|
-
export type PieArcProps =
|
|
24
|
+
export type PieArcProps = Omit<React.ComponentPropsWithoutRef<'path'>, 'id'> & PieArcOwnerState & {
|
|
24
25
|
startAngle: SpringValue<number>;
|
|
25
26
|
endAngle: SpringValue<number>;
|
|
26
27
|
innerRadius: SpringValue<number>;
|
package/PieChart/PieArc.js
CHANGED
|
@@ -106,6 +106,7 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
106
106
|
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
107
107
|
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
108
108
|
}),
|
|
109
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
109
110
|
isFaded: _propTypes.default.bool.isRequired,
|
|
110
111
|
isHighlighted: _propTypes.default.bool.isRequired
|
|
111
112
|
} : void 0;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SpringValue } from '@react-spring/web';
|
|
3
|
+
import { PieItemId } from '../models/seriesType/pie';
|
|
3
4
|
export interface PieArcLabelClasses {
|
|
4
5
|
/** Styles applied to the root element. */
|
|
5
6
|
root: string;
|
|
@@ -10,7 +11,7 @@ export interface PieArcLabelClasses {
|
|
|
10
11
|
}
|
|
11
12
|
export type PieArcLabelClassKey = keyof PieArcLabelClasses;
|
|
12
13
|
interface PieArcLabelOwnerState {
|
|
13
|
-
id:
|
|
14
|
+
id: PieItemId;
|
|
14
15
|
color: string;
|
|
15
16
|
isFaded: boolean;
|
|
16
17
|
isHighlighted: boolean;
|
|
@@ -18,7 +19,7 @@ interface PieArcLabelOwnerState {
|
|
|
18
19
|
}
|
|
19
20
|
export declare function getPieArcLabelUtilityClass(slot: string): string;
|
|
20
21
|
export declare const pieArcLabelClasses: PieArcLabelClasses;
|
|
21
|
-
export type PieArcLabelProps = PieArcLabelOwnerState & React.ComponentPropsWithoutRef<'text'> & {
|
|
22
|
+
export type PieArcLabelProps = PieArcLabelOwnerState & Omit<React.ComponentPropsWithoutRef<'text'>, 'id'> & {
|
|
22
23
|
startAngle: SpringValue<number>;
|
|
23
24
|
endAngle: SpringValue<number>;
|
|
24
25
|
innerRadius: SpringValue<number>;
|
package/PieChart/PieArcLabel.js
CHANGED
|
@@ -109,6 +109,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
|
109
109
|
// ----------------------------------------------------------------------
|
|
110
110
|
classes: _propTypes.default.object,
|
|
111
111
|
formattedArcLabel: _propTypes.default.string,
|
|
112
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
112
113
|
isFaded: _propTypes.default.bool.isRequired,
|
|
113
114
|
isHighlighted: _propTypes.default.bool.isRequired
|
|
114
115
|
} : void 0;
|
|
@@ -24,7 +24,7 @@ export interface PieArcLabelPlotProps extends Pick<DefaultizedPieSeriesType, 'da
|
|
|
24
24
|
*/
|
|
25
25
|
slotProps?: PieArcLabelPlotSlotProps;
|
|
26
26
|
/**
|
|
27
|
-
* If `true`, animations are
|
|
27
|
+
* If `true`, animations are skipped.
|
|
28
28
|
* @default false
|
|
29
29
|
*/
|
|
30
30
|
skipAnimation?: boolean;
|
|
@@ -166,7 +166,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
166
166
|
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
167
167
|
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
168
168
|
}),
|
|
169
|
-
id: _propTypes.default.string.isRequired,
|
|
169
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
170
170
|
/**
|
|
171
171
|
* The radius between circle center and the begining of the arc.
|
|
172
172
|
* @default 0
|
|
@@ -182,7 +182,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
182
182
|
*/
|
|
183
183
|
paddingAngle: _propTypes.default.number,
|
|
184
184
|
/**
|
|
185
|
-
* If `true`, animations are
|
|
185
|
+
* If `true`, animations are skipped.
|
|
186
186
|
* @default false
|
|
187
187
|
*/
|
|
188
188
|
skipAnimation: _propTypes.default.bool,
|
package/PieChart/PieArcPlot.d.ts
CHANGED
|
@@ -29,9 +29,9 @@ export interface PieArcPlotProps extends Pick<DefaultizedPieSeriesType, 'data' |
|
|
|
29
29
|
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
30
30
|
* @param {DefaultizedPieValueType} item The pie item.
|
|
31
31
|
*/
|
|
32
|
-
|
|
32
|
+
onItemClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>, pieItemIdentifier: PieItemIdentifier, item: DefaultizedPieValueType) => void;
|
|
33
33
|
/**
|
|
34
|
-
* If `true`, animations are
|
|
34
|
+
* If `true`, animations are skipped.
|
|
35
35
|
* @default false
|
|
36
36
|
*/
|
|
37
37
|
skipAnimation?: boolean;
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -14,7 +14,7 @@ var _PieArc = require("./PieArc");
|
|
|
14
14
|
var _transition = require("./dataTransform/transition");
|
|
15
15
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "
|
|
17
|
+
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onItemClick", "skipAnimation"],
|
|
18
18
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
|
|
19
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -33,7 +33,7 @@ function PieArcPlot(props) {
|
|
|
33
33
|
additionalRadius: -5
|
|
34
34
|
},
|
|
35
35
|
data,
|
|
36
|
-
|
|
36
|
+
onItemClick,
|
|
37
37
|
skipAnimation
|
|
38
38
|
} = props,
|
|
39
39
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
@@ -80,8 +80,8 @@ function PieArcPlot(props) {
|
|
|
80
80
|
highlightScope: highlightScope,
|
|
81
81
|
isFaded: item.isFaded,
|
|
82
82
|
isHighlighted: item.isHighlighted,
|
|
83
|
-
onClick:
|
|
84
|
-
|
|
83
|
+
onClick: onItemClick && (event => {
|
|
84
|
+
onItemClick(event, {
|
|
85
85
|
type: 'pie',
|
|
86
86
|
seriesId: id,
|
|
87
87
|
dataIndex: index
|
|
@@ -146,7 +146,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
146
146
|
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
147
147
|
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
148
148
|
}),
|
|
149
|
-
id: _propTypes.default.string.isRequired,
|
|
149
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
150
150
|
/**
|
|
151
151
|
* The radius between circle center and the begining of the arc.
|
|
152
152
|
* @default 0
|
|
@@ -158,7 +158,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
158
158
|
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
159
159
|
* @param {DefaultizedPieValueType} item The pie item.
|
|
160
160
|
*/
|
|
161
|
-
|
|
161
|
+
onItemClick: _propTypes.default.func,
|
|
162
162
|
/**
|
|
163
163
|
* The radius between circle center and the end of the arc.
|
|
164
164
|
*/
|
|
@@ -169,7 +169,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
169
169
|
*/
|
|
170
170
|
paddingAngle: _propTypes.default.number,
|
|
171
171
|
/**
|
|
172
|
-
* If `true`, animations are
|
|
172
|
+
* If `true`, animations are skipped.
|
|
173
173
|
* @default false
|
|
174
174
|
*/
|
|
175
175
|
skipAnimation: _propTypes.default.bool,
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -33,7 +33,7 @@ export interface PieChartProps extends Omit<ResponsiveChartContainerProps, 'seri
|
|
|
33
33
|
* @deprecated Consider using `slotProps.legend` instead.
|
|
34
34
|
*/
|
|
35
35
|
legend?: ChartsLegendProps;
|
|
36
|
-
|
|
36
|
+
onItemClick?: PiePlotProps['onItemClick'];
|
|
37
37
|
slots?: PieChartSlots;
|
|
38
38
|
/**
|
|
39
39
|
* The props used for each component slot.
|
package/PieChart/PieChart.js
CHANGED
|
@@ -67,7 +67,7 @@ function PieChart(props) {
|
|
|
67
67
|
children,
|
|
68
68
|
slots,
|
|
69
69
|
slotProps,
|
|
70
|
-
|
|
70
|
+
onItemClick
|
|
71
71
|
} = props;
|
|
72
72
|
const margin = (0, _extends2.default)({}, defaultMargin, marginProps);
|
|
73
73
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
@@ -96,7 +96,7 @@ function PieChart(props) {
|
|
|
96
96
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_PiePlot.PiePlot, {
|
|
97
97
|
slots: slots,
|
|
98
98
|
slotProps: slotProps,
|
|
99
|
-
|
|
99
|
+
onItemClick: onItemClick,
|
|
100
100
|
skipAnimation: skipAnimation
|
|
101
101
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsLegend.ChartsLegend, (0, _extends2.default)({}, legend, {
|
|
102
102
|
slots: slots,
|
|
@@ -119,7 +119,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
119
119
|
* @default null
|
|
120
120
|
*/
|
|
121
121
|
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
122
|
-
axisId: _propTypes.default.string,
|
|
122
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
123
123
|
classes: _propTypes.default.object,
|
|
124
124
|
disableLine: _propTypes.default.bool,
|
|
125
125
|
disableTicks: _propTypes.default.bool,
|
|
@@ -169,7 +169,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
169
169
|
* @default null
|
|
170
170
|
*/
|
|
171
171
|
leftAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
172
|
-
axisId: _propTypes.default.string,
|
|
172
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
173
173
|
classes: _propTypes.default.object,
|
|
174
174
|
disableLine: _propTypes.default.bool,
|
|
175
175
|
disableTicks: _propTypes.default.bool,
|
|
@@ -216,14 +216,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
216
216
|
right: _propTypes.default.number,
|
|
217
217
|
top: _propTypes.default.number
|
|
218
218
|
}),
|
|
219
|
-
|
|
219
|
+
onItemClick: _propTypes.default.func,
|
|
220
220
|
/**
|
|
221
221
|
* Indicate which axis to display the right of the charts.
|
|
222
222
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
223
223
|
* @default null
|
|
224
224
|
*/
|
|
225
225
|
rightAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
226
|
-
axisId: _propTypes.default.string,
|
|
226
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
227
227
|
classes: _propTypes.default.object,
|
|
228
228
|
disableLine: _propTypes.default.bool,
|
|
229
229
|
disableTicks: _propTypes.default.bool,
|
|
@@ -246,7 +246,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
246
246
|
}), _propTypes.default.string]),
|
|
247
247
|
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
248
248
|
/**
|
|
249
|
-
* If `true`, animations are
|
|
249
|
+
* If `true`, animations are skipped.
|
|
250
250
|
* @default false
|
|
251
251
|
*/
|
|
252
252
|
skipAnimation: _propTypes.default.bool,
|
|
@@ -272,7 +272,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
272
272
|
* @default null
|
|
273
273
|
*/
|
|
274
274
|
topAxis: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
275
|
-
axisId: _propTypes.default.string,
|
|
275
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
276
276
|
classes: _propTypes.default.object,
|
|
277
277
|
disableLine: _propTypes.default.bool,
|
|
278
278
|
disableTicks: _propTypes.default.bool,
|
|
@@ -309,7 +309,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
309
309
|
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
310
310
|
*/
|
|
311
311
|
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
312
|
-
axisId: _propTypes.default.string,
|
|
312
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
313
313
|
classes: _propTypes.default.object,
|
|
314
314
|
data: _propTypes.default.array,
|
|
315
315
|
dataKey: _propTypes.default.string,
|
|
@@ -317,13 +317,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
317
317
|
disableTicks: _propTypes.default.bool,
|
|
318
318
|
fill: _propTypes.default.string,
|
|
319
319
|
hideTooltip: _propTypes.default.bool,
|
|
320
|
-
id: _propTypes.default.string,
|
|
320
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
321
321
|
label: _propTypes.default.string,
|
|
322
322
|
labelFontSize: _propTypes.default.number,
|
|
323
323
|
labelStyle: _propTypes.default.object,
|
|
324
324
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
325
325
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
326
326
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
327
|
+
reverse: _propTypes.default.bool,
|
|
327
328
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
328
329
|
slotProps: _propTypes.default.object,
|
|
329
330
|
slots: _propTypes.default.object,
|
|
@@ -343,7 +344,7 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
343
344
|
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
344
345
|
*/
|
|
345
346
|
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
346
|
-
axisId: _propTypes.default.string,
|
|
347
|
+
axisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
347
348
|
classes: _propTypes.default.object,
|
|
348
349
|
data: _propTypes.default.array,
|
|
349
350
|
dataKey: _propTypes.default.string,
|
|
@@ -351,13 +352,14 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
351
352
|
disableTicks: _propTypes.default.bool,
|
|
352
353
|
fill: _propTypes.default.string,
|
|
353
354
|
hideTooltip: _propTypes.default.bool,
|
|
354
|
-
id: _propTypes.default.string,
|
|
355
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
355
356
|
label: _propTypes.default.string,
|
|
356
357
|
labelFontSize: _propTypes.default.number,
|
|
357
358
|
labelStyle: _propTypes.default.object,
|
|
358
359
|
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
359
360
|
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
360
361
|
position: _propTypes.default.oneOf(['bottom', 'left', 'right', 'top']),
|
|
362
|
+
reverse: _propTypes.default.bool,
|
|
361
363
|
scaleType: _propTypes.default.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
362
364
|
slotProps: _propTypes.default.object,
|
|
363
365
|
slots: _propTypes.default.object,
|