@mui/x-charts 7.22.1 → 8.0.0-alpha.0
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 +7 -7
- package/BarChart/BarChart.js +9 -29
- package/BarChart/BarElement.d.ts +1 -1
- package/BarChart/BarLabel/BarLabelItem.d.ts +1 -1
- package/BarChart/BarPlot.js +12 -4
- package/BarChart/extremums.js +3 -3
- package/BarChart/useBarChartProps.d.ts +2 -2
- package/BarChart/useBarChartProps.js +3 -4
- package/CHANGELOG.md +143 -92
- package/ChartContainer/ChartContainer.d.ts +16 -33
- package/ChartContainer/ChartContainer.js +24 -41
- package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.d.ts +2 -2
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.d.ts +1 -1
- package/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/ChartContainer/useChartContainerProps.d.ts +11 -86
- package/ChartContainer/useChartContainerProps.js +42 -58
- package/ChartsLegend/ChartsLegend.js +0 -3
- package/ChartsLegend/DefaultChartsLegend.d.ts +0 -5
- package/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/ChartsLegend/LegendPerItem.d.ts +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/ChartsOverlay/ChartsOverlay.d.ts +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/ChartsTooltip/ChartsTooltip.js +45 -6
- package/ChartsTooltip/useAxisTooltip.js +3 -3
- package/ChartsTooltip/useItemTooltip.js +3 -3
- package/ChartsTooltip/utils.d.ts +5 -13
- package/ChartsTooltip/utils.js +45 -42
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/Gauge/GaugeContainer.js +1 -1
- package/LineChart/AreaElement.d.ts +1 -1
- package/LineChart/AreaPlot.js +2 -6
- package/LineChart/LineChart.d.ts +7 -7
- package/LineChart/LineChart.js +9 -29
- package/LineChart/LineElement.d.ts +1 -1
- package/LineChart/LineHighlightPlot.d.ts +1 -1
- package/LineChart/LineHighlightPlot.js +2 -6
- package/LineChart/LinePlot.js +2 -6
- package/LineChart/MarkPlot.js +2 -6
- package/LineChart/extremums.js +10 -6
- package/LineChart/useLineChartProps.d.ts +2 -2
- package/LineChart/useLineChartProps.js +3 -4
- package/PieChart/PieArc.d.ts +0 -5
- package/PieChart/PieArc.js +1 -10
- package/PieChart/PieArcPlot.js +0 -5
- package/PieChart/PieChart.d.ts +9 -32
- package/PieChart/PieChart.js +19 -102
- package/README.md +2 -2
- package/ScatterChart/ScatterChart.d.ts +7 -7
- package/ScatterChart/ScatterChart.js +9 -29
- package/ScatterChart/ScatterPlot.js +3 -6
- package/ScatterChart/extremums.js +6 -6
- package/ScatterChart/useScatterChartProps.d.ts +2 -2
- package/ScatterChart/useScatterChartProps.js +3 -4
- package/SparkLineChart/SparkLineChart.d.ts +4 -4
- package/SparkLineChart/SparkLineChart.js +4 -2
- package/context/CartesianProvider/defaultizeAxis.d.ts +5 -1
- package/context/ChartDataProvider/ChartDataProvider.d.ts +41 -0
- package/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +48 -27
- package/context/ChartDataProvider/index.d.ts +1 -0
- package/context/ChartDataProvider/index.js +1 -0
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +97 -0
- package/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.d.ts +16 -12
- package/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/context/HighlightedProvider/HighlightedContext.d.ts +0 -8
- package/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/context/PluginProvider/ExtremumGetter.types.d.ts +2 -2
- package/context/ZAxisContextProvider.d.ts +1 -1
- package/index.d.ts +1 -2
- package/index.js +2 -3
- package/internals/computeAxisValue.js +13 -5
- package/internals/defaultizeColor.d.ts +1 -8
- package/internals/getSymbol.js +19 -3
- package/internals/index.d.ts +5 -5
- package/internals/index.js +5 -5
- package/internals/useStringInterpolator.js +1 -0
- package/models/axis.d.ts +10 -0
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +2 -12
- package/models/seriesType/config.d.ts +1 -1
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +1 -6
- package/modern/BarChart/BarChart.js +9 -29
- package/modern/BarChart/BarPlot.js +12 -4
- package/modern/BarChart/extremums.js +3 -3
- package/modern/BarChart/useBarChartProps.js +3 -4
- package/modern/ChartContainer/ChartContainer.js +24 -41
- package/modern/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/modern/ChartContainer/useChartContainerProps.js +42 -58
- package/modern/ChartsLegend/ChartsLegend.js +0 -3
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/modern/ChartsTooltip/ChartsTooltip.js +45 -6
- package/modern/ChartsTooltip/useAxisTooltip.js +3 -3
- package/modern/ChartsTooltip/useItemTooltip.js +3 -3
- package/modern/ChartsTooltip/utils.js +45 -42
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/LineChart/AreaPlot.js +2 -6
- package/modern/LineChart/LineChart.js +9 -29
- package/modern/LineChart/LineHighlightPlot.js +2 -6
- package/modern/LineChart/LinePlot.js +2 -6
- package/modern/LineChart/MarkPlot.js +2 -6
- package/modern/LineChart/extremums.js +10 -6
- package/modern/LineChart/useLineChartProps.js +3 -4
- package/modern/PieChart/PieArc.js +1 -10
- package/modern/PieChart/PieArcPlot.js +0 -5
- package/modern/PieChart/PieChart.js +19 -102
- package/modern/ScatterChart/ScatterChart.js +9 -29
- package/modern/ScatterChart/ScatterPlot.js +3 -6
- package/modern/ScatterChart/extremums.js +6 -6
- package/modern/ScatterChart/useScatterChartProps.js +3 -4
- package/modern/SparkLineChart/SparkLineChart.js +4 -2
- package/modern/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +48 -27
- package/modern/context/ChartDataProvider/index.js +1 -0
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +86 -0
- package/modern/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/modern/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/modern/index.js +2 -3
- package/modern/internals/computeAxisValue.js +13 -5
- package/modern/internals/getSymbol.js +19 -3
- package/modern/internals/index.js +5 -5
- package/modern/internals/useStringInterpolator.js +1 -0
- package/node/BarChart/BarChart.js +9 -29
- package/node/BarChart/BarPlot.js +11 -3
- package/node/BarChart/extremums.js +3 -3
- package/node/BarChart/useBarChartProps.js +3 -4
- package/node/ChartContainer/ChartContainer.js +23 -40
- package/node/{ResponsiveChartContainer → ChartContainer}/useChartContainerDimensions.js +6 -4
- package/node/ChartContainer/useChartContainerProps.js +42 -59
- package/node/ChartsLegend/ChartsLegend.js +0 -3
- package/node/ChartsLegend/DefaultChartsLegend.js +1 -12
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +3 -3
- package/node/ChartsTooltip/ChartsTooltip.js +44 -5
- package/node/ChartsTooltip/useAxisTooltip.js +3 -3
- package/node/ChartsTooltip/useItemTooltip.js +3 -3
- package/node/ChartsTooltip/utils.js +46 -44
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -5
- package/node/Gauge/GaugeContainer.js +1 -1
- package/node/LineChart/AreaPlot.js +2 -6
- package/node/LineChart/LineChart.js +9 -29
- package/node/LineChart/LineHighlightPlot.js +2 -6
- package/node/LineChart/LinePlot.js +2 -6
- package/node/LineChart/MarkPlot.js +2 -6
- package/node/LineChart/extremums.js +10 -6
- package/node/LineChart/useLineChartProps.js +3 -4
- package/node/PieChart/PieArc.js +1 -10
- package/node/PieChart/PieArcPlot.js +0 -5
- package/node/PieChart/PieChart.js +19 -102
- package/node/ScatterChart/ScatterChart.js +9 -29
- package/node/ScatterChart/ScatterPlot.js +3 -6
- package/node/ScatterChart/extremums.js +6 -6
- package/node/ScatterChart/useScatterChartProps.js +3 -4
- package/node/SparkLineChart/SparkLineChart.js +4 -2
- package/node/{ResponsiveChartContainer/ResponsiveChartContainer.js → context/ChartDataProvider/ChartDataProvider.js} +47 -26
- package/node/context/ChartDataProvider/index.js +16 -0
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +94 -0
- package/node/{ChartContainer → context/ChartDataProvider}/useDefaultizeAxis.js +1 -1
- package/node/context/HighlightedProvider/HighlightedProvider.js +1 -16
- package/node/index.js +5 -16
- package/node/internals/computeAxisValue.js +13 -5
- package/node/internals/getSymbol.js +19 -3
- package/node/internals/index.js +37 -29
- package/node/internals/useStringInterpolator.js +2 -0
- package/package.json +4 -4
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -24
- package/ResponsiveChartContainer/index.d.ts +0 -1
- package/ResponsiveChartContainer/index.js +0 -1
- package/ResponsiveChartContainer/package.json +0 -6
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.d.ts +0 -19
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/internals/SlotComponentPropsFromProps.d.ts +0 -1
- package/internals/SlotComponentPropsFromProps.js +0 -1
- package/models/helpers.d.ts +0 -3
- package/models/helpers.js +0 -1
- package/modern/ResponsiveChartContainer/index.js +0 -1
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -70
- package/modern/internals/SlotComponentPropsFromProps.js +0 -1
- package/modern/models/helpers.js +0 -1
- package/node/ResponsiveChartContainer/index.js +0 -16
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +0 -77
- package/node/internals/SlotComponentPropsFromProps.js +0 -5
- package/node/models/helpers.js +0 -5
- /package/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/modern/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
- /package/node/{ResponsiveChartContainer → ChartContainer}/ResizableContainer.js +0 -0
|
@@ -11,7 +11,6 @@ import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
|
11
11
|
import { getSeriesToDisplay } from "./utils.js";
|
|
12
12
|
import { getLegendUtilityClass } from "./chartsLegendClasses.js";
|
|
13
13
|
import { DefaultChartsLegend } from "./DefaultChartsLegend.js";
|
|
14
|
-
import { useDrawingArea } from "../hooks/index.js";
|
|
15
14
|
import { useSeries } from "../hooks/useSeries.js";
|
|
16
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
16
|
const useUtilityClasses = ownerState => {
|
|
@@ -50,7 +49,6 @@ function ChartsLegend(inProps) {
|
|
|
50
49
|
const classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
51
50
|
theme
|
|
52
51
|
}));
|
|
53
|
-
const drawingArea = useDrawingArea();
|
|
54
52
|
const series = useSeries();
|
|
55
53
|
const seriesToDisplay = getSeriesToDisplay(series);
|
|
56
54
|
const ChartLegendRender = slots?.legend ?? DefaultChartsLegend;
|
|
@@ -59,7 +57,6 @@ function ChartsLegend(inProps) {
|
|
|
59
57
|
externalSlotProps: slotProps?.legend,
|
|
60
58
|
additionalProps: _extends({}, other, {
|
|
61
59
|
classes,
|
|
62
|
-
drawingArea,
|
|
63
60
|
series,
|
|
64
61
|
seriesToDisplay
|
|
65
62
|
}),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["seriesToDisplay", "hidden", "onItemClick"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { LegendPerItem } from "./LegendPerItem.js";
|
|
@@ -43,17 +43,6 @@ process.env.NODE_ENV !== "production" ? DefaultChartsLegend.propTypes = {
|
|
|
43
43
|
* The default depends on the chart.
|
|
44
44
|
*/
|
|
45
45
|
direction: PropTypes.oneOf(['column', 'row']).isRequired,
|
|
46
|
-
/**
|
|
47
|
-
* @deprecated Use the `useDrawingArea` hook instead.
|
|
48
|
-
*/
|
|
49
|
-
drawingArea: PropTypes.shape({
|
|
50
|
-
bottom: PropTypes.number.isRequired,
|
|
51
|
-
height: PropTypes.number.isRequired,
|
|
52
|
-
left: PropTypes.number.isRequired,
|
|
53
|
-
right: PropTypes.number.isRequired,
|
|
54
|
-
top: PropTypes.number.isRequired,
|
|
55
|
-
width: PropTypes.number.isRequired
|
|
56
|
-
}).isRequired,
|
|
57
46
|
/**
|
|
58
47
|
* Set to true to hide the legend.
|
|
59
48
|
* @default false
|
|
@@ -39,8 +39,8 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
39
39
|
Object.keys(series).filter(seriesType => ['bar', 'line'].includes(seriesType)).forEach(seriesType => {
|
|
40
40
|
series[seriesType]?.seriesOrder.forEach(seriesId => {
|
|
41
41
|
const seriesItem = series[seriesType].series[seriesId];
|
|
42
|
-
const providedXAxisId = seriesItem.xAxisId
|
|
43
|
-
const providedYAxisId = seriesItem.yAxisId
|
|
42
|
+
const providedXAxisId = seriesItem.xAxisId;
|
|
43
|
+
const providedYAxisId = seriesItem.yAxisId;
|
|
44
44
|
const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
|
|
45
45
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
46
46
|
seriesValues[seriesId] = seriesItem.data[dataIndex];
|
|
@@ -40,14 +40,14 @@ function ChartsAxisTooltipContent(props) {
|
|
|
40
40
|
Object.keys(series).filter(isCartesianSeriesType).forEach(seriesType => {
|
|
41
41
|
series[seriesType].seriesOrder.forEach(seriesId => {
|
|
42
42
|
const item = series[seriesType].series[seriesId];
|
|
43
|
-
const providedXAxisId = item.xAxisId
|
|
44
|
-
const providedYAxisId = item.yAxisId
|
|
43
|
+
const providedXAxisId = item.xAxisId;
|
|
44
|
+
const providedYAxisId = item.yAxisId;
|
|
45
45
|
const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
|
|
46
46
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
47
47
|
const seriesToAdd = series[seriesType].series[seriesId];
|
|
48
48
|
const xAxisId = providedXAxisId ?? xAxisIds[0];
|
|
49
49
|
const yAxisId = providedYAxisId ?? yAxisIds[0];
|
|
50
|
-
const zAxisId = seriesToAdd.zAxisId ??
|
|
50
|
+
const zAxisId = seriesToAdd.zAxisId ?? zAxisIds[0];
|
|
51
51
|
const getColor = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
52
52
|
rep.push(_extends({}, seriesToAdd, {
|
|
53
53
|
getColor
|
|
@@ -30,9 +30,9 @@ function ChartsItemTooltipContent(props) {
|
|
|
30
30
|
zAxisIds
|
|
31
31
|
} = React.useContext(ZAxisContext);
|
|
32
32
|
const colorProcessors = useColorProcessor();
|
|
33
|
-
const xAxisId = series.xAxisId ??
|
|
34
|
-
const yAxisId = series.yAxisId ??
|
|
35
|
-
const zAxisId = series.zAxisId ??
|
|
33
|
+
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
34
|
+
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
35
|
+
const zAxisId = series.zAxisId ?? zAxisIds[0];
|
|
36
36
|
const getColor = colorProcessors[series.type]?.(series, xAxisId && xAxis[xAxisId], yAxisId && yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
37
37
|
const Content = content ?? DefaultChartsItemTooltipContent;
|
|
38
38
|
const chartTooltipContentProps = useSlotProps({
|
|
@@ -4,12 +4,14 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
|
+
import useLazyRef from '@mui/utils/useLazyRef';
|
|
7
8
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
8
9
|
import Popper from '@mui/material/Popper';
|
|
9
10
|
import NoSsr from '@mui/material/NoSsr';
|
|
10
11
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
11
12
|
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
12
|
-
import {
|
|
13
|
+
import { useSvgRef } from "../hooks/useSvgRef.js";
|
|
14
|
+
import { getTooltipHasData, usePointerType } from "./utils.js";
|
|
13
15
|
import { ChartsItemTooltipContent } from "./ChartsItemTooltipContent.js";
|
|
14
16
|
import { ChartsAxisTooltipContent } from "./ChartsAxisTooltipContent.js";
|
|
15
17
|
import { getChartsTooltipUtilityClass } from "./chartsTooltipClasses.js";
|
|
@@ -63,14 +65,20 @@ function ChartsTooltip(inProps) {
|
|
|
63
65
|
slots,
|
|
64
66
|
slotProps
|
|
65
67
|
} = props;
|
|
66
|
-
const
|
|
68
|
+
const svgRef = useSvgRef();
|
|
69
|
+
const pointerType = usePointerType();
|
|
70
|
+
const popperRef = React.useRef(null);
|
|
71
|
+
const positionRef = useLazyRef(() => ({
|
|
72
|
+
x: 0,
|
|
73
|
+
y: 0
|
|
74
|
+
}));
|
|
67
75
|
const {
|
|
68
76
|
item,
|
|
69
77
|
axis
|
|
70
78
|
} = React.useContext(InteractionContext);
|
|
71
79
|
const displayedData = trigger === 'item' ? item : axis;
|
|
72
80
|
const tooltipHasData = getTooltipHasData(trigger, displayedData);
|
|
73
|
-
const popperOpen =
|
|
81
|
+
const popperOpen = pointerType !== null && tooltipHasData;
|
|
74
82
|
const classes = useUtilityClasses({
|
|
75
83
|
classes: props.classes
|
|
76
84
|
});
|
|
@@ -80,17 +88,48 @@ function ChartsTooltip(inProps) {
|
|
|
80
88
|
externalSlotProps: slotProps?.popper,
|
|
81
89
|
additionalProps: {
|
|
82
90
|
open: popperOpen,
|
|
83
|
-
placement:
|
|
84
|
-
|
|
91
|
+
placement: pointerType?.pointerType === 'mouse' ? 'right-start' : 'top',
|
|
92
|
+
popperRef,
|
|
93
|
+
anchorEl: {
|
|
94
|
+
getBoundingClientRect: () => ({
|
|
95
|
+
x: positionRef.current.x,
|
|
96
|
+
y: positionRef.current.y,
|
|
97
|
+
top: positionRef.current.y,
|
|
98
|
+
left: positionRef.current.x,
|
|
99
|
+
right: positionRef.current.x,
|
|
100
|
+
bottom: positionRef.current.y,
|
|
101
|
+
width: 0,
|
|
102
|
+
height: 0,
|
|
103
|
+
toJSON: () => ''
|
|
104
|
+
})
|
|
105
|
+
},
|
|
85
106
|
modifiers: [{
|
|
86
107
|
name: 'offset',
|
|
87
108
|
options: {
|
|
88
|
-
offset: [0,
|
|
109
|
+
offset: [0, pointerType?.pointerType === 'touch' ? 40 - pointerType.height : 0]
|
|
89
110
|
}
|
|
90
111
|
}]
|
|
91
112
|
},
|
|
92
113
|
ownerState: {}
|
|
93
114
|
});
|
|
115
|
+
React.useEffect(() => {
|
|
116
|
+
const element = svgRef.current;
|
|
117
|
+
if (element === null) {
|
|
118
|
+
return () => {};
|
|
119
|
+
}
|
|
120
|
+
const handleMove = event => {
|
|
121
|
+
// eslint-disable-next-line react-compiler/react-compiler
|
|
122
|
+
positionRef.current = {
|
|
123
|
+
x: event.clientX,
|
|
124
|
+
y: event.clientY
|
|
125
|
+
};
|
|
126
|
+
popperRef.current?.update();
|
|
127
|
+
};
|
|
128
|
+
element.addEventListener('pointermove', handleMove);
|
|
129
|
+
return () => {
|
|
130
|
+
element.removeEventListener('pointermove', handleMove);
|
|
131
|
+
};
|
|
132
|
+
}, [svgRef, positionRef]);
|
|
94
133
|
if (trigger === 'none') {
|
|
95
134
|
return null;
|
|
96
135
|
}
|
|
@@ -45,15 +45,15 @@ export function useAxisTooltip() {
|
|
|
45
45
|
}
|
|
46
46
|
return seriesOfType.seriesOrder.map(seriesId => {
|
|
47
47
|
const seriesToAdd = seriesOfType.series[seriesId];
|
|
48
|
-
const providedXAxisId = seriesToAdd.xAxisId
|
|
49
|
-
const providedYAxisId = seriesToAdd.yAxisId
|
|
48
|
+
const providedXAxisId = seriesToAdd.xAxisId;
|
|
49
|
+
const providedYAxisId = seriesToAdd.yAxisId;
|
|
50
50
|
const axisKey = isXaxis ? providedXAxisId : providedYAxisId;
|
|
51
51
|
|
|
52
52
|
// Test if the series uses the default axis
|
|
53
53
|
if (axisKey === undefined || axisKey === USED_AXIS_ID) {
|
|
54
54
|
const xAxisId = providedXAxisId ?? xAxisIds[0];
|
|
55
55
|
const yAxisId = providedYAxisId ?? yAxisIds[0];
|
|
56
|
-
const zAxisId = seriesToAdd.zAxisId ??
|
|
56
|
+
const zAxisId = seriesToAdd.zAxisId ?? zAxisIds[0];
|
|
57
57
|
const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[xAxisId], yAxis[yAxisId], zAxisId && zAxis[zAxisId])(dataIndex) ?? '';
|
|
58
58
|
const value = seriesToAdd.data[dataIndex] ?? null;
|
|
59
59
|
const formattedValue = seriesToAdd.valueFormatter(value, {
|
|
@@ -24,9 +24,9 @@ export function useItemTooltip() {
|
|
|
24
24
|
zAxisIds
|
|
25
25
|
} = React.useContext(ZAxisContext);
|
|
26
26
|
const colorProcessors = useColorProcessor();
|
|
27
|
-
const xAxisId = series.xAxisId ??
|
|
28
|
-
const yAxisId = series.yAxisId ??
|
|
29
|
-
const zAxisId = series.zAxisId ??
|
|
27
|
+
const xAxisId = series.xAxisId ?? xAxisIds[0];
|
|
28
|
+
const yAxisId = series.yAxisId ?? yAxisIds[0];
|
|
29
|
+
const zAxisId = series.zAxisId ?? zAxisIds[0];
|
|
30
30
|
if (!item || item.dataIndex === undefined) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
@@ -1,42 +1,8 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
1
|
import * as React from 'react';
|
|
3
2
|
import { useSvgRef } from "../hooks/index.js";
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
getBoundingClientRect: () => ({
|
|
8
|
-
width: 0,
|
|
9
|
-
height: 0,
|
|
10
|
-
x: 0,
|
|
11
|
-
y: 0,
|
|
12
|
-
top: 0,
|
|
13
|
-
right: 0,
|
|
14
|
-
bottom: 0,
|
|
15
|
-
left: 0,
|
|
16
|
-
toJSON: () => ''
|
|
17
|
-
})
|
|
18
|
-
};
|
|
19
|
-
}
|
|
20
|
-
const {
|
|
21
|
-
x,
|
|
22
|
-
y
|
|
23
|
-
} = mousePosition;
|
|
24
|
-
const boundingBox = {
|
|
25
|
-
width: 0,
|
|
26
|
-
height: 0,
|
|
27
|
-
x,
|
|
28
|
-
y,
|
|
29
|
-
top: y,
|
|
30
|
-
right: x,
|
|
31
|
-
bottom: y,
|
|
32
|
-
left: x
|
|
33
|
-
};
|
|
34
|
-
return {
|
|
35
|
-
getBoundingClientRect: () => _extends({}, boundingBox, {
|
|
36
|
-
toJSON: () => JSON.stringify(boundingBox)
|
|
37
|
-
})
|
|
38
|
-
};
|
|
39
|
-
}
|
|
3
|
+
/**
|
|
4
|
+
* @deprecated We recommend using vanilla JS to let popper track mouse position.
|
|
5
|
+
*/
|
|
40
6
|
export function useMouseTracker() {
|
|
41
7
|
const svgRef = useSvgRef();
|
|
42
8
|
|
|
@@ -47,6 +13,7 @@ export function useMouseTracker() {
|
|
|
47
13
|
if (element === null) {
|
|
48
14
|
return () => {};
|
|
49
15
|
}
|
|
16
|
+
const controller = new AbortController();
|
|
50
17
|
const handleOut = event => {
|
|
51
18
|
if (event.pointerType !== 'mouse') {
|
|
52
19
|
setMousePosition(null);
|
|
@@ -60,16 +27,52 @@ export function useMouseTracker() {
|
|
|
60
27
|
pointerType: event.pointerType
|
|
61
28
|
});
|
|
62
29
|
};
|
|
63
|
-
element.addEventListener('pointerdown', handleMove
|
|
64
|
-
|
|
30
|
+
element.addEventListener('pointerdown', handleMove, {
|
|
31
|
+
signal: controller.signal
|
|
32
|
+
});
|
|
33
|
+
element.addEventListener('pointermove', handleMove, {
|
|
34
|
+
signal: controller.signal
|
|
35
|
+
});
|
|
36
|
+
element.addEventListener('pointerup', handleOut, {
|
|
37
|
+
signal: controller.signal
|
|
38
|
+
});
|
|
39
|
+
return () => {
|
|
40
|
+
// Calling `.abort()` removes ALL event listeners
|
|
41
|
+
// For more info, see https://kettanaito.com/blog/dont-sleep-on-abort-controller
|
|
42
|
+
controller.abort();
|
|
43
|
+
};
|
|
44
|
+
}, [svgRef]);
|
|
45
|
+
return mousePosition;
|
|
46
|
+
}
|
|
47
|
+
export function usePointerType() {
|
|
48
|
+
const svgRef = useSvgRef();
|
|
49
|
+
|
|
50
|
+
// Use a ref to avoid rerendering on every mousemove event.
|
|
51
|
+
const [pointerType, setPointerType] = React.useState(null);
|
|
52
|
+
React.useEffect(() => {
|
|
53
|
+
const element = svgRef.current;
|
|
54
|
+
if (element === null) {
|
|
55
|
+
return () => {};
|
|
56
|
+
}
|
|
57
|
+
const handleOut = event => {
|
|
58
|
+
if (event.pointerType !== 'mouse') {
|
|
59
|
+
setPointerType(null);
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
const handleEnter = event => {
|
|
63
|
+
setPointerType({
|
|
64
|
+
height: event.height,
|
|
65
|
+
pointerType: event.pointerType
|
|
66
|
+
});
|
|
67
|
+
};
|
|
68
|
+
element.addEventListener('pointerenter', handleEnter);
|
|
65
69
|
element.addEventListener('pointerup', handleOut);
|
|
66
70
|
return () => {
|
|
67
|
-
element.removeEventListener('
|
|
68
|
-
element.removeEventListener('pointermove', handleMove);
|
|
71
|
+
element.removeEventListener('pointerenter', handleEnter);
|
|
69
72
|
element.removeEventListener('pointerup', handleOut);
|
|
70
73
|
};
|
|
71
74
|
}, [svgRef]);
|
|
72
|
-
return
|
|
75
|
+
return pointerType;
|
|
73
76
|
}
|
|
74
77
|
export function getTooltipHasData(trigger, displayedData) {
|
|
75
78
|
if (trigger === 'item') {
|
|
@@ -66,12 +66,10 @@ function ChartsVoronoiHandler(props) {
|
|
|
66
66
|
const {
|
|
67
67
|
data,
|
|
68
68
|
xAxisId,
|
|
69
|
-
yAxisId
|
|
70
|
-
xAxisKey,
|
|
71
|
-
yAxisKey
|
|
69
|
+
yAxisId
|
|
72
70
|
} = series[seriesId];
|
|
73
|
-
const xScale = xAxis[xAxisId ??
|
|
74
|
-
const yScale = yAxis[yAxisId ??
|
|
71
|
+
const xScale = xAxis[xAxisId ?? defaultXAxisId].scale;
|
|
72
|
+
const yScale = yAxis[yAxisId ?? defaultYAxisId].scale;
|
|
75
73
|
const getXPosition = getValueToPositionMapper(xScale);
|
|
76
74
|
const getYPosition = getValueToPositionMapper(yScale);
|
|
77
75
|
const seriesPoints = data.flatMap(({
|
|
@@ -7,7 +7,7 @@ import * as React from 'react';
|
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
9
|
import useForkRef from '@mui/utils/useForkRef';
|
|
10
|
-
import { useChartContainerDimensions } from "../
|
|
10
|
+
import { useChartContainerDimensions } from "../ChartContainer/useChartContainerDimensions.js";
|
|
11
11
|
import { ChartsSurface } from "../ChartsSurface/index.js";
|
|
12
12
|
import { DrawingProvider } from "../context/DrawingProvider.js";
|
|
13
13
|
import { GaugeProvider } from "./GaugeProvider.js";
|
|
@@ -42,17 +42,13 @@ const useAggregatedData = () => {
|
|
|
42
42
|
return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
|
|
43
43
|
.map(seriesId => {
|
|
44
44
|
const {
|
|
45
|
-
xAxisId
|
|
46
|
-
yAxisId
|
|
47
|
-
xAxisKey = defaultXAxisId,
|
|
48
|
-
yAxisKey = defaultYAxisId,
|
|
45
|
+
xAxisId = defaultXAxisId,
|
|
46
|
+
yAxisId = defaultYAxisId,
|
|
49
47
|
stackedData,
|
|
50
48
|
data,
|
|
51
49
|
connectNulls,
|
|
52
50
|
baseline
|
|
53
51
|
} = series[seriesId];
|
|
54
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
55
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
56
52
|
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
57
53
|
const yScale = yAxis[yAxisId].scale;
|
|
58
54
|
const xData = xAxis[xAxisId].data;
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
7
7
|
import { AreaPlot } from "./AreaPlot.js";
|
|
8
8
|
import { LinePlot } from "./LinePlot.js";
|
|
9
|
-
import {
|
|
9
|
+
import { ChartContainer } from "../ChartContainer/index.js";
|
|
10
10
|
import { MarkPlot } from "./MarkPlot.js";
|
|
11
11
|
import { ChartsAxis } from "../ChartsAxis/ChartsAxis.js";
|
|
12
12
|
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
@@ -51,7 +51,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
51
51
|
tooltipProps,
|
|
52
52
|
children
|
|
53
53
|
} = useLineChartProps(props);
|
|
54
|
-
return /*#__PURE__*/_jsxs(
|
|
54
|
+
return /*#__PURE__*/_jsxs(ChartContainer, _extends({
|
|
55
55
|
ref: ref
|
|
56
56
|
}, chartContainerProps, {
|
|
57
57
|
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
@@ -59,7 +59,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
59
59
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
60
60
|
"data-drawing-container": true,
|
|
61
61
|
children: /*#__PURE__*/_jsx(MarkPlot, _extends({}, markPlotProps))
|
|
62
|
-
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
62
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltipProps)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
63
63
|
}));
|
|
64
64
|
});
|
|
65
65
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
@@ -119,6 +119,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
119
119
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
120
120
|
*/
|
|
121
121
|
height: PropTypes.number,
|
|
122
|
+
/**
|
|
123
|
+
* If `true`, the legend is not rendered.
|
|
124
|
+
*/
|
|
125
|
+
hideLegend: PropTypes.bool,
|
|
122
126
|
/**
|
|
123
127
|
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
124
128
|
*/
|
|
@@ -132,32 +136,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
132
136
|
* @default yAxisIds[0] The id of the first provided axis
|
|
133
137
|
*/
|
|
134
138
|
leftAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
135
|
-
/**
|
|
136
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
137
|
-
*/
|
|
138
|
-
legend: PropTypes.shape({
|
|
139
|
-
classes: PropTypes.object,
|
|
140
|
-
direction: PropTypes.oneOf(['column', 'row']),
|
|
141
|
-
hidden: PropTypes.bool,
|
|
142
|
-
itemGap: PropTypes.number,
|
|
143
|
-
itemMarkHeight: PropTypes.number,
|
|
144
|
-
itemMarkWidth: PropTypes.number,
|
|
145
|
-
labelStyle: PropTypes.object,
|
|
146
|
-
markGap: PropTypes.number,
|
|
147
|
-
onItemClick: PropTypes.func,
|
|
148
|
-
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
149
|
-
bottom: PropTypes.number,
|
|
150
|
-
left: PropTypes.number,
|
|
151
|
-
right: PropTypes.number,
|
|
152
|
-
top: PropTypes.number
|
|
153
|
-
})]),
|
|
154
|
-
position: PropTypes.shape({
|
|
155
|
-
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
156
|
-
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
157
|
-
}),
|
|
158
|
-
slotProps: PropTypes.object,
|
|
159
|
-
slots: PropTypes.object
|
|
160
|
-
}),
|
|
161
139
|
/**
|
|
162
140
|
* If `true`, a loading overlay is displayed.
|
|
163
141
|
* @default false
|
|
@@ -293,6 +271,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
293
271
|
dataKey: PropTypes.string,
|
|
294
272
|
disableLine: PropTypes.bool,
|
|
295
273
|
disableTicks: PropTypes.bool,
|
|
274
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
296
275
|
fill: PropTypes.string,
|
|
297
276
|
hideTooltip: PropTypes.bool,
|
|
298
277
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -346,6 +325,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
346
325
|
dataKey: PropTypes.string,
|
|
347
326
|
disableLine: PropTypes.bool,
|
|
348
327
|
disableTicks: PropTypes.bool,
|
|
328
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
349
329
|
fill: PropTypes.string,
|
|
350
330
|
hideTooltip: PropTypes.bool,
|
|
351
331
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
@@ -62,16 +62,12 @@ function LineHighlightPlot(props) {
|
|
|
62
62
|
}) => {
|
|
63
63
|
return groupIds.flatMap(seriesId => {
|
|
64
64
|
const {
|
|
65
|
-
xAxisId
|
|
66
|
-
yAxisId
|
|
67
|
-
xAxisKey = defaultXAxisId,
|
|
68
|
-
yAxisKey = defaultYAxisId,
|
|
65
|
+
xAxisId = defaultXAxisId,
|
|
66
|
+
yAxisId = defaultYAxisId,
|
|
69
67
|
stackedData,
|
|
70
68
|
data,
|
|
71
69
|
disableHighlight
|
|
72
70
|
} = series[seriesId];
|
|
73
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
74
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
75
71
|
if (disableHighlight || data[highlightedIndex] == null) {
|
|
76
72
|
return null;
|
|
77
73
|
}
|
|
@@ -41,16 +41,12 @@ const useAggregatedData = () => {
|
|
|
41
41
|
}) => {
|
|
42
42
|
return groupIds.flatMap(seriesId => {
|
|
43
43
|
const {
|
|
44
|
-
xAxisId
|
|
45
|
-
yAxisId
|
|
46
|
-
xAxisKey = defaultXAxisId,
|
|
47
|
-
yAxisKey = defaultYAxisId,
|
|
44
|
+
xAxisId = defaultXAxisId,
|
|
45
|
+
yAxisId = defaultYAxisId,
|
|
48
46
|
stackedData,
|
|
49
47
|
data,
|
|
50
48
|
connectNulls
|
|
51
49
|
} = series[seriesId];
|
|
52
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
53
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
54
50
|
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
55
51
|
const yScale = yAxis[yAxisId].scale;
|
|
56
52
|
const xData = xAxis[xAxisId].data;
|
|
@@ -63,10 +63,8 @@ function MarkPlot(props) {
|
|
|
63
63
|
}) => {
|
|
64
64
|
return groupIds.map(seriesId => {
|
|
65
65
|
const {
|
|
66
|
-
xAxisId
|
|
67
|
-
yAxisId
|
|
68
|
-
xAxisKey = defaultXAxisId,
|
|
69
|
-
yAxisKey = defaultYAxisId,
|
|
66
|
+
xAxisId = defaultXAxisId,
|
|
67
|
+
yAxisId = defaultYAxisId,
|
|
70
68
|
stackedData,
|
|
71
69
|
data,
|
|
72
70
|
showMark = true
|
|
@@ -74,8 +72,6 @@ function MarkPlot(props) {
|
|
|
74
72
|
if (showMark === false) {
|
|
75
73
|
return null;
|
|
76
74
|
}
|
|
77
|
-
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
78
|
-
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
79
75
|
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
80
76
|
const yScale = yAxis[yAxisId].scale;
|
|
81
77
|
const xData = xAxis[xAxisId].data;
|
|
@@ -6,8 +6,11 @@ export const getExtremumX = params => {
|
|
|
6
6
|
const maxX = Math.max(...(axis.data ?? []));
|
|
7
7
|
return [minX, maxX];
|
|
8
8
|
};
|
|
9
|
-
function getSeriesExtremums(getValues, stackedData, filter) {
|
|
9
|
+
function getSeriesExtremums(getValues, data, stackedData, filter) {
|
|
10
10
|
return stackedData.reduce((seriesAcc, stackedValue, index) => {
|
|
11
|
+
if (data[index] === null) {
|
|
12
|
+
return seriesAcc;
|
|
13
|
+
}
|
|
11
14
|
const [base, value] = getValues(stackedValue);
|
|
12
15
|
if (filter && (!filter({
|
|
13
16
|
y: base,
|
|
@@ -29,24 +32,25 @@ export const getExtremumY = params => {
|
|
|
29
32
|
getFilters
|
|
30
33
|
} = params;
|
|
31
34
|
return Object.keys(series).filter(seriesId => {
|
|
32
|
-
const yAxisId = series[seriesId].yAxisId
|
|
35
|
+
const yAxisId = series[seriesId].yAxisId;
|
|
33
36
|
return yAxisId === axis.id || isDefaultAxis && yAxisId === undefined;
|
|
34
37
|
}).reduce((acc, seriesId) => {
|
|
35
38
|
const {
|
|
36
39
|
area,
|
|
37
|
-
stackedData
|
|
40
|
+
stackedData,
|
|
41
|
+
data
|
|
38
42
|
} = series[seriesId];
|
|
39
43
|
const isArea = area !== undefined;
|
|
40
44
|
const filter = getFilters?.({
|
|
41
45
|
currentAxisId: axis.id,
|
|
42
46
|
isDefaultAxis,
|
|
43
|
-
seriesXAxisId: series[seriesId].xAxisId
|
|
44
|
-
seriesYAxisId: series[seriesId].yAxisId
|
|
47
|
+
seriesXAxisId: series[seriesId].xAxisId,
|
|
48
|
+
seriesYAxisId: series[seriesId].yAxisId
|
|
45
49
|
});
|
|
46
50
|
|
|
47
51
|
// Since this series is not used to display an area, we do not consider the base (the d[0]).
|
|
48
52
|
const getValues = isArea && axis.scaleType !== 'log' && typeof series[seriesId].baseline !== 'string' ? d => d : d => [d[1], d[1]];
|
|
49
|
-
const seriesExtremums = getSeriesExtremums(getValues, stackedData, filter);
|
|
53
|
+
const seriesExtremums = getSeriesExtremums(getValues, data, stackedData, filter);
|
|
50
54
|
const [seriesMin, seriesMax] = seriesExtremums;
|
|
51
55
|
return [Math.min(seriesMin, acc[0]), Math.max(seriesMax, acc[1])];
|
|
52
56
|
}, [Infinity, -Infinity]);
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "tooltip", "onAxisClick", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "topAxis", "leftAxis", "rightAxis", "bottomAxis", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "experimentalMarkRendering"];
|
|
6
6
|
import useId from '@mui/utils/useId';
|
|
7
7
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
8
8
|
/**
|
|
@@ -30,7 +30,6 @@ export const useLineChartProps = props => {
|
|
|
30
30
|
onMarkClick,
|
|
31
31
|
axisHighlight,
|
|
32
32
|
disableLineItemHighlight,
|
|
33
|
-
legend,
|
|
34
33
|
grid,
|
|
35
34
|
topAxis,
|
|
36
35
|
leftAxis,
|
|
@@ -124,10 +123,10 @@ export const useLineChartProps = props => {
|
|
|
124
123
|
slots,
|
|
125
124
|
slotProps
|
|
126
125
|
};
|
|
127
|
-
const legendProps =
|
|
126
|
+
const legendProps = {
|
|
128
127
|
slots,
|
|
129
128
|
slotProps
|
|
130
|
-
}
|
|
129
|
+
};
|
|
131
130
|
const tooltipProps = _extends({}, tooltip, {
|
|
132
131
|
slots,
|
|
133
132
|
slotProps
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle"
|
|
5
|
+
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
|
|
@@ -93,15 +93,6 @@ process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
|
93
93
|
// ----------------------------------------------------------------------
|
|
94
94
|
classes: PropTypes.object,
|
|
95
95
|
dataIndex: PropTypes.number.isRequired,
|
|
96
|
-
/**
|
|
97
|
-
* @deprecated Use the `isFaded` or `isHighlighted` props instead.
|
|
98
|
-
*/
|
|
99
|
-
highlightScope: PropTypes.shape({
|
|
100
|
-
fade: PropTypes.oneOf(['global', 'none', 'series']),
|
|
101
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
102
|
-
highlight: PropTypes.oneOf(['item', 'none', 'series']),
|
|
103
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
104
|
-
}),
|
|
105
96
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
106
97
|
isFaded: PropTypes.bool.isRequired,
|
|
107
98
|
isHighlighted: PropTypes.bool.isRequired
|
|
@@ -10,7 +10,6 @@ import { useTransition } from '@react-spring/web';
|
|
|
10
10
|
import { PieArc } from "./PieArc.js";
|
|
11
11
|
import { defaultTransitionConfig } from "./dataTransform/transition.js";
|
|
12
12
|
import { useTransformData } from "./dataTransform/useTransformData.js";
|
|
13
|
-
import { useHighlighted } from "../context/index.js";
|
|
14
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
function PieArcPlot(props) {
|
|
16
15
|
const {
|
|
@@ -43,9 +42,6 @@ function PieArcPlot(props) {
|
|
|
43
42
|
const transition = useTransition(transformedData, _extends({}, defaultTransitionConfig, {
|
|
44
43
|
immediate: skipAnimation
|
|
45
44
|
}));
|
|
46
|
-
const {
|
|
47
|
-
highlightScope
|
|
48
|
-
} = useHighlighted();
|
|
49
45
|
if (data.length === 0) {
|
|
50
46
|
return null;
|
|
51
47
|
}
|
|
@@ -72,7 +68,6 @@ function PieArcPlot(props) {
|
|
|
72
68
|
id: id,
|
|
73
69
|
color: item.color,
|
|
74
70
|
dataIndex: index,
|
|
75
|
-
highlightScope: highlightScope,
|
|
76
71
|
isFaded: item.isFaded,
|
|
77
72
|
isHighlighted: item.isHighlighted,
|
|
78
73
|
onClick: onItemClick && (event => {
|