@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
|
@@ -42,4 +42,11 @@ export function getPercentageValue(value, refValue) {
|
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
44
|
throw Error("MUI-Charts: Received an unknown value \"".concat(value, "\". It should be a number, or a string with a percentage value."));
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Remove spaces to have viable ids
|
|
49
|
+
*/
|
|
50
|
+
export function cleanId(id) {
|
|
51
|
+
return id.replace(' ', '_');
|
|
45
52
|
}
|
|
@@ -10,6 +10,7 @@ import { ChartsTooltip } from '../ChartsTooltip';
|
|
|
10
10
|
import { ChartsLegend } from '../ChartsLegend';
|
|
11
11
|
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
12
12
|
import { ChartsClipPath } from '../ChartsClipPath';
|
|
13
|
+
import { ChartsOnAxisClickHandler } from '../ChartsOnAxisClickHandler';
|
|
13
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
15
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
16
|
/**
|
|
@@ -43,6 +44,8 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
43
44
|
rightAxis,
|
|
44
45
|
bottomAxis,
|
|
45
46
|
skipAnimation,
|
|
47
|
+
onItemClick,
|
|
48
|
+
onAxisClick,
|
|
46
49
|
children,
|
|
47
50
|
slots,
|
|
48
51
|
slotProps
|
|
@@ -80,13 +83,16 @@ const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
|
80
83
|
colors: colors,
|
|
81
84
|
dataset: dataset,
|
|
82
85
|
sx: sx,
|
|
83
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
84
|
-
children: [/*#__PURE__*/_jsx(
|
|
86
|
+
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
87
|
+
children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
|
|
88
|
+
onAxisClick: onAxisClick
|
|
89
|
+
}), /*#__PURE__*/_jsx("g", {
|
|
85
90
|
clipPath: `url(#${clipPathId})`,
|
|
86
91
|
children: /*#__PURE__*/_jsx(BarPlot, {
|
|
87
92
|
slots: slots,
|
|
88
93
|
slotProps: slotProps,
|
|
89
|
-
skipAnimation: skipAnimation
|
|
94
|
+
skipAnimation: skipAnimation,
|
|
95
|
+
onItemClick: onItemClick
|
|
90
96
|
})
|
|
91
97
|
}), /*#__PURE__*/_jsx(ChartsAxis, {
|
|
92
98
|
topAxis: topAxis,
|
|
@@ -226,6 +232,19 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
226
232
|
right: PropTypes.number,
|
|
227
233
|
top: PropTypes.number
|
|
228
234
|
}),
|
|
235
|
+
/**
|
|
236
|
+
* The function called for onClick events.
|
|
237
|
+
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
238
|
+
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
239
|
+
* @param {null | AxisData} data The data about the clicked axis and items associated with it.
|
|
240
|
+
*/
|
|
241
|
+
onAxisClick: PropTypes.func,
|
|
242
|
+
/**
|
|
243
|
+
* Callback fired when a bar item is clicked.
|
|
244
|
+
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
245
|
+
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
246
|
+
*/
|
|
247
|
+
onItemClick: PropTypes.func,
|
|
229
248
|
/**
|
|
230
249
|
* Indicate which axis to display the right of the charts.
|
|
231
250
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -253,27 +272,9 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
253
272
|
tickNumber: PropTypes.number,
|
|
254
273
|
tickSize: PropTypes.number
|
|
255
274
|
}), PropTypes.string]),
|
|
256
|
-
series: PropTypes.arrayOf(PropTypes.
|
|
257
|
-
color: PropTypes.string,
|
|
258
|
-
data: PropTypes.arrayOf(PropTypes.number),
|
|
259
|
-
dataKey: PropTypes.string,
|
|
260
|
-
highlightScope: PropTypes.shape({
|
|
261
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
262
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
263
|
-
}),
|
|
264
|
-
id: PropTypes.string,
|
|
265
|
-
label: PropTypes.string,
|
|
266
|
-
layout: PropTypes.oneOf(['horizontal', 'vertical']),
|
|
267
|
-
stack: PropTypes.string,
|
|
268
|
-
stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
269
|
-
stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
270
|
-
type: PropTypes.oneOf(['bar']),
|
|
271
|
-
valueFormatter: PropTypes.func,
|
|
272
|
-
xAxisKey: PropTypes.string,
|
|
273
|
-
yAxisKey: PropTypes.string
|
|
274
|
-
})).isRequired,
|
|
275
|
+
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
275
276
|
/**
|
|
276
|
-
* If `true`, animations are
|
|
277
|
+
* If `true`, animations are skipped.
|
|
277
278
|
* @default false
|
|
278
279
|
*/
|
|
279
280
|
skipAnimation: PropTypes.bool,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style"];
|
|
3
|
+
const _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "slots", "slotProps", "style", "onClick"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
@@ -49,7 +49,8 @@ function BarElement(props) {
|
|
|
49
49
|
highlightScope,
|
|
50
50
|
slots,
|
|
51
51
|
slotProps,
|
|
52
|
-
style
|
|
52
|
+
style,
|
|
53
|
+
onClick
|
|
53
54
|
} = props,
|
|
54
55
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
55
56
|
const getInteractionItemProps = useInteractionItemProps(highlightScope);
|
|
@@ -85,7 +86,9 @@ function BarElement(props) {
|
|
|
85
86
|
dataIndex
|
|
86
87
|
}), {
|
|
87
88
|
style,
|
|
88
|
-
className: classes.root
|
|
89
|
+
className: classes.root,
|
|
90
|
+
onClick,
|
|
91
|
+
cursor: onClick ? 'pointer' : 'unset'
|
|
89
92
|
}),
|
|
90
93
|
ownerState
|
|
91
94
|
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["skipAnimation"];
|
|
3
|
+
const _excluded = ["skipAnimation", "onItemClick"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { useTransition } from '@react-spring/web';
|
|
@@ -38,7 +38,7 @@ function getBandSize({
|
|
|
38
38
|
offset
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
|
-
const
|
|
41
|
+
const useAggregatedData = () => {
|
|
42
42
|
const seriesData = React.useContext(SeriesContext).bar ?? {
|
|
43
43
|
series: {},
|
|
44
44
|
stackingGroups: [],
|
|
@@ -166,9 +166,10 @@ const getInStyle = ({
|
|
|
166
166
|
* - [BarPlot API](https://mui.com/x/api/charts/bar-plot/)
|
|
167
167
|
*/
|
|
168
168
|
function BarPlot(props) {
|
|
169
|
-
const completedData =
|
|
169
|
+
const completedData = useAggregatedData();
|
|
170
170
|
const {
|
|
171
|
-
skipAnimation
|
|
171
|
+
skipAnimation,
|
|
172
|
+
onItemClick
|
|
172
173
|
} = props,
|
|
173
174
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
174
175
|
const transition = useTransition(completedData, {
|
|
@@ -191,6 +192,13 @@ function BarPlot(props) {
|
|
|
191
192
|
highlightScope: highlightScope,
|
|
192
193
|
color: color
|
|
193
194
|
}, other, {
|
|
195
|
+
onClick: onItemClick && (event => {
|
|
196
|
+
onItemClick(event, {
|
|
197
|
+
type: 'bar',
|
|
198
|
+
seriesId,
|
|
199
|
+
dataIndex
|
|
200
|
+
});
|
|
201
|
+
}),
|
|
194
202
|
style: style
|
|
195
203
|
})))
|
|
196
204
|
});
|
|
@@ -201,7 +209,13 @@ process.env.NODE_ENV !== "production" ? BarPlot.propTypes = {
|
|
|
201
209
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
202
210
|
// ----------------------------------------------------------------------
|
|
203
211
|
/**
|
|
204
|
-
*
|
|
212
|
+
* Callback fired when a bar item is clicked.
|
|
213
|
+
* @param {React.MouseEvent<SVGElement, MouseEvent>} event The event source of the callback.
|
|
214
|
+
* @param {BarItemIdentifier} barItemIdentifier The bar item identifier.
|
|
215
|
+
*/
|
|
216
|
+
onItemClick: PropTypes.func,
|
|
217
|
+
/**
|
|
218
|
+
* If `true`, animations are skipped.
|
|
205
219
|
* @default false
|
|
206
220
|
*/
|
|
207
221
|
skipAnimation: PropTypes.bool,
|
|
@@ -65,7 +65,7 @@ const formatter = (params, dataset) => {
|
|
|
65
65
|
return {
|
|
66
66
|
seriesOrder,
|
|
67
67
|
stackingGroups,
|
|
68
|
-
series: defaultizeValueFormatter(completedSeries, v => v
|
|
68
|
+
series: defaultizeValueFormatter(completedSeries, v => v == null ? '' : v.toLocaleString())
|
|
69
69
|
};
|
|
70
70
|
};
|
|
71
71
|
export default formatter;
|
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
4
|
+
import { DrawingProvider } from '../context/DrawingProvider';
|
|
5
|
+
import { SeriesContextProvider } from '../context/SeriesContextProvider';
|
|
6
|
+
import { InteractionProvider } from '../context/InteractionProvider';
|
|
7
|
+
import { useReducedMotion } from '../hooks/useReducedMotion';
|
|
8
|
+
import { ChartsSurface } from '../ChartsSurface';
|
|
9
|
+
import { CartesianContextProvider } from '../context/CartesianContextProvider';
|
|
10
|
+
import { HighlightProvider } from '../context/HighlightProvider';
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
13
|
+
const {
|
|
14
|
+
width,
|
|
15
|
+
height,
|
|
16
|
+
series,
|
|
17
|
+
margin,
|
|
18
|
+
xAxis,
|
|
19
|
+
yAxis,
|
|
20
|
+
colors,
|
|
21
|
+
dataset,
|
|
22
|
+
sx,
|
|
23
|
+
title,
|
|
24
|
+
desc,
|
|
25
|
+
disableAxisListener,
|
|
26
|
+
children
|
|
27
|
+
} = props;
|
|
28
|
+
const svgRef = React.useRef(null);
|
|
29
|
+
const handleRef = useForkRef(ref, svgRef);
|
|
30
|
+
useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
|
|
31
|
+
|
|
32
|
+
return /*#__PURE__*/_jsx(DrawingProvider, {
|
|
33
|
+
width: width,
|
|
34
|
+
height: height,
|
|
35
|
+
margin: margin,
|
|
36
|
+
svgRef: svgRef,
|
|
37
|
+
children: /*#__PURE__*/_jsx(SeriesContextProvider, {
|
|
38
|
+
series: series,
|
|
39
|
+
colors: colors,
|
|
40
|
+
dataset: dataset,
|
|
41
|
+
children: /*#__PURE__*/_jsx(CartesianContextProvider, {
|
|
42
|
+
xAxis: xAxis,
|
|
43
|
+
yAxis: yAxis,
|
|
44
|
+
dataset: dataset,
|
|
45
|
+
children: /*#__PURE__*/_jsx(InteractionProvider, {
|
|
46
|
+
children: /*#__PURE__*/_jsx(HighlightProvider, {
|
|
47
|
+
children: /*#__PURE__*/_jsx(ChartsSurface, {
|
|
48
|
+
width: width,
|
|
49
|
+
height: height,
|
|
50
|
+
ref: handleRef,
|
|
51
|
+
sx: sx,
|
|
52
|
+
title: title,
|
|
53
|
+
desc: desc,
|
|
54
|
+
disableAxisListener: disableAxisListener,
|
|
55
|
+
children: children
|
|
56
|
+
})
|
|
57
|
+
})
|
|
58
|
+
})
|
|
59
|
+
})
|
|
60
|
+
})
|
|
61
|
+
});
|
|
62
|
+
});
|
|
63
|
+
process.env.NODE_ENV !== "production" ? ChartContainer.propTypes = {
|
|
64
|
+
// ----------------------------- Warning --------------------------------
|
|
65
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
66
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
67
|
+
// ----------------------------------------------------------------------
|
|
68
|
+
children: PropTypes.node,
|
|
69
|
+
className: PropTypes.string,
|
|
70
|
+
/**
|
|
71
|
+
* Color palette used to colorize multiple series.
|
|
72
|
+
* @default blueberryTwilightPalette
|
|
73
|
+
*/
|
|
74
|
+
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
75
|
+
/**
|
|
76
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
77
|
+
*/
|
|
78
|
+
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
79
|
+
desc: PropTypes.string,
|
|
80
|
+
/**
|
|
81
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
82
|
+
* It might break interactive features, but will improve performance.
|
|
83
|
+
* @default false
|
|
84
|
+
*/
|
|
85
|
+
disableAxisListener: PropTypes.bool,
|
|
86
|
+
/**
|
|
87
|
+
* The height of the chart in px.
|
|
88
|
+
*/
|
|
89
|
+
height: PropTypes.number.isRequired,
|
|
90
|
+
/**
|
|
91
|
+
* The margin between the SVG and the drawing area.
|
|
92
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
93
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
94
|
+
* @default object Depends on the charts type.
|
|
95
|
+
*/
|
|
96
|
+
margin: PropTypes.shape({
|
|
97
|
+
bottom: PropTypes.number,
|
|
98
|
+
left: PropTypes.number,
|
|
99
|
+
right: PropTypes.number,
|
|
100
|
+
top: PropTypes.number
|
|
101
|
+
}),
|
|
102
|
+
/**
|
|
103
|
+
* The array of series to display.
|
|
104
|
+
* Each type of series has its own specificity.
|
|
105
|
+
* Please refer to the appropriate docs page to learn more about it.
|
|
106
|
+
*/
|
|
107
|
+
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
108
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
109
|
+
title: PropTypes.string,
|
|
110
|
+
viewBox: PropTypes.shape({
|
|
111
|
+
height: PropTypes.number,
|
|
112
|
+
width: PropTypes.number,
|
|
113
|
+
x: PropTypes.number,
|
|
114
|
+
y: PropTypes.number
|
|
115
|
+
}),
|
|
116
|
+
/**
|
|
117
|
+
* The width of the chart in px.
|
|
118
|
+
*/
|
|
119
|
+
width: PropTypes.number.isRequired,
|
|
120
|
+
/**
|
|
121
|
+
* The configuration of the x-axes.
|
|
122
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
123
|
+
*/
|
|
124
|
+
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
125
|
+
axisId: PropTypes.string,
|
|
126
|
+
classes: PropTypes.object,
|
|
127
|
+
data: PropTypes.array,
|
|
128
|
+
dataKey: PropTypes.string,
|
|
129
|
+
disableLine: PropTypes.bool,
|
|
130
|
+
disableTicks: PropTypes.bool,
|
|
131
|
+
fill: PropTypes.string,
|
|
132
|
+
hideTooltip: PropTypes.bool,
|
|
133
|
+
id: PropTypes.string,
|
|
134
|
+
label: PropTypes.string,
|
|
135
|
+
labelFontSize: PropTypes.number,
|
|
136
|
+
labelStyle: PropTypes.object,
|
|
137
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
138
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
139
|
+
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
140
|
+
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
141
|
+
slotProps: PropTypes.object,
|
|
142
|
+
slots: PropTypes.object,
|
|
143
|
+
stroke: PropTypes.string,
|
|
144
|
+
tickFontSize: PropTypes.number,
|
|
145
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
146
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
147
|
+
tickLabelStyle: PropTypes.object,
|
|
148
|
+
tickMaxStep: PropTypes.number,
|
|
149
|
+
tickMinStep: PropTypes.number,
|
|
150
|
+
tickNumber: PropTypes.number,
|
|
151
|
+
tickSize: PropTypes.number,
|
|
152
|
+
valueFormatter: PropTypes.func
|
|
153
|
+
})),
|
|
154
|
+
/**
|
|
155
|
+
* The configuration of the y-axes.
|
|
156
|
+
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
157
|
+
*/
|
|
158
|
+
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
159
|
+
axisId: PropTypes.string,
|
|
160
|
+
classes: PropTypes.object,
|
|
161
|
+
data: PropTypes.array,
|
|
162
|
+
dataKey: PropTypes.string,
|
|
163
|
+
disableLine: PropTypes.bool,
|
|
164
|
+
disableTicks: PropTypes.bool,
|
|
165
|
+
fill: PropTypes.string,
|
|
166
|
+
hideTooltip: PropTypes.bool,
|
|
167
|
+
id: PropTypes.string,
|
|
168
|
+
label: PropTypes.string,
|
|
169
|
+
labelFontSize: PropTypes.number,
|
|
170
|
+
labelStyle: PropTypes.object,
|
|
171
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
172
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
173
|
+
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
174
|
+
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
175
|
+
slotProps: PropTypes.object,
|
|
176
|
+
slots: PropTypes.object,
|
|
177
|
+
stroke: PropTypes.string,
|
|
178
|
+
tickFontSize: PropTypes.number,
|
|
179
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
180
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
181
|
+
tickLabelStyle: PropTypes.object,
|
|
182
|
+
tickMaxStep: PropTypes.number,
|
|
183
|
+
tickMinStep: PropTypes.number,
|
|
184
|
+
tickNumber: PropTypes.number,
|
|
185
|
+
tickSize: PropTypes.number,
|
|
186
|
+
valueFormatter: PropTypes.func
|
|
187
|
+
}))
|
|
188
|
+
} : void 0;
|
|
189
|
+
export { ChartContainer };
|
|
@@ -1,61 +1 @@
|
|
|
1
|
-
|
|
2
|
-
import useForkRef from '@mui/utils/useForkRef';
|
|
3
|
-
import { DrawingProvider } from '../context/DrawingProvider';
|
|
4
|
-
import { SeriesContextProvider } from '../context/SeriesContextProvider';
|
|
5
|
-
import { InteractionProvider } from '../context/InteractionProvider';
|
|
6
|
-
import { useReducedMotion } from '../hooks/useReducedMotion';
|
|
7
|
-
import { ChartsSurface } from '../ChartsSurface';
|
|
8
|
-
import { CartesianContextProvider } from '../context/CartesianContextProvider';
|
|
9
|
-
import { HighlightProvider } from '../context/HighlightProvider';
|
|
10
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
|
-
export const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
12
|
-
const {
|
|
13
|
-
width,
|
|
14
|
-
height,
|
|
15
|
-
series,
|
|
16
|
-
margin,
|
|
17
|
-
xAxis,
|
|
18
|
-
yAxis,
|
|
19
|
-
colors,
|
|
20
|
-
dataset,
|
|
21
|
-
sx,
|
|
22
|
-
title,
|
|
23
|
-
desc,
|
|
24
|
-
disableAxisListener,
|
|
25
|
-
children
|
|
26
|
-
} = props;
|
|
27
|
-
const svgRef = React.useRef(null);
|
|
28
|
-
const handleRef = useForkRef(ref, svgRef);
|
|
29
|
-
useReducedMotion(); // a11y reduce motion (see: https://react-spring.dev/docs/utilities/use-reduced-motion)
|
|
30
|
-
|
|
31
|
-
return /*#__PURE__*/_jsx(DrawingProvider, {
|
|
32
|
-
width: width,
|
|
33
|
-
height: height,
|
|
34
|
-
margin: margin,
|
|
35
|
-
svgRef: svgRef,
|
|
36
|
-
children: /*#__PURE__*/_jsx(SeriesContextProvider, {
|
|
37
|
-
series: series,
|
|
38
|
-
colors: colors,
|
|
39
|
-
dataset: dataset,
|
|
40
|
-
children: /*#__PURE__*/_jsx(CartesianContextProvider, {
|
|
41
|
-
xAxis: xAxis,
|
|
42
|
-
yAxis: yAxis,
|
|
43
|
-
dataset: dataset,
|
|
44
|
-
children: /*#__PURE__*/_jsx(InteractionProvider, {
|
|
45
|
-
children: /*#__PURE__*/_jsx(HighlightProvider, {
|
|
46
|
-
children: /*#__PURE__*/_jsx(ChartsSurface, {
|
|
47
|
-
width: width,
|
|
48
|
-
height: height,
|
|
49
|
-
ref: handleRef,
|
|
50
|
-
sx: sx,
|
|
51
|
-
title: title,
|
|
52
|
-
desc: desc,
|
|
53
|
-
disableAxisListener: disableAxisListener,
|
|
54
|
-
children: children
|
|
55
|
-
})
|
|
56
|
-
})
|
|
57
|
-
})
|
|
58
|
-
})
|
|
59
|
-
})
|
|
60
|
-
});
|
|
61
|
-
});
|
|
1
|
+
export * from './ChartContainer';
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { SVGContext } from '../context/DrawingProvider';
|
|
4
|
+
import { InteractionContext } from '../context/InteractionProvider';
|
|
5
|
+
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
6
|
+
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
function ChartsOnAxisClickHandler(props) {
|
|
9
|
+
const {
|
|
10
|
+
onAxisClick
|
|
11
|
+
} = props;
|
|
12
|
+
const svgRef = React.useContext(SVGContext);
|
|
13
|
+
const series = React.useContext(SeriesContext);
|
|
14
|
+
const {
|
|
15
|
+
axis
|
|
16
|
+
} = React.useContext(InteractionContext);
|
|
17
|
+
const {
|
|
18
|
+
xAxisIds,
|
|
19
|
+
xAxis,
|
|
20
|
+
yAxisIds,
|
|
21
|
+
yAxis
|
|
22
|
+
} = React.useContext(CartesianContext);
|
|
23
|
+
React.useEffect(() => {
|
|
24
|
+
const element = svgRef.current;
|
|
25
|
+
if (element === null || !onAxisClick) {
|
|
26
|
+
return () => {};
|
|
27
|
+
}
|
|
28
|
+
const handleMouseClick = event => {
|
|
29
|
+
event.preventDefault();
|
|
30
|
+
const isXaxis = (axis.x && axis.x.index) !== undefined;
|
|
31
|
+
const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
|
|
32
|
+
const dataIndex = isXaxis ? axis.x && axis.x.index : axis.y && axis.y.index;
|
|
33
|
+
if (dataIndex == null) {
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const seriesValues = {};
|
|
37
|
+
Object.keys(series).filter(seriesType => ['bar', 'line'].includes(seriesType)).forEach(seriesType => {
|
|
38
|
+
series[seriesType]?.seriesOrder.forEach(seriesId => {
|
|
39
|
+
const seriesItem = series[seriesType].series[seriesId];
|
|
40
|
+
const axisKey = isXaxis ? seriesItem.xAxisKey : seriesItem.yAxisKey;
|
|
41
|
+
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
42
|
+
seriesValues[seriesId] = seriesItem.data[dataIndex];
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
});
|
|
46
|
+
const axisValue = (isXaxis ? xAxis : yAxis)[USED_AXIS_ID].data?.[dataIndex];
|
|
47
|
+
onAxisClick(event, {
|
|
48
|
+
dataIndex,
|
|
49
|
+
axisValue,
|
|
50
|
+
seriesValues
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
element.addEventListener('click', handleMouseClick);
|
|
54
|
+
return () => {
|
|
55
|
+
element.removeEventListener('click', handleMouseClick);
|
|
56
|
+
};
|
|
57
|
+
}, [axis.x, axis.y, onAxisClick, series, svgRef, xAxis, xAxisIds, yAxis, yAxisIds]);
|
|
58
|
+
|
|
59
|
+
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
60
|
+
return /*#__PURE__*/_jsx(React.Fragment, {});
|
|
61
|
+
}
|
|
62
|
+
process.env.NODE_ENV !== "production" ? ChartsOnAxisClickHandler.propTypes = {
|
|
63
|
+
// ----------------------------- Warning --------------------------------
|
|
64
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
65
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
66
|
+
// ----------------------------------------------------------------------
|
|
67
|
+
/**
|
|
68
|
+
* The function called for onClick events.
|
|
69
|
+
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
70
|
+
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
71
|
+
* @param {null | AxisData} data The data about the clicked axis and items associated with it.
|
|
72
|
+
*/
|
|
73
|
+
onAxisClick: PropTypes.func
|
|
74
|
+
} : void 0;
|
|
75
|
+
export { ChartsOnAxisClickHandler };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChartsOnAxisClickHandler';
|
|
@@ -69,7 +69,7 @@ function ChartsXReferenceLine(props) {
|
|
|
69
69
|
if (process.env.NODE_ENV !== 'production') {
|
|
70
70
|
if (!warnedOnce) {
|
|
71
71
|
warnedOnce = true;
|
|
72
|
-
console.error(`MUI X: the value ${x} does not exist in the data of x axis with id ${axisId}.`);
|
|
72
|
+
console.error(`MUI X Charts: the value ${x} does not exist in the data of x axis with id ${axisId}.`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return null;
|
|
@@ -69,7 +69,7 @@ function ChartsYReferenceLine(props) {
|
|
|
69
69
|
if (process.env.NODE_ENV !== 'production') {
|
|
70
70
|
if (!warnedOnce) {
|
|
71
71
|
warnedOnce = true;
|
|
72
|
-
console.error(`MUI X: the value ${y} does not exist in the data of y axis with id ${axisId}.`);
|
|
72
|
+
console.error(`MUI X Charts: the value ${y} does not exist in the data of y axis with id ${axisId}.`);
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
return null;
|
|
@@ -5,6 +5,7 @@ import { useSlotProps } from '@mui/base/utils';
|
|
|
5
5
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
6
6
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
7
7
|
import { DefaultChartsAxisTooltipContent } from './DefaultChartsAxisTooltipContent';
|
|
8
|
+
import { isCartesianSeriesType } from './utils';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
10
|
function ChartsAxisTooltipContent(props) {
|
|
10
11
|
const {
|
|
@@ -27,7 +28,7 @@ function ChartsAxisTooltipContent(props) {
|
|
|
27
28
|
const USED_AXIS_ID = isXaxis ? xAxisIds[0] : yAxisIds[0];
|
|
28
29
|
const relevantSeries = React.useMemo(() => {
|
|
29
30
|
const rep = [];
|
|
30
|
-
Object.keys(series).filter(
|
|
31
|
+
Object.keys(series).filter(isCartesianSeriesType).forEach(seriesType => {
|
|
31
32
|
series[seriesType].seriesOrder.forEach(seriesId => {
|
|
32
33
|
const item = series[seriesType].series[seriesId];
|
|
33
34
|
const axisKey = isXaxis ? item.xAxisKey : item.yAxisKey;
|
|
@@ -66,83 +67,31 @@ process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
|
66
67
|
axisData: PropTypes.shape({
|
|
67
68
|
x: PropTypes.shape({
|
|
68
69
|
index: PropTypes.number,
|
|
69
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
|
|
70
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
70
71
|
}),
|
|
71
72
|
y: PropTypes.shape({
|
|
72
73
|
index: PropTypes.number,
|
|
73
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
|
|
74
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
74
75
|
})
|
|
75
76
|
}).isRequired,
|
|
76
77
|
classes: PropTypes.object.isRequired,
|
|
77
78
|
content: PropTypes.elementType,
|
|
78
79
|
contentProps: PropTypes.shape({
|
|
79
|
-
axis: PropTypes.
|
|
80
|
-
axisId: PropTypes.string,
|
|
81
|
-
classes: PropTypes.object,
|
|
82
|
-
data: PropTypes.array,
|
|
83
|
-
dataKey: PropTypes.string,
|
|
84
|
-
disableLine: PropTypes.bool,
|
|
85
|
-
disableTicks: PropTypes.bool,
|
|
86
|
-
fill: PropTypes.string,
|
|
87
|
-
hideTooltip: PropTypes.bool,
|
|
88
|
-
id: PropTypes.string.isRequired,
|
|
89
|
-
label: PropTypes.string,
|
|
90
|
-
labelFontSize: PropTypes.number,
|
|
91
|
-
labelStyle: PropTypes.object,
|
|
92
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
93
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
94
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
95
|
-
scale: PropTypes.func.isRequired,
|
|
96
|
-
scaleType: PropTypes.oneOf(['time']).isRequired,
|
|
97
|
-
slotProps: PropTypes.object,
|
|
98
|
-
slots: PropTypes.object,
|
|
99
|
-
stroke: PropTypes.string,
|
|
100
|
-
tickFontSize: PropTypes.number,
|
|
101
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
102
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
103
|
-
tickLabelStyle: PropTypes.object,
|
|
104
|
-
tickMaxStep: PropTypes.number,
|
|
105
|
-
tickMinStep: PropTypes.number,
|
|
106
|
-
tickNumber: PropTypes.number.isRequired,
|
|
107
|
-
tickSize: PropTypes.number,
|
|
108
|
-
valueFormatter: PropTypes.func
|
|
109
|
-
}),
|
|
80
|
+
axis: PropTypes.object,
|
|
110
81
|
axisData: PropTypes.shape({
|
|
111
82
|
x: PropTypes.shape({
|
|
112
83
|
index: PropTypes.number,
|
|
113
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
|
|
84
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
114
85
|
}),
|
|
115
86
|
y: PropTypes.shape({
|
|
116
87
|
index: PropTypes.number,
|
|
117
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired
|
|
88
|
+
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
118
89
|
})
|
|
119
90
|
}),
|
|
120
91
|
axisValue: PropTypes.any,
|
|
121
92
|
classes: PropTypes.object,
|
|
122
93
|
dataIndex: PropTypes.number,
|
|
123
|
-
series: PropTypes.arrayOf(PropTypes.
|
|
124
|
-
area: PropTypes.bool,
|
|
125
|
-
color: PropTypes.string.isRequired,
|
|
126
|
-
connectNulls: PropTypes.bool,
|
|
127
|
-
curve: PropTypes.oneOf(['catmullRom', 'linear', 'monotoneX', 'monotoneY', 'natural', 'step', 'stepAfter', 'stepBefore']),
|
|
128
|
-
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
129
|
-
dataKey: PropTypes.string,
|
|
130
|
-
disableHighlight: PropTypes.bool,
|
|
131
|
-
highlightScope: PropTypes.shape({
|
|
132
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
133
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
134
|
-
}),
|
|
135
|
-
id: PropTypes.string.isRequired,
|
|
136
|
-
label: PropTypes.string,
|
|
137
|
-
showMark: PropTypes.oneOfType([PropTypes.func, PropTypes.bool]),
|
|
138
|
-
stack: PropTypes.string,
|
|
139
|
-
stackOffset: PropTypes.oneOf(['diverging', 'expand', 'none', 'silhouette', 'wiggle']),
|
|
140
|
-
stackOrder: PropTypes.oneOf(['appearance', 'ascending', 'descending', 'insideOut', 'none', 'reverse']),
|
|
141
|
-
type: PropTypes.oneOf(['line']).isRequired,
|
|
142
|
-
valueFormatter: PropTypes.func.isRequired,
|
|
143
|
-
xAxisKey: PropTypes.string,
|
|
144
|
-
yAxisKey: PropTypes.string
|
|
145
|
-
})),
|
|
94
|
+
series: PropTypes.arrayOf(PropTypes.object),
|
|
146
95
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
147
96
|
}),
|
|
148
97
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
@@ -42,17 +42,7 @@ process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
|
|
|
42
42
|
seriesId: PropTypes.string.isRequired,
|
|
43
43
|
type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
|
|
44
44
|
}),
|
|
45
|
-
series: PropTypes.
|
|
46
|
-
color: PropTypes.string,
|
|
47
|
-
data: PropTypes.arrayOf(PropTypes.number).isRequired,
|
|
48
|
-
highlightScope: PropTypes.shape({
|
|
49
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
50
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
51
|
-
}),
|
|
52
|
-
id: PropTypes.string.isRequired,
|
|
53
|
-
type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired,
|
|
54
|
-
valueFormatter: PropTypes.func.isRequired
|
|
55
|
-
}),
|
|
45
|
+
series: PropTypes.object,
|
|
56
46
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
57
47
|
}),
|
|
58
48
|
itemData: PropTypes.shape({
|