@mui/x-charts 8.6.0 → 8.8.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 +1 -1
- package/BarChart/BarChart.js +16 -0
- package/BarChart/BarPlot.js +11 -150
- package/BarChart/useBarPlotData.d.ts +8 -0
- package/BarChart/useBarPlotData.js +146 -0
- package/CHANGELOG.md +202 -1
- package/ChartContainer/ChartContainer.d.ts +1 -21
- package/ChartContainer/ChartContainer.js +22 -8
- package/ChartContainer/index.d.ts +8 -1
- package/ChartContainer/useChartContainerProps.js +8 -2
- package/ChartDataProvider/ChartDataProvider.js +6 -0
- package/ChartDataProvider/useChartDataProviderProps.d.ts +1 -1
- package/ChartDataProvider/useChartDataProviderProps.js +6 -1
- package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +34 -24
- package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +34 -24
- package/ChartsReferenceLine/ChartsReferenceLine.d.ts +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +3 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +48 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +3 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.js +48 -1
- package/ChartsReferenceLine/index.d.ts +3 -1
- package/ChartsSurface/ChartsSurface.js +2 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +6 -3
- package/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/ChartsTooltip/utils.js +18 -29
- package/Gauge/GaugeContainer.d.ts +1 -1
- package/LineChart/AreaPlot.js +5 -115
- package/LineChart/LineChart.js +22 -0
- package/LineChart/LineHighlightPlot.js +10 -4
- package/LineChart/LinePlot.js +5 -99
- package/LineChart/MarkPlot.js +17 -3
- package/LineChart/useAreaPlotData.d.ts +12 -0
- package/LineChart/useAreaPlotData.js +126 -0
- package/LineChart/useLinePlotData.d.ts +11 -0
- package/LineChart/useLinePlotData.js +108 -0
- package/PieChart/PieChart.d.ts +1 -1
- package/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +1 -1
- package/ScatterChart/Scatter.js +22 -48
- package/ScatterChart/ScatterChart.d.ts +1 -1
- package/ScatterChart/ScatterPlot.js +2 -2
- package/ScatterChart/seriesConfig/seriesProcessor.js +3 -0
- package/ScatterChart/useScatterPlotData.d.ts +8 -0
- package/ScatterChart/useScatterPlotData.js +33 -0
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +16 -0
- package/context/ChartApi.d.ts +22 -0
- package/context/ChartApi.js +5 -0
- package/context/ChartProvider/ChartContext.js +1 -0
- package/context/index.d.ts +2 -1
- package/context/useChartApiContext.d.ts +1 -1
- package/esm/BarChart/BarChart.d.ts +1 -1
- package/esm/BarChart/BarChart.js +16 -0
- package/esm/BarChart/BarPlot.js +12 -152
- package/esm/BarChart/useBarPlotData.d.ts +8 -0
- package/esm/BarChart/useBarPlotData.js +139 -0
- package/esm/ChartContainer/ChartContainer.d.ts +1 -21
- package/esm/ChartContainer/ChartContainer.js +22 -8
- package/esm/ChartContainer/index.d.ts +8 -1
- package/esm/ChartContainer/index.js +6 -1
- package/esm/ChartContainer/useChartContainerProps.js +8 -2
- package/esm/ChartDataProvider/ChartDataProvider.js +6 -0
- package/esm/ChartDataProvider/useChartDataProviderProps.d.ts +1 -1
- package/esm/ChartDataProvider/useChartDataProviderProps.js +7 -2
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +1 -1
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +36 -26
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +1 -1
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +36 -26
- package/esm/ChartsReferenceLine/ChartsReferenceLine.d.ts +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.d.ts +3 -0
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +47 -0
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.d.ts +3 -0
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +47 -0
- package/esm/ChartsReferenceLine/index.d.ts +3 -1
- package/esm/ChartsReferenceLine/index.js +2 -1
- package/esm/ChartsSurface/ChartsSurface.js +2 -1
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +6 -3
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +1 -1
- package/esm/ChartsTooltip/utils.js +18 -29
- package/esm/Gauge/GaugeContainer.d.ts +1 -1
- package/esm/LineChart/AreaPlot.js +5 -115
- package/esm/LineChart/LineChart.js +22 -0
- package/esm/LineChart/LineHighlightPlot.js +11 -5
- package/esm/LineChart/LinePlot.js +5 -99
- package/esm/LineChart/MarkPlot.js +17 -3
- package/esm/LineChart/useAreaPlotData.d.ts +12 -0
- package/esm/LineChart/useAreaPlotData.js +119 -0
- package/esm/LineChart/useLinePlotData.d.ts +11 -0
- package/esm/LineChart/useLinePlotData.js +101 -0
- package/esm/PieChart/PieChart.d.ts +1 -1
- package/esm/RadarChart/RadarDataProvider/RadarDataProvider.d.ts +1 -1
- package/esm/ScatterChart/Scatter.js +23 -49
- package/esm/ScatterChart/ScatterChart.d.ts +1 -1
- package/esm/ScatterChart/ScatterPlot.js +2 -2
- package/esm/ScatterChart/seriesConfig/seriesProcessor.js +3 -0
- package/esm/ScatterChart/useScatterPlotData.d.ts +8 -0
- package/esm/ScatterChart/useScatterPlotData.js +26 -0
- package/esm/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +16 -0
- package/esm/context/ChartApi.d.ts +22 -0
- package/esm/context/ChartApi.js +1 -0
- package/esm/context/ChartProvider/ChartContext.js +2 -0
- package/esm/context/index.d.ts +2 -1
- package/esm/context/useChartApiContext.d.ts +1 -1
- package/esm/hooks/useAxis.d.ts +2 -2
- package/esm/hooks/useInteractionItemProps.d.ts +14 -9
- package/esm/hooks/useInteractionItemProps.js +28 -28
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -2
- package/esm/internals/constants.d.ts +3 -0
- package/esm/internals/constants.js +4 -0
- package/esm/internals/getLabel.d.ts +1 -1
- package/esm/internals/index.d.ts +6 -0
- package/esm/internals/index.js +6 -0
- package/esm/internals/plugins/corePlugins/corePlugins.d.ts +4 -2
- package/esm/internals/plugins/corePlugins/corePlugins.js +3 -1
- package/esm/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -29
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
- package/esm/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +0 -6
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/index.d.ts +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/index.js +2 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js +27 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +8 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +3 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +21 -0
- package/esm/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js +1 -0
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.js +2 -0
- package/esm/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/index.d.ts +2 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/index.js +1 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.d.ts +3 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +77 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +31 -0
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.js +1 -0
- package/esm/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +5 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +7 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.js +14 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +2 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +90 -36
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +18 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +76 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +8 -5
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +47 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +48 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +18 -12
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +16 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +6 -1
- package/esm/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +34 -34
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +7 -8
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +47 -30
- package/esm/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
- package/esm/internals/plugins/utils/useLazySelectorEffect.d.ts +7 -0
- package/esm/internals/plugins/utils/useLazySelectorEffect.js +70 -0
- package/esm/internals/store/useCharts.d.ts +1 -1
- package/esm/locales/elGR.d.ts +19 -0
- package/esm/locales/elGR.js +15 -0
- package/esm/locales/index.d.ts +1 -0
- package/esm/locales/index.js +1 -0
- package/esm/models/axis.d.ts +15 -0
- package/esm/models/axis.js +4 -0
- package/esm/models/index.d.ts +1 -1
- package/esm/models/seriesType/scatter.d.ts +11 -2
- package/esm/themeAugmentation/components.d.ts +3 -0
- package/esm/themeAugmentation/props.d.ts +2 -0
- package/hooks/useAxis.d.ts +2 -2
- package/hooks/useInteractionItemProps.d.ts +14 -9
- package/hooks/useInteractionItemProps.js +29 -28
- package/index.d.ts +2 -1
- package/index.js +37 -11
- package/internals/constants.d.ts +3 -0
- package/internals/constants.js +5 -1
- package/internals/getLabel.d.ts +1 -1
- package/internals/index.d.ts +6 -0
- package/internals/index.js +52 -0
- package/internals/plugins/corePlugins/corePlugins.d.ts +4 -2
- package/internals/plugins/corePlugins/corePlugins.js +3 -1
- package/internals/plugins/corePlugins/useChartAnimation/useChartAnimation.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.js +1 -29
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.selectors.d.ts +3 -3
- package/internals/plugins/corePlugins/useChartDimensions/useChartDimensions.types.d.ts +0 -6
- package/internals/plugins/corePlugins/useChartExperimentalFeature/index.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/index.js +27 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.js +34 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.d.ts +8 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.selectors.js +10 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.d.ts +21 -0
- package/internals/plugins/corePlugins/useChartExperimentalFeature/useChartExperimentalFeature.types.js +5 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.js +1 -0
- package/internals/plugins/corePlugins/useChartId/useChartId.selectors.d.ts +1 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/index.d.ts +2 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/index.js +12 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.d.ts +3 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +84 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +31 -0
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.js +5 -0
- package/internals/plugins/corePlugins/useChartSeries/useChartSeries.selectors.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +5 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +4 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +4 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.d.ts +7 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisDomainLimit.js +21 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +2 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +24 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartAxisSize.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +90 -36
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +18 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisPreview.selectors.js +82 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +10 -5
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +9 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +47 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +55 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +18 -12
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +18 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/zoom.types.d.ts +6 -1
- package/internals/plugins/featurePlugins/useChartHighlight/useChartHighlight.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +6 -6
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +34 -34
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.selectors.d.ts +5 -5
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +7 -8
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.js +46 -30
- package/internals/plugins/featurePlugins/useChartVoronoi/useChartVoronoi.selectors.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartZAxis/useChartZAxis.selectors.d.ts +1 -1
- package/internals/plugins/utils/useLazySelectorEffect.d.ts +7 -0
- package/internals/plugins/utils/useLazySelectorEffect.js +77 -0
- package/internals/store/useCharts.d.ts +1 -1
- package/locales/elGR.d.ts +19 -0
- package/locales/elGR.js +21 -0
- package/locales/index.d.ts +1 -0
- package/locales/index.js +11 -0
- package/models/axis.d.ts +15 -0
- package/models/axis.js +4 -0
- package/models/index.d.ts +1 -1
- package/models/seriesType/scatter.d.ts +11 -2
- package/package.json +4 -3
- package/themeAugmentation/components.d.ts +3 -0
- package/themeAugmentation/props.d.ts +2 -0
|
@@ -1,2 +1,4 @@
|
|
|
1
1
|
export * from "./ChartsReferenceLine.js";
|
|
2
|
-
export * from "./chartsReferenceLineClasses.js";
|
|
2
|
+
export * from "./chartsReferenceLineClasses.js";
|
|
3
|
+
export type { ChartsXReferenceLineProps } from "./ChartsXReferenceLine.js";
|
|
4
|
+
export type { ChartsYReferenceLineProps } from "./ChartsYReferenceLine.js";
|
|
@@ -29,7 +29,8 @@ const ChartsSurfaceStyles = styled('svg', {
|
|
|
29
29
|
overflow: 'hidden',
|
|
30
30
|
// This prevents default touch actions when using the svg on mobile devices.
|
|
31
31
|
// For example, prevent page scroll & zoom.
|
|
32
|
-
touchAction: '
|
|
32
|
+
touchAction: 'pan-y',
|
|
33
|
+
userSelect: 'none'
|
|
33
34
|
}));
|
|
34
35
|
|
|
35
36
|
/**
|
|
@@ -10,7 +10,7 @@ import useLazyRef from '@mui/utils/useLazyRef';
|
|
|
10
10
|
import { styled, useThemeProps } from '@mui/material/styles';
|
|
11
11
|
import Popper from '@mui/material/Popper';
|
|
12
12
|
import NoSsr from '@mui/material/NoSsr';
|
|
13
|
-
import {
|
|
13
|
+
import { rafThrottle } from '@mui/x-internals/rafThrottle';
|
|
14
14
|
import { useIsFineMainPointer, usePointerType } from "./utils.js";
|
|
15
15
|
import { useUtilityClasses } from "./chartsTooltipClasses.js";
|
|
16
16
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
@@ -19,6 +19,7 @@ import { selectorChartsInteractionItemIsDefined } from "../internals/plugins/fea
|
|
|
19
19
|
import { selectorChartsInteractionAxisTooltip } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
20
20
|
import { selectorChartsInteractionPolarAxisTooltip } from "../internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js";
|
|
21
21
|
import { useAxisSystem } from "../hooks/useAxisSystem.js";
|
|
22
|
+
import { useSvgRef } from "../hooks/index.js";
|
|
22
23
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
24
|
const noAxis = () => false;
|
|
24
25
|
const ChartsTooltipRoot = styled(Popper, {
|
|
@@ -51,8 +52,8 @@ function ChartsTooltipContainer(inProps) {
|
|
|
51
52
|
children
|
|
52
53
|
} = props,
|
|
53
54
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
54
|
-
const classes = useUtilityClasses(propClasses);
|
|
55
55
|
const svgRef = useSvgRef();
|
|
56
|
+
const classes = useUtilityClasses(propClasses);
|
|
56
57
|
const pointerType = usePointerType();
|
|
57
58
|
const isFineMainPointer = useIsFineMainPointer();
|
|
58
59
|
const popperRef = React.useRef(null);
|
|
@@ -68,19 +69,21 @@ function ChartsTooltipContainer(inProps) {
|
|
|
68
69
|
if (element === null) {
|
|
69
70
|
return () => {};
|
|
70
71
|
}
|
|
72
|
+
const update = rafThrottle(() => popperRef.current?.update());
|
|
71
73
|
const handlePointerEvent = event => {
|
|
72
74
|
// eslint-disable-next-line react-compiler/react-compiler
|
|
73
75
|
positionRef.current = {
|
|
74
76
|
x: event.clientX,
|
|
75
77
|
y: event.clientY
|
|
76
78
|
};
|
|
77
|
-
|
|
79
|
+
update();
|
|
78
80
|
};
|
|
79
81
|
element.addEventListener('pointerdown', handlePointerEvent);
|
|
80
82
|
element.addEventListener('pointermove', handlePointerEvent);
|
|
81
83
|
return () => {
|
|
82
84
|
element.removeEventListener('pointerdown', handlePointerEvent);
|
|
83
85
|
element.removeEventListener('pointermove', handlePointerEvent);
|
|
86
|
+
update.clear();
|
|
84
87
|
};
|
|
85
88
|
}, [svgRef, positionRef]);
|
|
86
89
|
const anchorEl = React.useMemo(() => ({
|
|
@@ -13,6 +13,6 @@ export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent
|
|
|
13
13
|
/**
|
|
14
14
|
* @ignore - internal component.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "
|
|
16
|
+
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material/Typography").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "sx" | "align" | "variant" | "gutterBottom" | "noWrap" | "paragraph" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material/styles").Theme> & {
|
|
17
17
|
component?: React.ElementType;
|
|
18
18
|
}, {}, {}>;
|
|
@@ -2,55 +2,44 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import useMediaQuery from '@mui/material/useMediaQuery';
|
|
5
|
+
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
5
6
|
import { useSvgRef } from "../hooks/index.js";
|
|
6
7
|
/**
|
|
7
8
|
* @deprecated We recommend using vanilla JS to let popper track mouse position.
|
|
8
9
|
*/
|
|
9
10
|
export function useMouseTracker() {
|
|
10
|
-
const
|
|
11
|
+
const {
|
|
12
|
+
instance
|
|
13
|
+
} = useChartContext();
|
|
11
14
|
|
|
12
15
|
// Use a ref to avoid rerendering on every mousemove event.
|
|
13
16
|
const [mousePosition, setMousePosition] = React.useState(null);
|
|
14
17
|
React.useEffect(() => {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
return () => {};
|
|
18
|
-
}
|
|
19
|
-
const controller = new AbortController();
|
|
20
|
-
const handleOut = event => {
|
|
21
|
-
if (event.pointerType !== 'mouse') {
|
|
18
|
+
const moveEndHandler = instance.addInteractionListener('moveEnd', event => {
|
|
19
|
+
if (!event.detail.activeGestures.pan) {
|
|
22
20
|
setMousePosition(null);
|
|
23
21
|
}
|
|
24
|
-
};
|
|
25
|
-
const
|
|
22
|
+
});
|
|
23
|
+
const gestureHandler = event => {
|
|
26
24
|
setMousePosition({
|
|
27
|
-
x: event.
|
|
28
|
-
y: event.
|
|
29
|
-
height: event.height,
|
|
30
|
-
pointerType: event.pointerType
|
|
25
|
+
x: event.detail.centroid.x,
|
|
26
|
+
y: event.detail.centroid.y,
|
|
27
|
+
height: event.detail.srcEvent.height,
|
|
28
|
+
pointerType: event.detail.srcEvent.pointerType
|
|
31
29
|
});
|
|
32
30
|
};
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
});
|
|
36
|
-
element.addEventListener('pointermove', handleMove, {
|
|
37
|
-
signal: controller.signal
|
|
38
|
-
});
|
|
39
|
-
element.addEventListener('pointerup', handleOut, {
|
|
40
|
-
signal: controller.signal
|
|
41
|
-
});
|
|
31
|
+
const moveHandler = instance.addInteractionListener('move', gestureHandler);
|
|
32
|
+
const panHandler = instance.addInteractionListener('pan', gestureHandler);
|
|
42
33
|
return () => {
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
34
|
+
moveHandler.cleanup();
|
|
35
|
+
panHandler.cleanup();
|
|
36
|
+
moveEndHandler.cleanup();
|
|
46
37
|
};
|
|
47
|
-
}, [
|
|
38
|
+
}, [instance]);
|
|
48
39
|
return mousePosition;
|
|
49
40
|
}
|
|
50
41
|
export function usePointerType() {
|
|
51
42
|
const svgRef = useSvgRef();
|
|
52
|
-
|
|
53
|
-
// Use a ref to avoid rerendering on every mousemove event.
|
|
54
43
|
const [pointerType, setPointerType] = React.useState(null);
|
|
55
44
|
React.useEffect(() => {
|
|
56
45
|
const element = svgRef.current;
|
|
@@ -3,7 +3,7 @@ import { ChartsSurfaceProps } from "../ChartsSurface/index.js";
|
|
|
3
3
|
import { GaugeProviderProps } from "./GaugeProvider.js";
|
|
4
4
|
import { MergeSignaturesProperty } from "../internals/plugins/models/index.js";
|
|
5
5
|
import { ChartCorePluginSignatures } from "../internals/plugins/corePlugins/index.js";
|
|
6
|
-
export interface GaugeContainerProps extends Omit<ChartsSurfaceProps, 'children'>, Omit<MergeSignaturesProperty<ChartCorePluginSignatures, 'params'>, 'series' | 'dataset' | 'colors' | 'theme'>, Omit<GaugeProviderProps, 'children'>, Omit<React.SVGProps<SVGSVGElement>, 'width' | 'height'> {
|
|
6
|
+
export interface GaugeContainerProps extends Omit<ChartsSurfaceProps, 'children'>, Omit<MergeSignaturesProperty<ChartCorePluginSignatures, 'params'>, 'series' | 'dataset' | 'colors' | 'theme' | 'experimentalFeatures'>, Omit<GaugeProviderProps, 'children'>, Omit<React.SVGProps<SVGSVGElement>, 'width' | 'height'> {
|
|
7
7
|
children?: React.ReactNode;
|
|
8
8
|
}
|
|
9
9
|
declare const GaugeContainer: React.ForwardRefExoticComponent<Omit<GaugeContainerProps, "ref"> & React.RefAttributes<SVGSVGElement>>;
|
|
@@ -1,22 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
|
-
import { area as d3Area } from '@mui/x-charts-vendor/d3-shape';
|
|
10
9
|
import { AreaElement, areaElementClasses } from "./AreaElement.js";
|
|
11
|
-
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
12
|
-
import { getCurveFactory } from "../internals/getCurve.js";
|
|
13
|
-
import { isBandScale } from "../internals/isBandScale.js";
|
|
14
|
-
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
15
|
-
import { useLineSeriesContext } from "../hooks/useLineSeries.js";
|
|
16
10
|
import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
|
|
17
|
-
import { useChartGradientIdBuilder } from "../hooks/useChartGradientId.js";
|
|
18
11
|
import { useXAxes, useYAxes } from "../hooks/useAxis.js";
|
|
19
12
|
import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js";
|
|
13
|
+
import { useAreaPlotData } from "./useAreaPlotData.js";
|
|
20
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
15
|
const AreaPlotRoot = styled('g', {
|
|
22
16
|
name: 'MuiAreaPlot',
|
|
@@ -27,117 +21,13 @@ const AreaPlotRoot = styled('g', {
|
|
|
27
21
|
}
|
|
28
22
|
});
|
|
29
23
|
const useAggregatedData = () => {
|
|
30
|
-
const seriesData = useLineSeriesContext();
|
|
31
24
|
const {
|
|
32
|
-
xAxis
|
|
33
|
-
xAxisIds
|
|
25
|
+
xAxis: xAxes
|
|
34
26
|
} = useXAxes();
|
|
35
27
|
const {
|
|
36
|
-
yAxis
|
|
37
|
-
yAxisIds
|
|
28
|
+
yAxis: yAxes
|
|
38
29
|
} = useYAxes();
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
// This memo prevents odd line chart behavior when hydrating.
|
|
42
|
-
const allData = React.useMemo(() => {
|
|
43
|
-
if (seriesData === undefined) {
|
|
44
|
-
return [];
|
|
45
|
-
}
|
|
46
|
-
const {
|
|
47
|
-
series,
|
|
48
|
-
stackingGroups
|
|
49
|
-
} = seriesData;
|
|
50
|
-
const defaultXAxisId = xAxisIds[0];
|
|
51
|
-
const defaultYAxisId = yAxisIds[0];
|
|
52
|
-
return stackingGroups.flatMap(({
|
|
53
|
-
ids: groupIds
|
|
54
|
-
}) => {
|
|
55
|
-
return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
|
|
56
|
-
.map(seriesId => {
|
|
57
|
-
const {
|
|
58
|
-
xAxisId = defaultXAxisId,
|
|
59
|
-
yAxisId = defaultYAxisId,
|
|
60
|
-
stackedData,
|
|
61
|
-
data,
|
|
62
|
-
connectNulls,
|
|
63
|
-
baseline,
|
|
64
|
-
curve,
|
|
65
|
-
strictStepCurve
|
|
66
|
-
} = series[seriesId];
|
|
67
|
-
const xScale = xAxis[xAxisId].scale;
|
|
68
|
-
const xPosition = getValueToPositionMapper(xScale);
|
|
69
|
-
const yScale = yAxis[yAxisId].scale;
|
|
70
|
-
const xData = xAxis[xAxisId].data;
|
|
71
|
-
const gradientId = yAxis[yAxisId].colorScale && getGradientId(yAxisId) || xAxis[xAxisId].colorScale && getGradientId(xAxisId) || undefined;
|
|
72
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
73
|
-
if (xData === undefined) {
|
|
74
|
-
throw new Error(`MUI X Charts: ${xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
75
|
-
}
|
|
76
|
-
if (xData.length < stackedData.length) {
|
|
77
|
-
throw new Error(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
const shouldExpand = curve?.includes('step') && !strictStepCurve && isBandScale(xScale);
|
|
81
|
-
const formattedData = xData?.flatMap((x, index) => {
|
|
82
|
-
const nullData = data[index] == null;
|
|
83
|
-
if (shouldExpand) {
|
|
84
|
-
const rep = [{
|
|
85
|
-
x,
|
|
86
|
-
y: stackedData[index],
|
|
87
|
-
nullData,
|
|
88
|
-
isExtension: false
|
|
89
|
-
}];
|
|
90
|
-
if (!nullData && (index === 0 || data[index - 1] == null)) {
|
|
91
|
-
rep.unshift({
|
|
92
|
-
x: (xScale(x) ?? 0) - (xScale.step() - xScale.bandwidth()) / 2,
|
|
93
|
-
y: stackedData[index],
|
|
94
|
-
nullData,
|
|
95
|
-
isExtension: true
|
|
96
|
-
});
|
|
97
|
-
}
|
|
98
|
-
if (!nullData && (index === data.length - 1 || data[index + 1] == null)) {
|
|
99
|
-
rep.push({
|
|
100
|
-
x: (xScale(x) ?? 0) + (xScale.step() + xScale.bandwidth()) / 2,
|
|
101
|
-
y: stackedData[index],
|
|
102
|
-
nullData,
|
|
103
|
-
isExtension: true
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
return rep;
|
|
107
|
-
}
|
|
108
|
-
return {
|
|
109
|
-
x,
|
|
110
|
-
y: stackedData[index],
|
|
111
|
-
nullData
|
|
112
|
-
};
|
|
113
|
-
}) ?? [];
|
|
114
|
-
const d3Data = connectNulls ? formattedData.filter(d => !d.nullData) : formattedData;
|
|
115
|
-
const areaPath = d3Area().x(d => d.isExtension ? d.x : xPosition(d.x)).defined(d => connectNulls || !d.nullData || !!d.isExtension).y0(d => {
|
|
116
|
-
if (typeof baseline === 'number') {
|
|
117
|
-
return yScale(baseline);
|
|
118
|
-
}
|
|
119
|
-
if (baseline === 'max') {
|
|
120
|
-
return yScale.range()[1];
|
|
121
|
-
}
|
|
122
|
-
if (baseline === 'min') {
|
|
123
|
-
return yScale.range()[0];
|
|
124
|
-
}
|
|
125
|
-
const value = d.y && yScale(d.y[0]);
|
|
126
|
-
if (Number.isNaN(value)) {
|
|
127
|
-
return yScale.range()[0];
|
|
128
|
-
}
|
|
129
|
-
return value;
|
|
130
|
-
}).y1(d => d.y && yScale(d.y[1]));
|
|
131
|
-
const d = areaPath.curve(getCurveFactory(curve))(d3Data) || '';
|
|
132
|
-
return _extends({}, series[seriesId], {
|
|
133
|
-
gradientId,
|
|
134
|
-
d,
|
|
135
|
-
seriesId
|
|
136
|
-
});
|
|
137
|
-
});
|
|
138
|
-
});
|
|
139
|
-
}, [seriesData, xAxisIds, yAxisIds, xAxis, yAxis, getGradientId]);
|
|
140
|
-
return allData;
|
|
30
|
+
return useAreaPlotData(xAxes, yAxes);
|
|
141
31
|
};
|
|
142
32
|
|
|
143
33
|
/**
|
|
@@ -111,6 +111,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
111
111
|
* If `true`, render the line highlight item.
|
|
112
112
|
*/
|
|
113
113
|
disableLineItemHighlight: PropTypes.bool,
|
|
114
|
+
/**
|
|
115
|
+
* Options to enable features planned for the next major.
|
|
116
|
+
*/
|
|
117
|
+
experimentalFeatures: PropTypes.shape({
|
|
118
|
+
preferStrictDomainInLineCharts: PropTypes.bool
|
|
119
|
+
}),
|
|
114
120
|
/**
|
|
115
121
|
* Option to display a cartesian grid in the background.
|
|
116
122
|
*/
|
|
@@ -126,6 +132,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
126
132
|
* If `true`, the legend is not rendered.
|
|
127
133
|
*/
|
|
128
134
|
hideLegend: PropTypes.bool,
|
|
135
|
+
/**
|
|
136
|
+
* The controlled axis highlight.
|
|
137
|
+
* Identified by the axis id, and data index.
|
|
138
|
+
*/
|
|
139
|
+
highlightedAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
140
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
141
|
+
dataIndex: PropTypes.number.isRequired
|
|
142
|
+
})),
|
|
129
143
|
/**
|
|
130
144
|
* The highlighted item.
|
|
131
145
|
* Used when the highlight is controlled.
|
|
@@ -177,6 +191,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
177
191
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
178
192
|
*/
|
|
179
193
|
onHighlightChange: PropTypes.func,
|
|
194
|
+
/**
|
|
195
|
+
* The function called when the pointer position corresponds to a new axis data item.
|
|
196
|
+
* This update can either be caused by a pointer movement, or an axis update.
|
|
197
|
+
* In case of multiple axes, the function is called if at least one axis is updated.
|
|
198
|
+
* The argument contains the identifier for all axes with a `data` property.
|
|
199
|
+
* @param {AxisItemIdentifier[]} axisItems The array of axes item identifiers.
|
|
200
|
+
*/
|
|
201
|
+
onHighlightedAxisChange: PropTypes.func,
|
|
180
202
|
/**
|
|
181
203
|
* Callback fired when a line element is clicked.
|
|
182
204
|
*/
|
|
@@ -13,7 +13,7 @@ import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
|
13
13
|
import { useLineSeriesContext } from "../hooks/useLineSeries.js";
|
|
14
14
|
import getColor from "./seriesConfig/getColor.js";
|
|
15
15
|
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
16
|
-
import {
|
|
16
|
+
import { selectorChartsHighlightXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
17
17
|
import { useXAxes, useYAxes } from "../hooks/useAxis.js";
|
|
18
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
19
|
/**
|
|
@@ -45,8 +45,8 @@ function LineHighlightPlot(props) {
|
|
|
45
45
|
instance
|
|
46
46
|
} = useChartContext();
|
|
47
47
|
const store = useStore();
|
|
48
|
-
const
|
|
49
|
-
if (
|
|
48
|
+
const highlightedIndexes = useSelector(store, selectorChartsHighlightXAxisIndex);
|
|
49
|
+
if (highlightedIndexes.length === 0) {
|
|
50
50
|
return null;
|
|
51
51
|
}
|
|
52
52
|
if (seriesData === undefined) {
|
|
@@ -60,7 +60,10 @@ function LineHighlightPlot(props) {
|
|
|
60
60
|
const defaultYAxisId = yAxisIds[0];
|
|
61
61
|
const Element = slots?.lineHighlight ?? LineHighlightElement;
|
|
62
62
|
return /*#__PURE__*/_jsx("g", _extends({}, other, {
|
|
63
|
-
children:
|
|
63
|
+
children: highlightedIndexes.flatMap(({
|
|
64
|
+
dataIndex: highlightedIndex,
|
|
65
|
+
axisId: highlightedAxisId
|
|
66
|
+
}) => stackingGroups.flatMap(({
|
|
64
67
|
ids: groupIds
|
|
65
68
|
}) => {
|
|
66
69
|
return groupIds.flatMap(seriesId => {
|
|
@@ -75,6 +78,9 @@ function LineHighlightPlot(props) {
|
|
|
75
78
|
if (disableHighlight || data[highlightedIndex] == null) {
|
|
76
79
|
return null;
|
|
77
80
|
}
|
|
81
|
+
if (highlightedAxisId !== xAxisId) {
|
|
82
|
+
return null;
|
|
83
|
+
}
|
|
78
84
|
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
79
85
|
const yScale = yAxis[yAxisId].scale;
|
|
80
86
|
const xData = xAxis[xAxisId].data;
|
|
@@ -96,7 +102,7 @@ function LineHighlightPlot(props) {
|
|
|
96
102
|
shape: shape
|
|
97
103
|
}, slotProps?.lineHighlight), `${seriesId}`);
|
|
98
104
|
});
|
|
99
|
-
})
|
|
105
|
+
}))
|
|
100
106
|
}));
|
|
101
107
|
}
|
|
102
108
|
process.env.NODE_ENV !== "production" ? LineHighlightPlot.propTypes = {
|
|
@@ -1,23 +1,16 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
5
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { styled } from '@mui/material/styles';
|
|
9
|
-
import { warnOnce } from '@mui/x-internals/warning';
|
|
10
|
-
import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
|
|
11
9
|
import { LineElement, lineElementClasses } from "./LineElement.js";
|
|
12
|
-
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
13
|
-
import { getCurveFactory } from "../internals/getCurve.js";
|
|
14
|
-
import { isBandScale } from "../internals/isBandScale.js";
|
|
15
|
-
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
16
|
-
import { useLineSeriesContext } from "../hooks/useLineSeries.js";
|
|
17
10
|
import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
|
|
18
|
-
import { useChartGradientIdBuilder } from "../hooks/useChartGradientId.js";
|
|
19
11
|
import { useXAxes, useYAxes } from "../hooks/index.js";
|
|
20
12
|
import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js";
|
|
13
|
+
import { useLinePlotData } from "./useLinePlotData.js";
|
|
21
14
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
15
|
const LinePlotRoot = styled('g', {
|
|
23
16
|
name: 'MuiAreaPlot',
|
|
@@ -28,100 +21,13 @@ const LinePlotRoot = styled('g', {
|
|
|
28
21
|
}
|
|
29
22
|
});
|
|
30
23
|
const useAggregatedData = () => {
|
|
31
|
-
const seriesData = useLineSeriesContext();
|
|
32
24
|
const {
|
|
33
|
-
xAxis
|
|
34
|
-
xAxisIds
|
|
25
|
+
xAxis: xAxes
|
|
35
26
|
} = useXAxes();
|
|
36
27
|
const {
|
|
37
|
-
yAxis
|
|
38
|
-
yAxisIds
|
|
28
|
+
yAxis: yAxes
|
|
39
29
|
} = useYAxes();
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
// This memo prevents odd line chart behavior when hydrating.
|
|
43
|
-
const allData = React.useMemo(() => {
|
|
44
|
-
if (seriesData === undefined) {
|
|
45
|
-
return [];
|
|
46
|
-
}
|
|
47
|
-
const {
|
|
48
|
-
series,
|
|
49
|
-
stackingGroups
|
|
50
|
-
} = seriesData;
|
|
51
|
-
const defaultXAxisId = xAxisIds[0];
|
|
52
|
-
const defaultYAxisId = yAxisIds[0];
|
|
53
|
-
return stackingGroups.flatMap(({
|
|
54
|
-
ids: groupIds
|
|
55
|
-
}) => {
|
|
56
|
-
return groupIds.flatMap(seriesId => {
|
|
57
|
-
const {
|
|
58
|
-
xAxisId = defaultXAxisId,
|
|
59
|
-
yAxisId = defaultYAxisId,
|
|
60
|
-
stackedData,
|
|
61
|
-
data,
|
|
62
|
-
connectNulls,
|
|
63
|
-
curve,
|
|
64
|
-
strictStepCurve
|
|
65
|
-
} = series[seriesId];
|
|
66
|
-
const xScale = xAxis[xAxisId].scale;
|
|
67
|
-
const xPosition = getValueToPositionMapper(xScale);
|
|
68
|
-
const yScale = yAxis[yAxisId].scale;
|
|
69
|
-
const xData = xAxis[xAxisId].data;
|
|
70
|
-
const gradientId = yAxis[yAxisId].colorScale && getGradientId(yAxisId) || xAxis[xAxisId].colorScale && getGradientId(xAxisId) || undefined;
|
|
71
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
72
|
-
if (xData === undefined) {
|
|
73
|
-
throw new Error(`MUI X Charts: ${xAxisId === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : `The x-axis with id "${xAxisId}"`} should have data property to be able to display a line plot.`);
|
|
74
|
-
}
|
|
75
|
-
if (xData.length < stackedData.length) {
|
|
76
|
-
warnOnce(`MUI X Charts: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`, 'error');
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
const shouldExpand = curve?.includes('step') && !strictStepCurve && isBandScale(xScale);
|
|
80
|
-
const formattedData = xData?.flatMap((x, index) => {
|
|
81
|
-
const nullData = data[index] == null;
|
|
82
|
-
if (shouldExpand) {
|
|
83
|
-
const rep = [{
|
|
84
|
-
x,
|
|
85
|
-
y: stackedData[index],
|
|
86
|
-
nullData,
|
|
87
|
-
isExtension: false
|
|
88
|
-
}];
|
|
89
|
-
if (!nullData && (index === 0 || data[index - 1] == null)) {
|
|
90
|
-
rep.unshift({
|
|
91
|
-
x: (xScale(x) ?? 0) - (xScale.step() - xScale.bandwidth()) / 2,
|
|
92
|
-
y: stackedData[index],
|
|
93
|
-
nullData,
|
|
94
|
-
isExtension: true
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
if (!nullData && (index === data.length - 1 || data[index + 1] == null)) {
|
|
98
|
-
rep.push({
|
|
99
|
-
x: (xScale(x) ?? 0) + (xScale.step() + xScale.bandwidth()) / 2,
|
|
100
|
-
y: stackedData[index],
|
|
101
|
-
nullData,
|
|
102
|
-
isExtension: true
|
|
103
|
-
});
|
|
104
|
-
}
|
|
105
|
-
return rep;
|
|
106
|
-
}
|
|
107
|
-
return {
|
|
108
|
-
x,
|
|
109
|
-
y: stackedData[index],
|
|
110
|
-
nullData
|
|
111
|
-
};
|
|
112
|
-
}) ?? [];
|
|
113
|
-
const d3Data = connectNulls ? formattedData.filter(d => !d.nullData) : formattedData;
|
|
114
|
-
const linePath = d3Line().x(d => d.isExtension ? d.x : xPosition(d.x)).defined(d => connectNulls || !d.nullData || !!d.isExtension).y(d => yScale(d.y[1]));
|
|
115
|
-
const d = linePath.curve(getCurveFactory(curve))(d3Data) || '';
|
|
116
|
-
return _extends({}, series[seriesId], {
|
|
117
|
-
gradientId,
|
|
118
|
-
d,
|
|
119
|
-
seriesId
|
|
120
|
-
});
|
|
121
|
-
});
|
|
122
|
-
});
|
|
123
|
-
}, [seriesData, xAxisIds, yAxisIds, xAxis, yAxis, getGradientId]);
|
|
124
|
-
return allData;
|
|
30
|
+
return useLinePlotData(xAxes, yAxes);
|
|
125
31
|
};
|
|
126
32
|
|
|
127
33
|
/**
|
|
@@ -5,7 +5,6 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import * as React from 'react';
|
|
8
|
-
import { selectorChartsInteractionXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js";
|
|
9
8
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
10
9
|
import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
|
|
11
10
|
import { useChartId } from "../hooks/useChartId.js";
|
|
@@ -18,6 +17,7 @@ import { MarkElement } from "./MarkElement.js";
|
|
|
18
17
|
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
19
18
|
import { useItemHighlightedGetter, useXAxes, useYAxes } from "../hooks/index.js";
|
|
20
19
|
import { useInternalIsZoomInteracting } from "../internals/plugins/featurePlugins/useChartCartesianAxis/useInternalIsZoomInteracting.js";
|
|
20
|
+
import { selectorChartsHighlightXAxisIndex } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
21
21
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
22
22
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
23
23
|
/**
|
|
@@ -58,7 +58,21 @@ function MarkPlot(props) {
|
|
|
58
58
|
isFaded,
|
|
59
59
|
isHighlighted
|
|
60
60
|
} = useItemHighlightedGetter();
|
|
61
|
-
const
|
|
61
|
+
const xAxisHighlightIndexes = useSelector(store, selectorChartsHighlightXAxisIndex);
|
|
62
|
+
const highlightedItems = React.useMemo(() => {
|
|
63
|
+
const rep = {};
|
|
64
|
+
for (const {
|
|
65
|
+
dataIndex,
|
|
66
|
+
axisId
|
|
67
|
+
} of xAxisHighlightIndexes) {
|
|
68
|
+
if (rep[axisId] === undefined) {
|
|
69
|
+
rep[axisId] = new Set([dataIndex]);
|
|
70
|
+
} else {
|
|
71
|
+
rep[axisId].add(dataIndex);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
return rep;
|
|
75
|
+
}, [xAxisHighlightIndexes]);
|
|
62
76
|
if (seriesData === undefined) {
|
|
63
77
|
return null;
|
|
64
78
|
}
|
|
@@ -156,7 +170,7 @@ function MarkPlot(props) {
|
|
|
156
170
|
seriesId,
|
|
157
171
|
dataIndex: index
|
|
158
172
|
})),
|
|
159
|
-
isHighlighted:
|
|
173
|
+
isHighlighted: highlightedItems[xAxisId]?.has(index) || isSeriesHighlighted,
|
|
160
174
|
isFaded: isSeriesFaded
|
|
161
175
|
}, slotProps?.mark), `${seriesId}-${index}`);
|
|
162
176
|
})
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ComputedAxisConfig } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
2
|
+
import { ChartsXAxisProps, ChartsYAxisProps } from "../models/index.js";
|
|
3
|
+
import { SeriesId } from "../models/seriesType/common.js";
|
|
4
|
+
interface AreaPlotDataPoint {
|
|
5
|
+
d: string;
|
|
6
|
+
seriesId: SeriesId;
|
|
7
|
+
color: string;
|
|
8
|
+
area?: boolean;
|
|
9
|
+
gradientId?: string;
|
|
10
|
+
}
|
|
11
|
+
export declare function useAreaPlotData(xAxes: ComputedAxisConfig<ChartsXAxisProps>, yAxes: ComputedAxisConfig<ChartsYAxisProps>): AreaPlotDataPoint[];
|
|
12
|
+
export {};
|