@mui/x-charts 7.0.0-beta.3 → 7.0.0-beta.4
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.js +0 -2
- package/CHANGELOG.md +226 -15
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsTooltip/utils.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
- package/ChartsXAxis/ChartsXAxis.js +1 -1
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/Gauge/Gauge.js +0 -2
- package/Gauge/GaugeContainer.d.ts +0 -2
- package/Gauge/GaugeContainer.js +0 -2
- package/Gauge/GaugeProvider.js +3 -0
- package/Gauge/GaugeValueText.js +1 -1
- package/LineChart/LineChart.js +0 -2
- package/PieChart/PieChart.js +0 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/ScatterChart/ScatterChart.js +0 -3
- package/SparkLineChart/SparkLineChart.js +0 -2
- package/context/CartesianContextProvider.d.ts +0 -8
- package/context/CartesianContextProvider.js +4 -89
- package/context/DrawingProvider.d.ts +2 -11
- package/context/DrawingProvider.js +10 -35
- package/context/HighlightProvider.js +3 -0
- package/context/InteractionProvider.js +3 -0
- package/context/SeriesContextProvider.js +3 -0
- package/context/index.d.ts +0 -2
- package/context/index.js +1 -15
- package/esm/BarChart/BarChart.js +0 -2
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsTooltip/utils.js +2 -2
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/Gauge/Gauge.js +0 -2
- package/esm/Gauge/GaugeContainer.js +0 -2
- package/esm/Gauge/GaugeProvider.js +3 -0
- package/esm/Gauge/GaugeValueText.js +1 -1
- package/esm/LineChart/LineChart.js +0 -2
- package/esm/PieChart/PieChart.js +0 -2
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/esm/ScatterChart/ScatterChart.js +0 -3
- package/esm/SparkLineChart/SparkLineChart.js +0 -2
- package/esm/context/CartesianContextProvider.js +3 -88
- package/esm/context/DrawingProvider.js +10 -36
- package/esm/context/HighlightProvider.js +3 -0
- package/esm/context/InteractionProvider.js +3 -0
- package/esm/context/SeriesContextProvider.js +3 -0
- package/esm/context/index.js +1 -2
- package/esm/hooks/useAxisEvents.js +2 -2
- package/hooks/useAxisEvents.js +1 -1
- package/hooks/useTicks.d.ts +1 -1
- package/index.js +1 -1
- package/modern/BarChart/BarChart.js +0 -2
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/utils.js +2 -2
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/Gauge/Gauge.js +0 -2
- package/modern/Gauge/GaugeContainer.js +0 -2
- package/modern/Gauge/GaugeProvider.js +3 -0
- package/modern/Gauge/GaugeValueText.js +1 -1
- package/modern/LineChart/LineChart.js +0 -2
- package/modern/PieChart/PieChart.js +0 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -2
- package/modern/ScatterChart/ScatterChart.js +0 -3
- package/modern/SparkLineChart/SparkLineChart.js +0 -2
- package/modern/context/CartesianContextProvider.js +3 -88
- package/modern/context/DrawingProvider.js +10 -36
- package/modern/context/HighlightProvider.js +3 -0
- package/modern/context/InteractionProvider.js +3 -0
- package/modern/context/SeriesContextProvider.js +3 -0
- package/modern/context/index.js +1 -2
- package/modern/hooks/useAxisEvents.js +2 -2
- package/modern/index.js +1 -1
- package/package.json +1 -1
- package/legacy/BarChart/BarChart.js +0 -440
- package/legacy/BarChart/BarElement.js +0 -119
- package/legacy/BarChart/BarPlot.js +0 -232
- package/legacy/BarChart/extremums.js +0 -45
- package/legacy/BarChart/formatter.js +0 -78
- package/legacy/BarChart/index.js +0 -3
- package/legacy/BarChart/legend.js +0 -15
- package/legacy/ChartContainer/ChartContainer.js +0 -189
- package/legacy/ChartContainer/index.js +0 -1
- package/legacy/ChartsAxis/ChartsAxis.js +0 -215
- package/legacy/ChartsAxis/axisClasses.js +0 -5
- package/legacy/ChartsAxis/index.js +0 -2
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
- package/legacy/ChartsAxisHighlight/index.js +0 -1
- package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
- package/legacy/ChartsClipPath/index.js +0 -1
- package/legacy/ChartsGrid/ChartsGrid.js +0 -119
- package/legacy/ChartsGrid/chartsGridClasses.js +0 -6
- package/legacy/ChartsGrid/index.js +0 -2
- package/legacy/ChartsLegend/ChartsLegend.js +0 -100
- package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
- package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
- package/legacy/ChartsLegend/index.js +0 -4
- package/legacy/ChartsLegend/utils.js +0 -15
- package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
- package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
- package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
- package/legacy/ChartsReferenceLine/common.js +0 -19
- package/legacy/ChartsReferenceLine/index.js +0 -2
- package/legacy/ChartsSurface.js +0 -78
- package/legacy/ChartsText/ChartsText.js +0 -95
- package/legacy/ChartsText/index.js +0 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
- package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
- package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
- package/legacy/ChartsTooltip/index.js +0 -6
- package/legacy/ChartsTooltip/utils.js +0 -103
- package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
- package/legacy/ChartsVoronoiHandler/index.js +0 -1
- package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
- package/legacy/ChartsXAxis/index.js +0 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
- package/legacy/ChartsYAxis/index.js +0 -1
- package/legacy/Gauge/Gauge.js +0 -146
- package/legacy/Gauge/GaugeContainer.js +0 -215
- package/legacy/Gauge/GaugeProvider.js +0 -87
- package/legacy/Gauge/GaugeReferenceArc.js +0 -37
- package/legacy/Gauge/GaugeValueArc.js +0 -44
- package/legacy/Gauge/GaugeValueText.js +0 -66
- package/legacy/Gauge/gaugeClasses.js +0 -7
- package/legacy/Gauge/index.js +0 -7
- package/legacy/Gauge/utils.js +0 -84
- package/legacy/LineChart/AnimatedArea.js +0 -102
- package/legacy/LineChart/AnimatedLine.js +0 -104
- package/legacy/LineChart/AreaElement.js +0 -112
- package/legacy/LineChart/AreaPlot.js +0 -149
- package/legacy/LineChart/LineChart.js +0 -452
- package/legacy/LineChart/LineElement.js +0 -112
- package/legacy/LineChart/LineHighlightElement.js +0 -79
- package/legacy/LineChart/LineHighlightPlot.js +0 -97
- package/legacy/LineChart/LinePlot.js +0 -144
- package/legacy/LineChart/MarkElement.js +0 -153
- package/legacy/LineChart/MarkPlot.js +0 -178
- package/legacy/LineChart/extremums.js +0 -54
- package/legacy/LineChart/formatter.js +0 -82
- package/legacy/LineChart/index.js +0 -11
- package/legacy/LineChart/legend.js +0 -15
- package/legacy/PieChart/PieArc.js +0 -103
- package/legacy/PieChart/PieArcLabel.js +0 -112
- package/legacy/PieChart/PieArcLabelPlot.js +0 -193
- package/legacy/PieChart/PieArcPlot.js +0 -180
- package/legacy/PieChart/PieChart.js +0 -404
- package/legacy/PieChart/PiePlot.js +0 -137
- package/legacy/PieChart/dataTransform/transition.js +0 -149
- package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
- package/legacy/PieChart/formatter.js +0 -55
- package/legacy/PieChart/index.js +0 -6
- package/legacy/PieChart/legend.js +0 -16
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -185
- package/legacy/ResponsiveChartContainer/index.js +0 -1
- package/legacy/ResponsiveChartContainer/useChartContainerDimensions.js +0 -73
- package/legacy/ScatterChart/Scatter.js +0 -110
- package/legacy/ScatterChart/ScatterChart.js +0 -395
- package/legacy/ScatterChart/ScatterPlot.js +0 -80
- package/legacy/ScatterChart/extremums.js +0 -39
- package/legacy/ScatterChart/formatter.js +0 -12
- package/legacy/ScatterChart/index.js +0 -3
- package/legacy/ScatterChart/legend.js +0 -15
- package/legacy/SparkLineChart/SparkLineChart.js +0 -266
- package/legacy/SparkLineChart/index.js +0 -1
- package/legacy/colorPalettes/colorPalettes.js +0 -15
- package/legacy/colorPalettes/index.js +0 -1
- package/legacy/constants.js +0 -8
- package/legacy/context/CartesianContextProvider.js +0 -327
- package/legacy/context/DrawingProvider.js +0 -74
- package/legacy/context/HighlightProvider.js +0 -56
- package/legacy/context/InteractionProvider.js +0 -81
- package/legacy/context/SeriesContextProvider.js +0 -74
- package/legacy/context/index.js +0 -2
- package/legacy/hooks/index.js +0 -2
- package/legacy/hooks/useAxisEvents.js +0 -120
- package/legacy/hooks/useChartDimensions.js +0 -18
- package/legacy/hooks/useDrawingArea.js +0 -21
- package/legacy/hooks/useInteractionItemProps.js +0 -71
- package/legacy/hooks/useMounted.js +0 -21
- package/legacy/hooks/useReducedMotion.js +0 -27
- package/legacy/hooks/useScale.js +0 -33
- package/legacy/hooks/useTicks.js +0 -65
- package/legacy/index.js +0 -33
- package/legacy/internals/components/AxisSharedComponents.js +0 -25
- package/legacy/internals/defaultizeColor.js +0 -17
- package/legacy/internals/defaultizeValueFormatter.js +0 -12
- package/legacy/internals/domUtils.js +0 -121
- package/legacy/internals/geometry.js +0 -37
- package/legacy/internals/getCurve.js +0 -39
- package/legacy/internals/getScale.js +0 -17
- package/legacy/internals/getWordsByLines.js +0 -15
- package/legacy/internals/isBandScale.js +0 -3
- package/legacy/internals/stackSeries.js +0 -92
- package/legacy/internals/useAnimatedPath.js +0 -32
- package/legacy/internals/utils.js +0 -52
- package/legacy/models/axis.js +0 -6
- package/legacy/models/helpers.js +0 -1
- package/legacy/models/index.js +0 -4
- package/legacy/models/layout.js +0 -1
- package/legacy/models/seriesType/bar.js +0 -1
- package/legacy/models/seriesType/common.js +0 -1
- package/legacy/models/seriesType/config.js +0 -1
- package/legacy/models/seriesType/index.js +0 -5
- package/legacy/models/seriesType/line.js +0 -1
- package/legacy/models/seriesType/pie.js +0 -1
- package/legacy/models/seriesType/scatter.js +0 -1
- package/legacy/models/stacking.js +0 -1
- package/legacy/themeAugmentation/index.js +0 -3
|
@@ -1,118 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import Typography from '@mui/material/Typography';
|
|
5
|
-
import { ChartsTooltipCell, ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipMark, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
6
|
-
import { isCartesianSeries, utcFormatter } from './utils';
|
|
7
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
function DefaultChartsAxisTooltipContent(props) {
|
|
10
|
-
var _axis$valueFormatter;
|
|
11
|
-
var series = props.series,
|
|
12
|
-
axis = props.axis,
|
|
13
|
-
dataIndex = props.dataIndex,
|
|
14
|
-
axisValue = props.axisValue,
|
|
15
|
-
sx = props.sx,
|
|
16
|
-
classes = props.classes;
|
|
17
|
-
if (dataIndex == null) {
|
|
18
|
-
return null;
|
|
19
|
-
}
|
|
20
|
-
var axisFormatter = (_axis$valueFormatter = axis.valueFormatter) != null ? _axis$valueFormatter : function (v) {
|
|
21
|
-
return axis.scaleType === 'utc' ? utcFormatter(v) : v.toLocaleString();
|
|
22
|
-
};
|
|
23
|
-
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
24
|
-
sx: sx,
|
|
25
|
-
className: classes.root,
|
|
26
|
-
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
27
|
-
className: classes.table,
|
|
28
|
-
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
29
|
-
children: /*#__PURE__*/_jsx(ChartsTooltipRow, {
|
|
30
|
-
children: /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
31
|
-
colSpan: 3,
|
|
32
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
33
|
-
children: axisFormatter(axisValue)
|
|
34
|
-
})
|
|
35
|
-
})
|
|
36
|
-
})
|
|
37
|
-
}), /*#__PURE__*/_jsx("tbody", {
|
|
38
|
-
children: series.filter(isCartesianSeries).map(function (_ref) {
|
|
39
|
-
var _data$dataIndex;
|
|
40
|
-
var color = _ref.color,
|
|
41
|
-
id = _ref.id,
|
|
42
|
-
label = _ref.label,
|
|
43
|
-
valueFormatter = _ref.valueFormatter,
|
|
44
|
-
data = _ref.data;
|
|
45
|
-
// @ts-ignore
|
|
46
|
-
var formattedValue = valueFormatter((_data$dataIndex = data[dataIndex]) != null ? _data$dataIndex : null);
|
|
47
|
-
if (formattedValue == null) {
|
|
48
|
-
return null;
|
|
49
|
-
}
|
|
50
|
-
return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
51
|
-
className: classes.row,
|
|
52
|
-
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
53
|
-
className: clsx(classes.markCell, classes.cell),
|
|
54
|
-
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
55
|
-
ownerState: {
|
|
56
|
-
color: color
|
|
57
|
-
},
|
|
58
|
-
boxShadow: 1,
|
|
59
|
-
className: classes.mark
|
|
60
|
-
})
|
|
61
|
-
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
62
|
-
className: clsx(classes.labelCell, classes.cell),
|
|
63
|
-
children: label ? /*#__PURE__*/_jsx(Typography, {
|
|
64
|
-
children: label
|
|
65
|
-
}) : null
|
|
66
|
-
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
67
|
-
className: clsx(classes.valueCell, classes.cell),
|
|
68
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
69
|
-
children: formattedValue
|
|
70
|
-
})
|
|
71
|
-
})]
|
|
72
|
-
}, id);
|
|
73
|
-
})
|
|
74
|
-
})]
|
|
75
|
-
})
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propTypes = {
|
|
79
|
-
// ----------------------------- Warning --------------------------------
|
|
80
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
81
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
82
|
-
// ----------------------------------------------------------------------
|
|
83
|
-
/**
|
|
84
|
-
* The properties of the triggered axis.
|
|
85
|
-
*/
|
|
86
|
-
axis: PropTypes.object.isRequired,
|
|
87
|
-
/**
|
|
88
|
-
* Data identifying the triggered axis.
|
|
89
|
-
*/
|
|
90
|
-
axisData: PropTypes.shape({
|
|
91
|
-
x: PropTypes.shape({
|
|
92
|
-
index: PropTypes.number,
|
|
93
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
94
|
-
}),
|
|
95
|
-
y: PropTypes.shape({
|
|
96
|
-
index: PropTypes.number,
|
|
97
|
-
value: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired
|
|
98
|
-
})
|
|
99
|
-
}).isRequired,
|
|
100
|
-
/**
|
|
101
|
-
* The value associated to the current mouse position.
|
|
102
|
-
*/
|
|
103
|
-
axisValue: PropTypes.any.isRequired,
|
|
104
|
-
/**
|
|
105
|
-
* Override or extend the styles applied to the component.
|
|
106
|
-
*/
|
|
107
|
-
classes: PropTypes.object.isRequired,
|
|
108
|
-
/**
|
|
109
|
-
* The index of the data item triggered.
|
|
110
|
-
*/
|
|
111
|
-
dataIndex: PropTypes.number,
|
|
112
|
-
/**
|
|
113
|
-
* The series linked to the triggered axis.
|
|
114
|
-
*/
|
|
115
|
-
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
116
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
117
|
-
} : void 0;
|
|
118
|
-
export { DefaultChartsAxisTooltipContent };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import clsx from 'clsx';
|
|
4
|
-
import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
5
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
-
function DefaultChartsItemTooltipContent(props) {
|
|
8
|
-
var _series$valueFormatte;
|
|
9
|
-
var series = props.series,
|
|
10
|
-
itemData = props.itemData,
|
|
11
|
-
sx = props.sx,
|
|
12
|
-
classes = props.classes;
|
|
13
|
-
if (itemData.dataIndex === undefined) {
|
|
14
|
-
return null;
|
|
15
|
-
}
|
|
16
|
-
var _ref = series.type === 'pie' ? {
|
|
17
|
-
color: series.data[itemData.dataIndex].color,
|
|
18
|
-
displayedLabel: series.data[itemData.dataIndex].label
|
|
19
|
-
} : {
|
|
20
|
-
color: series.color,
|
|
21
|
-
displayedLabel: series.label
|
|
22
|
-
},
|
|
23
|
-
displayedLabel = _ref.displayedLabel,
|
|
24
|
-
color = _ref.color;
|
|
25
|
-
var value = series.data[itemData.dataIndex];
|
|
26
|
-
var formattedValue = (_series$valueFormatte = series.valueFormatter) == null ? void 0 : _series$valueFormatte.call(series, value);
|
|
27
|
-
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
28
|
-
sx: sx,
|
|
29
|
-
className: classes.root,
|
|
30
|
-
children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
|
|
31
|
-
className: classes.table,
|
|
32
|
-
children: /*#__PURE__*/_jsx("tbody", {
|
|
33
|
-
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
34
|
-
className: classes.row,
|
|
35
|
-
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
36
|
-
className: clsx(classes.markCell, classes.cell),
|
|
37
|
-
children: /*#__PURE__*/_jsx(ChartsTooltipMark, {
|
|
38
|
-
ownerState: {
|
|
39
|
-
color: color
|
|
40
|
-
},
|
|
41
|
-
className: classes.mark
|
|
42
|
-
})
|
|
43
|
-
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
44
|
-
className: clsx(classes.labelCell, classes.cell),
|
|
45
|
-
children: displayedLabel
|
|
46
|
-
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
47
|
-
className: clsx(classes.valueCell, classes.cell),
|
|
48
|
-
children: formattedValue
|
|
49
|
-
})]
|
|
50
|
-
})
|
|
51
|
-
})
|
|
52
|
-
})
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propTypes = {
|
|
56
|
-
// ----------------------------- Warning --------------------------------
|
|
57
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
58
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
59
|
-
// ----------------------------------------------------------------------
|
|
60
|
-
/**
|
|
61
|
-
* Override or extend the styles applied to the component.
|
|
62
|
-
*/
|
|
63
|
-
classes: PropTypes.object.isRequired,
|
|
64
|
-
/**
|
|
65
|
-
* The data used to identify the triggered item.
|
|
66
|
-
*/
|
|
67
|
-
itemData: PropTypes.shape({
|
|
68
|
-
dataIndex: PropTypes.number,
|
|
69
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
70
|
-
type: PropTypes.oneOf(['bar', 'line', 'pie', 'scatter']).isRequired
|
|
71
|
-
}).isRequired,
|
|
72
|
-
/**
|
|
73
|
-
* The series linked to the triggered axis.
|
|
74
|
-
*/
|
|
75
|
-
series: PropTypes.object.isRequired,
|
|
76
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
77
|
-
} : void 0;
|
|
78
|
-
export { DefaultChartsItemTooltipContent };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { unstable_generateUtilityClass as generateUtilityClass, unstable_generateUtilityClasses as generateUtilityClasses } from '@mui/utils';
|
|
2
|
-
export function getChartsTooltipUtilityClass(slot) {
|
|
3
|
-
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
4
|
-
}
|
|
5
|
-
export var chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'table', 'row', 'cell', 'mark', 'markCell', 'labelCell', 'valueCell']);
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export * from './ChartsTooltip';
|
|
2
|
-
export * from './chartsTooltipClasses';
|
|
3
|
-
export * from './ChartsAxisTooltipContent';
|
|
4
|
-
export * from './ChartsItemTooltipContent';
|
|
5
|
-
export * from './DefaultChartsAxisTooltipContent';
|
|
6
|
-
export * from './DefaultChartsItemTooltipContent';
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import * as React from 'react';
|
|
3
|
-
import { SVGContext } from '../context/DrawingProvider';
|
|
4
|
-
export function generateVirtualElement(mousePosition) {
|
|
5
|
-
if (mousePosition === null) {
|
|
6
|
-
return {
|
|
7
|
-
getBoundingClientRect: function getBoundingClientRect() {
|
|
8
|
-
return {
|
|
9
|
-
width: 0,
|
|
10
|
-
height: 0,
|
|
11
|
-
x: 0,
|
|
12
|
-
y: 0,
|
|
13
|
-
top: 0,
|
|
14
|
-
right: 0,
|
|
15
|
-
bottom: 0,
|
|
16
|
-
left: 0,
|
|
17
|
-
toJSON: function toJSON() {
|
|
18
|
-
return '';
|
|
19
|
-
}
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
var x = mousePosition.x,
|
|
25
|
-
y = mousePosition.y;
|
|
26
|
-
return {
|
|
27
|
-
getBoundingClientRect: function getBoundingClientRect() {
|
|
28
|
-
return {
|
|
29
|
-
width: 0,
|
|
30
|
-
height: 0,
|
|
31
|
-
x: x,
|
|
32
|
-
y: y,
|
|
33
|
-
top: y,
|
|
34
|
-
right: x,
|
|
35
|
-
bottom: y,
|
|
36
|
-
left: x,
|
|
37
|
-
toJSON: function toJSON() {
|
|
38
|
-
return JSON.stringify({
|
|
39
|
-
width: 0,
|
|
40
|
-
height: 0,
|
|
41
|
-
x: x,
|
|
42
|
-
y: y,
|
|
43
|
-
top: y,
|
|
44
|
-
right: x,
|
|
45
|
-
bottom: y,
|
|
46
|
-
left: x
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
};
|
|
50
|
-
}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
export function useMouseTracker() {
|
|
54
|
-
var svgRef = React.useContext(SVGContext);
|
|
55
|
-
|
|
56
|
-
// Use a ref to avoid rerendering on every mousemove event.
|
|
57
|
-
var _React$useState = React.useState(null),
|
|
58
|
-
_React$useState2 = _slicedToArray(_React$useState, 2),
|
|
59
|
-
mousePosition = _React$useState2[0],
|
|
60
|
-
setMousePosition = _React$useState2[1];
|
|
61
|
-
React.useEffect(function () {
|
|
62
|
-
var element = svgRef.current;
|
|
63
|
-
if (element === null) {
|
|
64
|
-
return function () {};
|
|
65
|
-
}
|
|
66
|
-
var handleMouseOut = function handleMouseOut() {
|
|
67
|
-
setMousePosition(null);
|
|
68
|
-
};
|
|
69
|
-
var handleMouseMove = function handleMouseMove(event) {
|
|
70
|
-
setMousePosition({
|
|
71
|
-
x: event.clientX,
|
|
72
|
-
y: event.clientY
|
|
73
|
-
});
|
|
74
|
-
};
|
|
75
|
-
element.addEventListener('mouseout', handleMouseOut);
|
|
76
|
-
element.addEventListener('mousemove', handleMouseMove);
|
|
77
|
-
return function () {
|
|
78
|
-
element.removeEventListener('mouseout', handleMouseOut);
|
|
79
|
-
element.removeEventListener('mousemove', handleMouseMove);
|
|
80
|
-
};
|
|
81
|
-
}, [svgRef]);
|
|
82
|
-
return mousePosition;
|
|
83
|
-
}
|
|
84
|
-
export function getTooltipHasData(trigger, displayedData) {
|
|
85
|
-
if (trigger === 'item') {
|
|
86
|
-
return displayedData !== null;
|
|
87
|
-
}
|
|
88
|
-
var hasAxisXData = displayedData.x !== null;
|
|
89
|
-
var hasAxisYData = displayedData.y !== null;
|
|
90
|
-
return hasAxisXData || hasAxisYData;
|
|
91
|
-
}
|
|
92
|
-
export function isCartesianSeriesType(seriesType) {
|
|
93
|
-
return ['bar', 'line', 'scatter'].includes(seriesType);
|
|
94
|
-
}
|
|
95
|
-
export function isCartesianSeries(series) {
|
|
96
|
-
return isCartesianSeriesType(series.type);
|
|
97
|
-
}
|
|
98
|
-
export function utcFormatter(v) {
|
|
99
|
-
if (v instanceof Date) {
|
|
100
|
-
return v.toUTCString();
|
|
101
|
-
}
|
|
102
|
-
return v.toLocaleString();
|
|
103
|
-
}
|
|
@@ -1,206 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { Delaunay } from 'd3-delaunay';
|
|
4
|
-
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
5
|
-
import { InteractionContext } from '../context/InteractionProvider';
|
|
6
|
-
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
7
|
-
import { SVGContext, DrawingContext } from '../context/DrawingProvider';
|
|
8
|
-
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
9
|
-
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
10
|
-
import { getSVGPoint } from '../internals/utils';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
function ChartsVoronoiHandler(props) {
|
|
13
|
-
var _React$useContext$sca;
|
|
14
|
-
var voronoiMaxRadius = props.voronoiMaxRadius,
|
|
15
|
-
onItemClick = props.onItemClick;
|
|
16
|
-
var svgRef = React.useContext(SVGContext);
|
|
17
|
-
var _React$useContext = React.useContext(DrawingContext),
|
|
18
|
-
width = _React$useContext.width,
|
|
19
|
-
height = _React$useContext.height,
|
|
20
|
-
top = _React$useContext.top,
|
|
21
|
-
left = _React$useContext.left;
|
|
22
|
-
var _React$useContext2 = React.useContext(CartesianContext),
|
|
23
|
-
xAxis = _React$useContext2.xAxis,
|
|
24
|
-
yAxis = _React$useContext2.yAxis,
|
|
25
|
-
xAxisIds = _React$useContext2.xAxisIds,
|
|
26
|
-
yAxisIds = _React$useContext2.yAxisIds;
|
|
27
|
-
var _React$useContext3 = React.useContext(InteractionContext),
|
|
28
|
-
dispatch = _React$useContext3.dispatch;
|
|
29
|
-
var _ref = (_React$useContext$sca = React.useContext(SeriesContext).scatter) != null ? _React$useContext$sca : {},
|
|
30
|
-
series = _ref.series,
|
|
31
|
-
seriesOrder = _ref.seriesOrder;
|
|
32
|
-
var voronoiRef = React.useRef({});
|
|
33
|
-
var defaultXAxisId = xAxisIds[0];
|
|
34
|
-
var defaultYAxisId = yAxisIds[0];
|
|
35
|
-
useEnhancedEffect(function () {
|
|
36
|
-
dispatch({
|
|
37
|
-
type: 'updateVoronoiUsage',
|
|
38
|
-
useVoronoiInteraction: true
|
|
39
|
-
});
|
|
40
|
-
return function () {
|
|
41
|
-
dispatch({
|
|
42
|
-
type: 'updateVoronoiUsage',
|
|
43
|
-
useVoronoiInteraction: false
|
|
44
|
-
});
|
|
45
|
-
};
|
|
46
|
-
}, [dispatch]);
|
|
47
|
-
useEnhancedEffect(function () {
|
|
48
|
-
// This effect generate and store the Delaunay object that's used to map coordinate to closest point.
|
|
49
|
-
|
|
50
|
-
if (seriesOrder === undefined || series === undefined) {
|
|
51
|
-
// If there is no scatter chart series
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
voronoiRef.current = {};
|
|
55
|
-
var points = [];
|
|
56
|
-
seriesOrder.forEach(function (seriesId) {
|
|
57
|
-
var _series$seriesId = series[seriesId],
|
|
58
|
-
data = _series$seriesId.data,
|
|
59
|
-
xAxisKey = _series$seriesId.xAxisKey,
|
|
60
|
-
yAxisKey = _series$seriesId.yAxisKey;
|
|
61
|
-
var xScale = xAxis[xAxisKey != null ? xAxisKey : defaultXAxisId].scale;
|
|
62
|
-
var yScale = yAxis[yAxisKey != null ? yAxisKey : defaultYAxisId].scale;
|
|
63
|
-
var getXPosition = getValueToPositionMapper(xScale);
|
|
64
|
-
var getYPosition = getValueToPositionMapper(yScale);
|
|
65
|
-
var seriesPoints = data.flatMap(function (_ref2) {
|
|
66
|
-
var x = _ref2.x,
|
|
67
|
-
y = _ref2.y;
|
|
68
|
-
return [getXPosition(x), getYPosition(y)];
|
|
69
|
-
});
|
|
70
|
-
voronoiRef.current[seriesId] = {
|
|
71
|
-
startIndex: points.length,
|
|
72
|
-
endIndex: points.length + seriesPoints.length
|
|
73
|
-
};
|
|
74
|
-
points = points.concat(seriesPoints);
|
|
75
|
-
});
|
|
76
|
-
voronoiRef.current.delauney = new Delaunay(points);
|
|
77
|
-
}, [defaultXAxisId, defaultYAxisId, series, seriesOrder, xAxis, yAxis]);
|
|
78
|
-
React.useEffect(function () {
|
|
79
|
-
var element = svgRef.current;
|
|
80
|
-
if (element === null) {
|
|
81
|
-
return undefined;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
// TODO: A perf optimisation of voronoi could be to use the last point as the intial point for the next search.
|
|
85
|
-
function getClosestPoint(event) {
|
|
86
|
-
var _voronoiRef$current$d;
|
|
87
|
-
// Get mouse coordinate in global SVG space
|
|
88
|
-
var svgPoint = getSVGPoint(svgRef.current, event);
|
|
89
|
-
var outsideX = svgPoint.x < left || svgPoint.x > left + width;
|
|
90
|
-
var outsideY = svgPoint.y < top || svgPoint.y > top + height;
|
|
91
|
-
if (outsideX || outsideY) {
|
|
92
|
-
return 'outside-chart';
|
|
93
|
-
}
|
|
94
|
-
if (!voronoiRef.current.delauney) {
|
|
95
|
-
return 'no-point-found';
|
|
96
|
-
}
|
|
97
|
-
var closestPointIndex = (_voronoiRef$current$d = voronoiRef.current.delauney) == null ? void 0 : _voronoiRef$current$d.find(svgPoint.x, svgPoint.y);
|
|
98
|
-
if (closestPointIndex === undefined) {
|
|
99
|
-
return 'no-point-found';
|
|
100
|
-
}
|
|
101
|
-
var seriesId = Object.keys(voronoiRef.current).find(function (id) {
|
|
102
|
-
if (id === 'delauney') {
|
|
103
|
-
return false;
|
|
104
|
-
}
|
|
105
|
-
return 2 * closestPointIndex >= voronoiRef.current[id].startIndex && 2 * closestPointIndex < voronoiRef.current[id].endIndex;
|
|
106
|
-
});
|
|
107
|
-
if (seriesId === undefined) {
|
|
108
|
-
return 'no-point-found';
|
|
109
|
-
}
|
|
110
|
-
var dataIndex = (2 * closestPointIndex - voronoiRef.current[seriesId].startIndex) / 2;
|
|
111
|
-
if (voronoiMaxRadius !== undefined) {
|
|
112
|
-
var pointX = voronoiRef.current.delauney.points[2 * closestPointIndex];
|
|
113
|
-
var pointY = voronoiRef.current.delauney.points[2 * closestPointIndex + 1];
|
|
114
|
-
var dist2 = Math.pow(pointX - svgPoint.x, 2) + Math.pow(pointY - svgPoint.y, 2);
|
|
115
|
-
if (dist2 > Math.pow(voronoiMaxRadius, 2)) {
|
|
116
|
-
// The closest point is too far to be considered.
|
|
117
|
-
return 'outside-voronoi-max-radius';
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
seriesId: seriesId,
|
|
122
|
-
dataIndex: dataIndex
|
|
123
|
-
};
|
|
124
|
-
}
|
|
125
|
-
var handleMouseOut = function handleMouseOut() {
|
|
126
|
-
dispatch({
|
|
127
|
-
type: 'exitChart'
|
|
128
|
-
});
|
|
129
|
-
};
|
|
130
|
-
var handleMouseMove = function handleMouseMove(event) {
|
|
131
|
-
var closestPoint = getClosestPoint(event);
|
|
132
|
-
if (closestPoint === 'outside-chart') {
|
|
133
|
-
dispatch({
|
|
134
|
-
type: 'exitChart'
|
|
135
|
-
});
|
|
136
|
-
return;
|
|
137
|
-
}
|
|
138
|
-
if (closestPoint === 'outside-voronoi-max-radius' || closestPoint === 'no-point-found') {
|
|
139
|
-
dispatch({
|
|
140
|
-
type: 'leaveItem',
|
|
141
|
-
data: {
|
|
142
|
-
type: 'scatter'
|
|
143
|
-
}
|
|
144
|
-
});
|
|
145
|
-
return;
|
|
146
|
-
}
|
|
147
|
-
var seriesId = closestPoint.seriesId,
|
|
148
|
-
dataIndex = closestPoint.dataIndex;
|
|
149
|
-
dispatch({
|
|
150
|
-
type: 'enterItem',
|
|
151
|
-
data: {
|
|
152
|
-
type: 'scatter',
|
|
153
|
-
seriesId: seriesId,
|
|
154
|
-
dataIndex: dataIndex
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
};
|
|
158
|
-
var handleMouseClick = function handleMouseClick(event) {
|
|
159
|
-
if (!onItemClick) {
|
|
160
|
-
return;
|
|
161
|
-
}
|
|
162
|
-
var closestPoint = getClosestPoint(event);
|
|
163
|
-
if (typeof closestPoint === 'string') {
|
|
164
|
-
// No point fond for any reason
|
|
165
|
-
return;
|
|
166
|
-
}
|
|
167
|
-
var seriesId = closestPoint.seriesId,
|
|
168
|
-
dataIndex = closestPoint.dataIndex;
|
|
169
|
-
onItemClick(event, {
|
|
170
|
-
type: 'scatter',
|
|
171
|
-
seriesId: seriesId,
|
|
172
|
-
dataIndex: dataIndex
|
|
173
|
-
});
|
|
174
|
-
};
|
|
175
|
-
element.addEventListener('mouseout', handleMouseOut);
|
|
176
|
-
element.addEventListener('mousemove', handleMouseMove);
|
|
177
|
-
element.addEventListener('click', handleMouseClick);
|
|
178
|
-
return function () {
|
|
179
|
-
element.removeEventListener('mouseout', handleMouseOut);
|
|
180
|
-
element.removeEventListener('mousemove', handleMouseMove);
|
|
181
|
-
element.removeEventListener('click', handleMouseClick);
|
|
182
|
-
};
|
|
183
|
-
}, [svgRef, dispatch, left, width, top, height, yAxis, xAxis, voronoiMaxRadius, onItemClick]);
|
|
184
|
-
|
|
185
|
-
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
186
|
-
return /*#__PURE__*/_jsx(React.Fragment, {});
|
|
187
|
-
}
|
|
188
|
-
process.env.NODE_ENV !== "production" ? ChartsVoronoiHandler.propTypes = {
|
|
189
|
-
// ----------------------------- Warning --------------------------------
|
|
190
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
191
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
192
|
-
// ----------------------------------------------------------------------
|
|
193
|
-
/**
|
|
194
|
-
* Callback fired when clicking on a scatter item.
|
|
195
|
-
* @param {MouseEvent} event Mouse event catched at the svg level
|
|
196
|
-
* @param {ScatterItemIdentifier} scatterItemIdentifier Identify whihc item got clicked
|
|
197
|
-
*/
|
|
198
|
-
onItemClick: PropTypes.func,
|
|
199
|
-
/**
|
|
200
|
-
* Defines the maximal distance between a scatter point and the pointer that triggers the interaction.
|
|
201
|
-
* If `undefined`, the radius is assumed to be infinite.
|
|
202
|
-
* @default undefined
|
|
203
|
-
*/
|
|
204
|
-
voronoiMaxRadius: PropTypes.number
|
|
205
|
-
} : void 0;
|
|
206
|
-
export { ChartsVoronoiHandler };
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from './ChartsVoronoiHandler';
|