@mui/x-charts 7.0.0-alpha.9 → 7.0.0-beta.1
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 +24 -23
- package/BarChart/BarElement.d.ts +1 -1
- package/BarChart/BarElement.js +6 -3
- package/BarChart/BarPlot.d.ts +8 -1
- package/BarChart/BarPlot.js +19 -5
- package/BarChart/formatter.js +1 -1
- package/CHANGELOG.md +386 -38
- package/ChartContainer/ChartContainer.d.ts +12 -0
- package/ChartContainer/ChartContainer.js +197 -0
- package/ChartContainer/index.d.ts +1 -11
- package/ChartContainer/index.js +9 -63
- 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/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +8 -59
- package/ChartsTooltip/ChartsItemTooltipContent.js +1 -11
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +8 -58
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -11
- package/ChartsTooltip/utils.d.ts +3 -1
- package/ChartsTooltip/utils.js +8 -0
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +7 -0
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- 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 +17 -17
- 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 +36 -29
- package/LineChart/LineElement.d.ts +17 -17
- package/LineChart/LineElement.js +16 -36
- package/LineChart/LineHighlightElement.js +3 -2
- package/LineChart/LinePlot.d.ts +12 -7
- package/LineChart/LinePlot.js +89 -56
- package/LineChart/MarkElement.d.ts +5 -2
- package/LineChart/MarkElement.js +26 -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/PieArcLabelPlot.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +1 -1
- package/PieChart/PieArcPlot.d.ts +2 -2
- package/PieChart/PieArcPlot.js +6 -6
- package/PieChart/PieChart.d.ts +1 -1
- package/PieChart/PieChart.js +5 -50
- package/PieChart/PiePlot.d.ts +1 -1
- package/PieChart/PiePlot.js +4 -4
- package/README.md +2 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +16 -0
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +250 -0
- package/ResponsiveChartContainer/index.d.ts +1 -15
- package/ResponsiveChartContainer/index.js +8 -113
- package/ScatterChart/Scatter.d.ts +7 -1
- package/ScatterChart/Scatter.js +18 -23
- package/ScatterChart/ScatterChart.d.ts +8 -2
- package/ScatterChart/ScatterChart.js +12 -22
- package/ScatterChart/ScatterPlot.d.ts +1 -1
- package/ScatterChart/ScatterPlot.js +10 -2
- package/SparkLineChart/SparkLineChart.js +2 -0
- 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 +24 -23
- package/esm/BarChart/BarElement.js +6 -3
- package/esm/BarChart/BarPlot.js +19 -5
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartContainer/ChartContainer.js +189 -0
- package/esm/ChartContainer/index.js +1 -61
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +77 -0
- package/esm/ChartsOnAxisClickHandler/index.js +1 -0
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +8 -59
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +1 -11
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +9 -58
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -11
- package/esm/ChartsTooltip/utils.js +6 -0
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- 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 +36 -29
- package/esm/LineChart/LineElement.js +16 -35
- package/esm/LineChart/LineHighlightElement.js +3 -2
- package/esm/LineChart/LinePlot.js +90 -57
- package/esm/LineChart/MarkElement.js +26 -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/PieArcLabelPlot.js +1 -1
- package/esm/PieChart/PieArcPlot.js +6 -6
- package/esm/PieChart/PieChart.js +5 -50
- package/esm/PieChart/PiePlot.js +4 -4
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +245 -0
- package/esm/ResponsiveChartContainer/index.js +1 -115
- package/esm/ScatterChart/Scatter.js +18 -23
- package/esm/ScatterChart/ScatterChart.js +12 -22
- package/esm/ScatterChart/ScatterPlot.js +10 -2
- package/esm/SparkLineChart/SparkLineChart.js +2 -0
- 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/geometry.js +1 -1
- 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 +24 -23
- package/legacy/BarChart/BarElement.js +5 -2
- package/legacy/BarChart/BarPlot.js +18 -4
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartContainer/ChartContainer.js +187 -0
- package/legacy/ChartContainer/index.js +1 -59
- package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +75 -0
- package/legacy/ChartsOnAxisClickHandler/index.js +1 -0
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +8 -61
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +1 -11
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +9 -58
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -11
- package/legacy/ChartsTooltip/utils.js +6 -0
- package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +88 -44
- 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 +36 -29
- package/legacy/LineChart/LineElement.js +15 -37
- package/legacy/LineChart/LineHighlightElement.js +3 -2
- package/legacy/LineChart/LinePlot.js +97 -63
- package/legacy/LineChart/MarkElement.js +29 -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/PieArcLabelPlot.js +1 -1
- package/legacy/PieChart/PieArcPlot.js +6 -6
- package/legacy/PieChart/PieChart.js +5 -50
- package/legacy/PieChart/PiePlot.js +4 -4
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +253 -0
- package/legacy/ResponsiveChartContainer/index.js +1 -123
- package/legacy/ScatterChart/Scatter.js +20 -23
- package/legacy/ScatterChart/ScatterChart.js +12 -22
- package/legacy/ScatterChart/ScatterPlot.js +10 -2
- package/legacy/SparkLineChart/SparkLineChart.js +2 -0
- 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/modern/BarChart/BarChart.js +24 -23
- package/modern/BarChart/BarElement.js +6 -3
- package/modern/BarChart/BarPlot.js +19 -5
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartContainer/ChartContainer.js +189 -0
- package/modern/ChartContainer/index.js +1 -61
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +75 -0
- package/modern/ChartsOnAxisClickHandler/index.js +1 -0
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +8 -59
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +1 -11
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +8 -58
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -11
- package/modern/ChartsTooltip/utils.js +6 -0
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +92 -44
- 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 +36 -29
- package/modern/LineChart/LineElement.js +16 -35
- package/modern/LineChart/LineHighlightElement.js +3 -2
- package/modern/LineChart/LinePlot.js +89 -56
- package/modern/LineChart/MarkElement.js +26 -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/PieArcLabelPlot.js +1 -1
- package/modern/PieChart/PieArcPlot.js +6 -6
- package/modern/PieChart/PieChart.js +5 -50
- package/modern/PieChart/PiePlot.js +4 -4
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +242 -0
- package/modern/ResponsiveChartContainer/index.js +1 -112
- package/modern/ScatterChart/Scatter.js +18 -23
- package/modern/ScatterChart/ScatterChart.js +12 -22
- package/modern/ScatterChart/ScatterPlot.js +10 -2
- package/modern/SparkLineChart/SparkLineChart.js +2 -0
- 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/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;
|
|
@@ -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;
|
|
@@ -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
|
|
@@ -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,
|
|
@@ -216,7 +216,7 @@ 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`.
|
|
@@ -244,54 +244,9 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
244
244
|
tickNumber: _propTypes.default.number,
|
|
245
245
|
tickSize: _propTypes.default.number
|
|
246
246
|
}), _propTypes.default.string]),
|
|
247
|
-
series: _propTypes.default.arrayOf(_propTypes.default.
|
|
248
|
-
arcLabel: _propTypes.default.oneOfType([_propTypes.default.oneOf(['formattedValue', 'label', 'value']), _propTypes.default.func]),
|
|
249
|
-
arcLabelMinAngle: _propTypes.default.number,
|
|
250
|
-
arcLabelRadius: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
251
|
-
color: _propTypes.default.string,
|
|
252
|
-
cornerRadius: _propTypes.default.number,
|
|
253
|
-
cx: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
254
|
-
cy: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
255
|
-
data: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
256
|
-
color: _propTypes.default.string,
|
|
257
|
-
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
258
|
-
label: _propTypes.default.string,
|
|
259
|
-
value: _propTypes.default.number.isRequired
|
|
260
|
-
})).isRequired,
|
|
261
|
-
endAngle: _propTypes.default.number,
|
|
262
|
-
faded: _propTypes.default.shape({
|
|
263
|
-
additionalRadius: _propTypes.default.number,
|
|
264
|
-
arcLabelRadius: _propTypes.default.number,
|
|
265
|
-
color: _propTypes.default.string,
|
|
266
|
-
cornerRadius: _propTypes.default.number,
|
|
267
|
-
innerRadius: _propTypes.default.number,
|
|
268
|
-
outerRadius: _propTypes.default.number,
|
|
269
|
-
paddingAngle: _propTypes.default.number
|
|
270
|
-
}),
|
|
271
|
-
highlighted: _propTypes.default.shape({
|
|
272
|
-
additionalRadius: _propTypes.default.number,
|
|
273
|
-
arcLabelRadius: _propTypes.default.number,
|
|
274
|
-
color: _propTypes.default.string,
|
|
275
|
-
cornerRadius: _propTypes.default.number,
|
|
276
|
-
innerRadius: _propTypes.default.number,
|
|
277
|
-
outerRadius: _propTypes.default.number,
|
|
278
|
-
paddingAngle: _propTypes.default.number
|
|
279
|
-
}),
|
|
280
|
-
highlightScope: _propTypes.default.shape({
|
|
281
|
-
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
282
|
-
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
283
|
-
}),
|
|
284
|
-
id: _propTypes.default.string,
|
|
285
|
-
innerRadius: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
286
|
-
outerRadius: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
287
|
-
paddingAngle: _propTypes.default.number,
|
|
288
|
-
sortingValues: _propTypes.default.oneOfType([_propTypes.default.oneOf(['asc', 'desc', 'none']), _propTypes.default.func]),
|
|
289
|
-
startAngle: _propTypes.default.number,
|
|
290
|
-
type: _propTypes.default.oneOf(['pie']),
|
|
291
|
-
valueFormatter: _propTypes.default.func
|
|
292
|
-
})).isRequired,
|
|
247
|
+
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
293
248
|
/**
|
|
294
|
-
* If `true`, animations are
|
|
249
|
+
* If `true`, animations are skipped.
|
|
295
250
|
* @default false
|
|
296
251
|
*/
|
|
297
252
|
skipAnimation: _propTypes.default.bool,
|
package/PieChart/PiePlot.d.ts
CHANGED
|
@@ -5,7 +5,7 @@ export interface PiePlotSlots extends PieArcPlotSlots, PieArcLabelPlotSlots {
|
|
|
5
5
|
}
|
|
6
6
|
export interface PiePlotSlotProps extends PieArcPlotSlotProps, PieArcLabelPlotSlotProps {
|
|
7
7
|
}
|
|
8
|
-
export interface PiePlotProps extends Pick<PieArcPlotProps, 'skipAnimation' | '
|
|
8
|
+
export interface PiePlotProps extends Pick<PieArcPlotProps, 'skipAnimation' | 'onItemClick'> {
|
|
9
9
|
/**
|
|
10
10
|
* Overridable component slots.
|
|
11
11
|
* @default {}
|
package/PieChart/PiePlot.js
CHANGED
|
@@ -30,7 +30,7 @@ function PiePlot(props) {
|
|
|
30
30
|
skipAnimation,
|
|
31
31
|
slots,
|
|
32
32
|
slotProps,
|
|
33
|
-
|
|
33
|
+
onItemClick
|
|
34
34
|
} = props;
|
|
35
35
|
const seriesData = React.useContext(_SeriesContextProvider.SeriesContext).pie;
|
|
36
36
|
const {
|
|
@@ -78,7 +78,7 @@ function PiePlot(props) {
|
|
|
78
78
|
highlightScope: highlightScope,
|
|
79
79
|
highlighted: highlighted,
|
|
80
80
|
faded: faded,
|
|
81
|
-
|
|
81
|
+
onItemClick: onItemClick,
|
|
82
82
|
slots: slots,
|
|
83
83
|
slotProps: slotProps
|
|
84
84
|
})
|
|
@@ -132,9 +132,9 @@ process.env.NODE_ENV !== "production" ? PiePlot.propTypes = {
|
|
|
132
132
|
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
133
133
|
* @param {DefaultizedPieValueType} item The pie item.
|
|
134
134
|
*/
|
|
135
|
-
|
|
135
|
+
onItemClick: _propTypes.default.func,
|
|
136
136
|
/**
|
|
137
|
-
* If `true`, animations are
|
|
137
|
+
* If `true`, animations are skipped.
|
|
138
138
|
* @default false
|
|
139
139
|
*/
|
|
140
140
|
skipAnimation: _propTypes.default.bool,
|
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
# MUI
|
|
1
|
+
# MUI X Charts
|
|
2
2
|
|
|
3
3
|
This package is the community edition of the chart components.
|
|
4
|
-
It's part of [MUI
|
|
4
|
+
It's part of [MUI X](https://mui.com/x/), an open-core extension of MUI Core, with advanced components.
|
|
5
5
|
|
|
6
6
|
## Installation
|
|
7
7
|
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartContainerProps } from '../ChartContainer';
|
|
3
|
+
export interface ResponsiveChartContainerProps extends Omit<ChartContainerProps, 'width' | 'height'> {
|
|
4
|
+
/**
|
|
5
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
6
|
+
* @default undefined
|
|
7
|
+
*/
|
|
8
|
+
width?: number;
|
|
9
|
+
/**
|
|
10
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
11
|
+
* @default undefined
|
|
12
|
+
*/
|
|
13
|
+
height?: number;
|
|
14
|
+
}
|
|
15
|
+
declare const ResponsiveChartContainer: React.ForwardRefExoticComponent<ResponsiveChartContainerProps & React.RefAttributes<unknown>>;
|
|
16
|
+
export { ResponsiveChartContainer };
|