@mui/x-charts 8.0.0-alpha.0 → 8.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/AnimatedBarElement.d.ts +15 -0
- package/BarChart/AnimatedBarElement.js +21 -0
- package/BarChart/BarChart.d.ts +4 -9
- package/BarChart/BarChart.js +3 -31
- package/BarChart/BarElement.d.ts +5 -1342
- package/BarChart/BarElement.js +10 -20
- package/BarChart/BarPlot.js +12 -2
- package/BarChart/useBarChartProps.d.ts +0 -2
- package/BarChart/useBarChartProps.js +2 -8
- package/CHANGELOG.md +429 -5
- package/ChartContainer/ChartContainer.d.ts +2 -19
- package/ChartContainer/ChartContainer.js +10 -20
- package/ChartContainer/ResizableContainer.d.ts +17 -4
- package/ChartContainer/ResizableContainer.js +36 -2
- package/ChartContainer/useChartContainerProps.d.ts +6 -7
- package/ChartContainer/useChartContainerProps.js +14 -28
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +1 -17
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.d.ts +5 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.d.ts +6 -0
- package/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.d.ts +10 -0
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.d.ts +7 -0
- package/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/ChartsAxisHighlight/index.d.ts +3 -0
- package/ChartsAxisHighlight/index.js +4 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsGrid/ChartsHorizontalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/ChartsGrid/ChartsVerticalGrid.d.ts +2 -2
- package/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/ChartsLegend/LegendPerItem.d.ts +2 -2
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/ChartsSurface/ChartsSurface.d.ts +0 -15
- package/ChartsSurface/ChartsSurface.js +35 -34
- package/ChartsTooltip/ChartTooltip.types.d.ts +15 -0
- package/ChartsTooltip/ChartTooltip.types.js +1 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +7 -39
- package/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +5 -28
- package/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/ChartsTooltip/ChartsTooltip.d.ts +3 -69
- package/ChartsTooltip/ChartsTooltip.js +161 -145
- package/ChartsTooltip/ChartsTooltipContainer.d.ts +33 -0
- package/ChartsTooltip/ChartsTooltipContainer.js +298 -0
- package/ChartsTooltip/chartsTooltipClasses.d.ts +1 -0
- package/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/ChartsTooltip/index.d.ts +3 -3
- package/ChartsTooltip/index.js +2 -3
- package/ChartsTooltip/useAxisTooltip.d.ts +2 -2
- package/ChartsTooltip/useAxisTooltip.js +19 -19
- package/ChartsTooltip/useItemTooltip.d.ts +1 -1
- package/ChartsTooltip/useItemTooltip.js +5 -4
- package/ChartsTooltip/utils.d.ts +0 -3
- package/ChartsTooltip/utils.js +0 -8
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +47 -34
- package/Gauge/Gauge.d.ts +1 -1
- package/Gauge/Gauge.js +0 -6
- package/Gauge/GaugeContainer.d.ts +3 -3
- package/Gauge/GaugeContainer.js +60 -61
- package/LineChart/AnimatedArea.d.ts +0 -1333
- package/LineChart/AnimatedArea.js +9 -18
- package/LineChart/AnimatedLine.d.ts +0 -1333
- package/LineChart/AnimatedLine.js +9 -20
- package/LineChart/AreaPlot.js +12 -2
- package/LineChart/CircleMarkElement.js +6 -5
- package/LineChart/LineChart.d.ts +4 -10
- package/LineChart/LineChart.js +3 -32
- package/LineChart/LineHighlightPlot.js +6 -5
- package/LineChart/LinePlot.js +12 -2
- package/LineChart/MarkElement.js +6 -5
- package/LineChart/useLineChartProps.d.ts +0 -2
- package/LineChart/useLineChartProps.js +2 -8
- package/PieChart/PieChart.d.ts +3 -9
- package/PieChart/PieChart.js +5 -37
- package/PieChart/PiePlot.js +2 -2
- package/PieChart/getPieCoordinates.d.ts +2 -2
- package/README.md +2 -2
- package/ScatterChart/Scatter.js +6 -5
- package/ScatterChart/ScatterChart.d.ts +4 -10
- package/ScatterChart/ScatterChart.js +5 -32
- package/ScatterChart/useScatterChartProps.d.ts +0 -2
- package/ScatterChart/useScatterChartProps.js +1 -9
- package/SparkLineChart/SparkLineChart.d.ts +3 -4
- package/SparkLineChart/SparkLineChart.js +4 -31
- package/context/ChartDataProvider/ChartDataProvider.d.ts +9 -19
- package/context/ChartDataProvider/ChartDataProvider.js +30 -43
- package/context/ChartDataProvider/useChartDataProviderProps.d.ts +7 -10
- package/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/context/{DrawingProvider.d.ts → DrawingAreaProvider/DrawingArea.types.d.ts} +3 -14
- package/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.d.ts +8 -0
- package/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
- package/context/DrawingAreaProvider/DrawingAreaProvider.d.ts +3 -0
- package/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/context/DrawingAreaProvider/index.d.ts +3 -0
- package/context/DrawingAreaProvider/index.js +3 -0
- package/context/InteractionProvider.d.ts +5 -48
- package/context/InteractionProvider.js +8 -64
- package/context/InteractionSelectors.d.ts +359 -0
- package/context/InteractionSelectors.js +12 -0
- package/context/SizeProvider/Size.types.d.ts +30 -0
- package/context/SizeProvider/Size.types.js +1 -0
- package/context/SizeProvider/SizeContext.d.ts +4 -0
- package/context/SizeProvider/SizeContext.js +13 -0
- package/context/SizeProvider/SizeProvider.d.ts +11 -0
- package/context/SizeProvider/SizeProvider.js +26 -0
- package/context/SizeProvider/index.d.ts +4 -0
- package/context/SizeProvider/index.js +4 -0
- package/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.d.ts +4 -1
- package/{modern/ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +11 -5
- package/context/SizeProvider/useSize.d.ts +5 -0
- package/context/SizeProvider/useSize.js +13 -0
- package/context/SvgRefProvider/SvgRef.types.d.ts +8 -0
- package/context/SvgRefProvider/SvgRef.types.js +1 -0
- package/context/SvgRefProvider/SvgRefContext.d.ts +4 -0
- package/context/SvgRefProvider/SvgRefContext.js +17 -0
- package/context/SvgRefProvider/SvgRefProvider.d.ts +3 -0
- package/context/SvgRefProvider/SvgRefProvider.js +24 -0
- package/context/SvgRefProvider/index.d.ts +4 -0
- package/context/SvgRefProvider/index.js +4 -0
- package/context/SvgRefProvider/useSurfaceRef.d.ts +2 -0
- package/context/SvgRefProvider/useSurfaceRef.js +14 -0
- package/context/index.d.ts +2 -0
- package/context/index.js +2 -1
- package/hooks/useAxisEvents.js +32 -19
- package/hooks/useChartId.js +2 -2
- package/hooks/useDrawingArea.d.ts +2 -2
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +19 -12
- package/hooks/useSvgRef.js +3 -3
- package/index.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.d.ts +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/internals/computeAxisValue.d.ts +2 -2
- package/internals/index.d.ts +3 -2
- package/internals/index.js +3 -2
- package/internals/plugins/models/index.d.ts +35 -0
- package/internals/plugins/models/index.js +1 -0
- package/internals/plugins/utils/ChartStore.d.ts +12 -0
- package/internals/plugins/utils/ChartStore.js +26 -0
- package/internals/plugins/utils/ChartsStore.d.ts +12 -0
- package/internals/plugins/utils/ChartsStore.js +26 -0
- package/internals/plugins/utils/selectors.d.ts +9 -0
- package/internals/plugins/utils/selectors.js +37 -0
- package/internals/useCharts.d.ts +6 -0
- package/internals/useCharts.js +29 -0
- package/internals/useSelector.d.ts +4 -0
- package/internals/useSelector.js +6 -0
- package/internals/useStore.d.ts +2 -0
- package/internals/useStore.js +17 -0
- package/modern/BarChart/AnimatedBarElement.js +21 -0
- package/modern/BarChart/BarChart.js +3 -31
- package/modern/BarChart/BarElement.js +10 -20
- package/modern/BarChart/BarPlot.js +12 -2
- package/modern/BarChart/useBarChartProps.js +2 -8
- package/modern/ChartContainer/ChartContainer.js +10 -20
- package/modern/ChartContainer/ResizableContainer.js +36 -2
- package/modern/ChartContainer/useChartContainerProps.js +14 -28
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +10 -96
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.types.js +1 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlightPath.js +34 -0
- package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +53 -0
- package/modern/ChartsAxisHighlight/chartsAxisHighlightClasses.js +6 -0
- package/modern/ChartsAxisHighlight/index.js +4 -1
- package/modern/ChartsGrid/ChartsGrid.js +1 -1
- package/modern/ChartsGrid/ChartsHorizontalGrid.js +3 -3
- package/modern/ChartsGrid/ChartsVerticalGrid.js +3 -3
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/modern/ChartsSurface/ChartsSurface.js +35 -34
- package/modern/ChartsTooltip/ChartTooltip.types.js +1 -0
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +83 -72
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +54 -44
- package/modern/ChartsTooltip/ChartsTooltip.js +161 -145
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +298 -0
- package/modern/ChartsTooltip/chartsTooltipClasses.js +18 -2
- package/modern/ChartsTooltip/index.js +2 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +19 -19
- package/modern/ChartsTooltip/useItemTooltip.js +5 -4
- package/modern/ChartsTooltip/utils.js +0 -8
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +47 -34
- package/modern/Gauge/Gauge.js +0 -6
- package/modern/Gauge/GaugeContainer.js +60 -61
- package/modern/LineChart/AnimatedArea.js +9 -18
- package/modern/LineChart/AnimatedLine.js +9 -20
- package/modern/LineChart/AreaPlot.js +12 -2
- package/modern/LineChart/CircleMarkElement.js +6 -5
- package/modern/LineChart/LineChart.js +3 -32
- package/modern/LineChart/LineHighlightPlot.js +6 -5
- package/modern/LineChart/LinePlot.js +12 -2
- package/modern/LineChart/MarkElement.js +6 -5
- package/modern/LineChart/useLineChartProps.js +2 -8
- package/modern/PieChart/PieChart.js +5 -37
- package/modern/PieChart/PiePlot.js +2 -2
- package/modern/ScatterChart/Scatter.js +6 -5
- package/modern/ScatterChart/ScatterChart.js +5 -32
- package/modern/ScatterChart/useScatterChartProps.js +1 -9
- package/modern/SparkLineChart/SparkLineChart.js +4 -31
- package/modern/context/ChartDataProvider/ChartDataProvider.js +30 -43
- package/modern/context/ChartDataProvider/useChartDataProviderProps.js +22 -42
- package/modern/context/DrawingAreaProvider/DrawingArea.types.js +1 -0
- package/modern/context/DrawingAreaProvider/DrawingAreaContext.js +16 -0
- package/modern/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +11 -41
- package/modern/context/DrawingAreaProvider/index.js +3 -0
- package/modern/context/InteractionProvider.js +8 -64
- package/modern/context/InteractionSelectors.js +12 -0
- package/modern/context/SizeProvider/Size.types.js +1 -0
- package/modern/context/SizeProvider/SizeContext.js +13 -0
- package/modern/context/SizeProvider/SizeProvider.js +26 -0
- package/modern/context/SizeProvider/index.js +4 -0
- package/{ChartContainer → modern/context/SizeProvider}/useChartContainerDimensions.js +11 -5
- package/modern/context/SizeProvider/useSize.js +13 -0
- package/modern/context/SvgRefProvider/SvgRef.types.js +1 -0
- package/modern/context/SvgRefProvider/SvgRefContext.js +17 -0
- package/modern/context/SvgRefProvider/SvgRefProvider.js +24 -0
- package/modern/context/SvgRefProvider/index.js +4 -0
- package/modern/context/SvgRefProvider/useSurfaceRef.js +14 -0
- package/modern/context/index.js +2 -1
- package/modern/hooks/useAxisEvents.js +32 -19
- package/modern/hooks/useChartId.js +2 -2
- package/modern/hooks/useDrawingArea.js +2 -2
- package/modern/hooks/useInteractionItemProps.js +19 -12
- package/modern/hooks/useSvgRef.js +3 -3
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/modern/internals/index.js +3 -2
- package/modern/internals/plugins/models/index.js +1 -0
- package/modern/internals/plugins/utils/ChartStore.js +26 -0
- package/modern/internals/plugins/utils/ChartsStore.js +26 -0
- package/modern/internals/plugins/utils/selectors.js +37 -0
- package/modern/internals/useCharts.js +29 -0
- package/modern/internals/useSelector.js +6 -0
- package/modern/internals/useStore.js +17 -0
- package/node/BarChart/AnimatedBarElement.js +28 -0
- package/node/BarChart/BarChart.js +3 -31
- package/node/BarChart/BarElement.js +11 -21
- package/node/BarChart/BarPlot.js +11 -1
- package/node/BarChart/useBarChartProps.js +2 -8
- package/node/ChartContainer/ChartContainer.js +10 -20
- package/node/ChartContainer/ResizableContainer.js +39 -3
- package/node/ChartContainer/useChartContainerProps.js +14 -28
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +12 -100
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.types.js +5 -0
- package/node/ChartsAxisHighlight/ChartsAxisHighlightPath.js +40 -0
- package/node/ChartsAxisHighlight/ChartsXAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/ChartsYAxisHighlight.js +57 -0
- package/node/ChartsAxisHighlight/chartsAxisHighlightClasses.js +14 -0
- package/node/ChartsAxisHighlight/index.js +33 -0
- package/node/ChartsGrid/ChartsGrid.js +2 -2
- package/node/ChartsGrid/ChartsHorizontalGrid.js +4 -4
- package/node/ChartsGrid/ChartsVerticalGrid.js +4 -4
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +9 -7
- package/node/ChartsSurface/ChartsSurface.js +35 -34
- package/node/ChartsTooltip/ChartTooltip.types.js +5 -0
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +83 -73
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +54 -45
- package/node/ChartsTooltip/ChartsTooltip.js +160 -144
- package/node/ChartsTooltip/ChartsTooltipContainer.js +304 -0
- package/node/ChartsTooltip/chartsTooltipClasses.js +22 -3
- package/node/ChartsTooltip/index.js +19 -28
- package/node/ChartsTooltip/useAxisTooltip.js +19 -19
- package/node/ChartsTooltip/useItemTooltip.js +5 -4
- package/node/ChartsTooltip/utils.js +0 -9
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +48 -35
- package/node/Gauge/Gauge.js +0 -6
- package/node/Gauge/GaugeContainer.js +60 -61
- package/node/LineChart/AnimatedArea.js +9 -19
- package/node/LineChart/AnimatedLine.js +9 -21
- package/node/LineChart/AreaPlot.js +11 -1
- package/node/LineChart/CircleMarkElement.js +6 -5
- package/node/LineChart/LineChart.js +3 -32
- package/node/LineChart/LineHighlightPlot.js +6 -5
- package/node/LineChart/LinePlot.js +11 -1
- package/node/LineChart/MarkElement.js +6 -5
- package/node/LineChart/useLineChartProps.js +2 -8
- package/node/PieChart/PieChart.js +5 -37
- package/node/PieChart/PiePlot.js +2 -2
- package/node/ScatterChart/Scatter.js +6 -5
- package/node/ScatterChart/ScatterChart.js +5 -32
- package/node/ScatterChart/useScatterChartProps.js +1 -9
- package/node/SparkLineChart/SparkLineChart.js +4 -31
- package/node/context/ChartDataProvider/ChartDataProvider.js +30 -43
- package/node/context/ChartDataProvider/useChartDataProviderProps.js +22 -44
- package/node/context/DrawingAreaProvider/DrawingArea.types.js +5 -0
- package/node/context/DrawingAreaProvider/DrawingAreaContext.js +22 -0
- package/node/context/{DrawingProvider.js → DrawingAreaProvider/DrawingAreaProvider.js} +12 -44
- package/node/context/DrawingAreaProvider/index.js +38 -0
- package/node/context/InteractionProvider.js +9 -66
- package/node/context/InteractionSelectors.js +18 -0
- package/node/context/SizeProvider/Size.types.js +5 -0
- package/node/context/SizeProvider/SizeContext.js +20 -0
- package/node/context/SizeProvider/SizeProvider.js +29 -0
- package/node/context/SizeProvider/index.js +49 -0
- package/node/{ChartContainer → context/SizeProvider}/useChartContainerDimensions.js +11 -5
- package/node/context/SizeProvider/useSize.js +20 -0
- package/node/context/SvgRefProvider/SvgRef.types.js +5 -0
- package/node/context/SvgRefProvider/SvgRefContext.js +23 -0
- package/node/context/SvgRefProvider/SvgRefProvider.js +31 -0
- package/node/context/SvgRefProvider/index.js +49 -0
- package/node/context/SvgRefProvider/useSurfaceRef.js +20 -0
- package/node/context/index.js +10 -2
- package/node/hooks/useAxisEvents.js +33 -19
- package/node/hooks/useChartId.js +2 -2
- package/node/hooks/useDrawingArea.js +2 -2
- package/node/hooks/useInteractionItemProps.js +20 -13
- package/node/hooks/useSvgRef.js +3 -3
- package/node/index.js +1 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +9 -4
- package/node/internals/index.js +28 -16
- package/node/internals/plugins/models/index.js +5 -0
- package/node/internals/plugins/utils/ChartStore.js +33 -0
- package/node/internals/plugins/utils/ChartsStore.js +33 -0
- package/node/internals/plugins/utils/selectors.js +44 -0
- package/node/internals/useCharts.js +36 -0
- package/node/internals/useSelector.js +13 -0
- package/node/internals/useStore.js +24 -0
- package/package.json +7 -5
- package/themeAugmentation/props.d.ts +1 -2
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.d.ts +0 -7
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/ChartsTooltip/DefaultChartsItemTooltipContent.d.ts +0 -8
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -123
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -92
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -129
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -98
- /package/ChartsGrid/{styledCommonents.d.ts → styledComponents.d.ts} +0 -0
- /package/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/modern/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
- /package/node/ChartsGrid/{styledCommonents.js → styledComponents.js} +0 -0
|
@@ -6,25 +6,9 @@ const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { animated, useTransition } from '@react-spring/web';
|
|
9
|
-
import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
|
|
10
|
-
import { styled } from '@mui/material/styles';
|
|
11
9
|
import { useStringInterpolator } from "../internals/useStringInterpolator.js";
|
|
12
10
|
import { AppearingMask } from "./AppearingMask.js";
|
|
13
11
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
export const LineElementPath = styled(animated.path, {
|
|
15
|
-
name: 'MuiLineElement',
|
|
16
|
-
slot: 'Root',
|
|
17
|
-
overridesResolver: (_, styles) => styles.root
|
|
18
|
-
})(({
|
|
19
|
-
ownerState
|
|
20
|
-
}) => ({
|
|
21
|
-
strokeWidth: 2,
|
|
22
|
-
strokeLinejoin: 'round',
|
|
23
|
-
fill: 'none',
|
|
24
|
-
stroke: ownerState.gradientId && `url(#${ownerState.gradientId})` || ownerState.isHighlighted && d3Color(ownerState.color).brighter(0.5).formatHex() || ownerState.color,
|
|
25
|
-
transition: 'opacity 0.2s ease-in, stroke 0.2s ease-in',
|
|
26
|
-
opacity: ownerState.isFaded ? 0.3 : 1
|
|
27
|
-
}));
|
|
28
12
|
/**
|
|
29
13
|
* Demos:
|
|
30
14
|
*
|
|
@@ -59,10 +43,15 @@ function AnimatedLine(props) {
|
|
|
59
43
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
60
44
|
skipAnimation: skipAnimation,
|
|
61
45
|
id: `${ownerState.id}-line-clip`,
|
|
62
|
-
children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
46
|
+
children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(animated.path, _extends({
|
|
47
|
+
d: style.value.to(interpolator),
|
|
48
|
+
stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
49
|
+
strokeWidth: 2,
|
|
50
|
+
strokeLinejoin: "round",
|
|
51
|
+
fill: "none",
|
|
52
|
+
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
53
|
+
opacity: ownerState.isFaded ? 0.3 : 1
|
|
54
|
+
}, other)))
|
|
66
55
|
});
|
|
67
56
|
}
|
|
68
57
|
process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -5,9 +5,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
5
5
|
const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
8
9
|
import { area as d3Area } from '@mui/x-charts-vendor/d3-shape';
|
|
9
10
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
10
|
-
import { AreaElement } from "./AreaElement.js";
|
|
11
|
+
import { AreaElement, areaElementClasses } from "./AreaElement.js";
|
|
11
12
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
12
13
|
import getCurveFactory from "../internals/getCurve.js";
|
|
13
14
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -15,6 +16,15 @@ import { useChartGradient } from "../internals/components/ChartsAxesGradients/in
|
|
|
15
16
|
import { useLineSeries } from "../hooks/useSeries.js";
|
|
16
17
|
import { useSkipAnimation } from "../context/AnimationProvider/index.js";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
const AreaPlotRoot = styled('g', {
|
|
20
|
+
name: 'MuiAreaPlot',
|
|
21
|
+
slot: 'Root',
|
|
22
|
+
overridesResolver: (_, styles) => styles.root
|
|
23
|
+
})({
|
|
24
|
+
[`& .${areaElementClasses.root}`]: {
|
|
25
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
18
28
|
const useAggregatedData = () => {
|
|
19
29
|
const seriesData = useLineSeries();
|
|
20
30
|
const axisData = useCartesianContext();
|
|
@@ -117,7 +127,7 @@ function AreaPlot(props) {
|
|
|
117
127
|
const skipAnimation = useSkipAnimation(inSkipAnimation);
|
|
118
128
|
const getGradientId = useChartGradient();
|
|
119
129
|
const completedData = useAggregatedData();
|
|
120
|
-
return /*#__PURE__*/_jsx(
|
|
130
|
+
return /*#__PURE__*/_jsx(AreaPlotRoot, _extends({}, other, {
|
|
121
131
|
children: completedData.map(({
|
|
122
132
|
d,
|
|
123
133
|
seriesId,
|
|
@@ -8,10 +8,12 @@ import PropTypes from 'prop-types';
|
|
|
8
8
|
import { useTheme } from '@mui/material/styles';
|
|
9
9
|
import { warnOnce } from '@mui/x-internals/warning';
|
|
10
10
|
import { animated, useSpring } from '@react-spring/web';
|
|
11
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
12
11
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
13
12
|
import { useItemHighlighted } from "../context/index.js";
|
|
14
13
|
import { useUtilityClasses } from "./markElementClasses.js";
|
|
14
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
15
|
+
import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
|
|
16
|
+
import { useStore } from "../internals/useStore.js";
|
|
15
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
18
|
/**
|
|
17
19
|
* The line mark element that only render circle for performance improvement.
|
|
@@ -49,9 +51,8 @@ function CircleMarkElement(props) {
|
|
|
49
51
|
} = useItemHighlighted({
|
|
50
52
|
seriesId: id
|
|
51
53
|
});
|
|
52
|
-
const
|
|
53
|
-
|
|
54
|
-
} = React.useContext(InteractionContext);
|
|
54
|
+
const store = useStore();
|
|
55
|
+
const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
|
|
55
56
|
const position = useSpring({
|
|
56
57
|
to: {
|
|
57
58
|
x,
|
|
@@ -62,7 +63,7 @@ function CircleMarkElement(props) {
|
|
|
62
63
|
const ownerState = {
|
|
63
64
|
id,
|
|
64
65
|
classes: innerClasses,
|
|
65
|
-
isHighlighted:
|
|
66
|
+
isHighlighted: xAxisIdentifier?.index === dataIndex || isHighlighted,
|
|
66
67
|
isFaded,
|
|
67
68
|
color
|
|
68
69
|
};
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -6,7 +6,7 @@ import { ChartContainerProps } from '../ChartContainer';
|
|
|
6
6
|
import { MarkPlotProps, MarkPlotSlotProps, MarkPlotSlots } from './MarkPlot';
|
|
7
7
|
import { ChartsAxisProps } from '../ChartsAxis/ChartsAxis';
|
|
8
8
|
import { LineSeriesType } from '../models/seriesType/line';
|
|
9
|
-
import {
|
|
9
|
+
import { ChartsTooltipSlots, ChartsTooltipSlotProps } from '../ChartsTooltip/ChartTooltip.types';
|
|
10
10
|
import { ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
11
11
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
12
12
|
import { ChartsAxisSlotProps, ChartsAxisSlots } from '../models/axis';
|
|
@@ -14,9 +14,9 @@ import { LineHighlightPlotSlots, LineHighlightPlotSlotProps } from './LineHighli
|
|
|
14
14
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
15
15
|
import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
|
|
16
16
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
17
|
-
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsTooltipSlots
|
|
17
|
+
export interface LineChartSlots extends ChartsAxisSlots, AreaPlotSlots, LinePlotSlots, MarkPlotSlots, LineHighlightPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {
|
|
18
18
|
}
|
|
19
|
-
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps
|
|
19
|
+
export interface LineChartSlotProps extends ChartsAxisSlotProps, AreaPlotSlotProps, LinePlotSlotProps, MarkPlotSlotProps, LineHighlightPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {
|
|
20
20
|
}
|
|
21
21
|
export interface LineChartProps extends Omit<ChartContainerProps, 'series' | 'plugins' | 'zAxis'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, ChartsOnAxisClickHandlerProps {
|
|
22
22
|
/**
|
|
@@ -24,19 +24,13 @@ export interface LineChartProps extends Omit<ChartContainerProps, 'series' | 'pl
|
|
|
24
24
|
* An array of [[LineSeriesType]] objects.
|
|
25
25
|
*/
|
|
26
26
|
series: MakeOptional<LineSeriesType, 'type'>[];
|
|
27
|
-
/**
|
|
28
|
-
* The configuration of the tooltip.
|
|
29
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
30
|
-
* @default { trigger: 'item' }
|
|
31
|
-
*/
|
|
32
|
-
tooltip?: ChartsTooltipProps<'line'>;
|
|
33
27
|
/**
|
|
34
28
|
* Option to display a cartesian grid in the background.
|
|
35
29
|
*/
|
|
36
30
|
grid?: Pick<ChartsGridProps, 'vertical' | 'horizontal'>;
|
|
37
31
|
/**
|
|
38
32
|
* The configuration of axes highlight.
|
|
39
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
33
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
40
34
|
* @default { x: 'line' }
|
|
41
35
|
*/
|
|
42
36
|
axisHighlight?: ChartsAxisHighlightProps;
|
package/LineChart/LineChart.js
CHANGED
|
@@ -48,9 +48,9 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
48
48
|
axisHighlightProps,
|
|
49
49
|
lineHighlightPlotProps,
|
|
50
50
|
legendProps,
|
|
51
|
-
tooltipProps,
|
|
52
51
|
children
|
|
53
52
|
} = useLineChartProps(props);
|
|
53
|
+
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
54
54
|
return /*#__PURE__*/_jsxs(ChartContainer, _extends({
|
|
55
55
|
ref: ref
|
|
56
56
|
}, chartContainerProps, {
|
|
@@ -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)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(
|
|
62
|
+
}), /*#__PURE__*/_jsx(LineHighlightPlot, _extends({}, lineHighlightPlotProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
63
63
|
}));
|
|
64
64
|
});
|
|
65
65
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
@@ -69,7 +69,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
69
69
|
// ----------------------------------------------------------------------
|
|
70
70
|
/**
|
|
71
71
|
* The configuration of axes highlight.
|
|
72
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
72
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
73
73
|
* @default { x: 'line' }
|
|
74
74
|
*/
|
|
75
75
|
axisHighlight: PropTypes.shape({
|
|
@@ -178,16 +178,6 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
178
178
|
* Callback fired when a mark element is clicked.
|
|
179
179
|
*/
|
|
180
180
|
onMarkClick: PropTypes.func,
|
|
181
|
-
/**
|
|
182
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
183
|
-
* before it renders for the first time.
|
|
184
|
-
*
|
|
185
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
186
|
-
* the first render, like when used inside a grid.
|
|
187
|
-
*
|
|
188
|
-
* @default false
|
|
189
|
-
*/
|
|
190
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
191
181
|
/**
|
|
192
182
|
* Indicate which axis to display the right of the charts.
|
|
193
183
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -216,31 +206,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
216
206
|
slots: PropTypes.object,
|
|
217
207
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
218
208
|
title: PropTypes.string,
|
|
219
|
-
/**
|
|
220
|
-
* The configuration of the tooltip.
|
|
221
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
222
|
-
* @default { trigger: 'item' }
|
|
223
|
-
*/
|
|
224
|
-
tooltip: PropTypes.shape({
|
|
225
|
-
axisContent: PropTypes.elementType,
|
|
226
|
-
classes: PropTypes.object,
|
|
227
|
-
itemContent: PropTypes.elementType,
|
|
228
|
-
slotProps: PropTypes.object,
|
|
229
|
-
slots: PropTypes.object,
|
|
230
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
231
|
-
}),
|
|
232
209
|
/**
|
|
233
210
|
* Indicate which axis to display the top of the charts.
|
|
234
211
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
235
212
|
* @default null
|
|
236
213
|
*/
|
|
237
214
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
238
|
-
viewBox: PropTypes.shape({
|
|
239
|
-
height: PropTypes.number,
|
|
240
|
-
width: PropTypes.number,
|
|
241
|
-
x: PropTypes.number,
|
|
242
|
-
y: PropTypes.number
|
|
243
|
-
}),
|
|
244
215
|
/**
|
|
245
216
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
246
217
|
*/
|
|
@@ -5,14 +5,16 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["slots", "slotProps"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { useStore } from "../internals/useStore.js";
|
|
9
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
8
10
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
9
11
|
import { LineHighlightElement } from "./LineHighlightElement.js";
|
|
10
12
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
11
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
12
13
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
13
14
|
import getColor from "./getColor.js";
|
|
14
15
|
import { useLineSeries } from "../hooks/useSeries.js";
|
|
15
16
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
17
|
+
import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
/**
|
|
18
20
|
* Demos:
|
|
@@ -33,10 +35,9 @@ function LineHighlightPlot(props) {
|
|
|
33
35
|
const seriesData = useLineSeries();
|
|
34
36
|
const axisData = useCartesianContext();
|
|
35
37
|
const drawingArea = useDrawingArea();
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
const highlightedIndex = axis.x?.index;
|
|
38
|
+
const store = useStore();
|
|
39
|
+
const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
|
|
40
|
+
const highlightedIndex = xAxisIdentifier?.index;
|
|
40
41
|
if (highlightedIndex === undefined) {
|
|
41
42
|
return null;
|
|
42
43
|
}
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -5,9 +5,10 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
5
5
|
const _excluded = ["slots", "slotProps", "skipAnimation", "onItemClick"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
8
9
|
import { line as d3Line } from '@mui/x-charts-vendor/d3-shape';
|
|
9
10
|
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
10
|
-
import { LineElement } from "./LineElement.js";
|
|
11
|
+
import { LineElement, lineElementClasses } from "./LineElement.js";
|
|
11
12
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
12
13
|
import getCurveFactory from "../internals/getCurve.js";
|
|
13
14
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -15,6 +16,15 @@ import { useChartGradient } from "../internals/components/ChartsAxesGradients/in
|
|
|
15
16
|
import { useLineSeries } from "../hooks/useSeries.js";
|
|
16
17
|
import { useSkipAnimation } from "../context/AnimationProvider/index.js";
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
|
+
const LinePlotRoot = styled('g', {
|
|
20
|
+
name: 'MuiAreaPlot',
|
|
21
|
+
slot: 'Root',
|
|
22
|
+
overridesResolver: (_, styles) => styles.root
|
|
23
|
+
})({
|
|
24
|
+
[`& .${lineElementClasses.root}`]: {
|
|
25
|
+
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in'
|
|
26
|
+
}
|
|
27
|
+
});
|
|
18
28
|
const useAggregatedData = () => {
|
|
19
29
|
const seriesData = useLineSeries();
|
|
20
30
|
const axisData = useCartesianContext();
|
|
@@ -98,7 +108,7 @@ function LinePlot(props) {
|
|
|
98
108
|
const skipAnimation = useSkipAnimation(inSkipAnimation);
|
|
99
109
|
const getGradientId = useChartGradient();
|
|
100
110
|
const completedData = useAggregatedData();
|
|
101
|
-
return /*#__PURE__*/_jsx(
|
|
111
|
+
return /*#__PURE__*/_jsx(LinePlotRoot, _extends({}, other, {
|
|
102
112
|
children: completedData.map(({
|
|
103
113
|
d,
|
|
104
114
|
seriesId,
|
package/LineChart/MarkElement.js
CHANGED
|
@@ -9,10 +9,12 @@ import { styled } from '@mui/material/styles';
|
|
|
9
9
|
import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from '@mui/x-charts-vendor/d3-shape';
|
|
10
10
|
import { animated, to, useSpring } from '@react-spring/web';
|
|
11
11
|
import { getSymbol } from "../internals/getSymbol.js";
|
|
12
|
-
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
13
12
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
14
13
|
import { useItemHighlighted } from "../context/index.js";
|
|
15
14
|
import { useUtilityClasses } from "./markElementClasses.js";
|
|
15
|
+
import { selectorChartsInteractionXAxis } from "../context/InteractionSelectors.js";
|
|
16
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
17
|
+
import { useStore } from "../internals/useStore.js";
|
|
16
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
19
|
const MarkElementPath = styled(animated.path, {
|
|
18
20
|
name: 'MuiMarkElement',
|
|
@@ -56,9 +58,8 @@ function MarkElement(props) {
|
|
|
56
58
|
} = useItemHighlighted({
|
|
57
59
|
seriesId: id
|
|
58
60
|
});
|
|
59
|
-
const
|
|
60
|
-
|
|
61
|
-
} = React.useContext(InteractionContext);
|
|
61
|
+
const store = useStore();
|
|
62
|
+
const xAxisIdentifier = useSelector(store, selectorChartsInteractionXAxis);
|
|
62
63
|
const position = useSpring({
|
|
63
64
|
to: {
|
|
64
65
|
x,
|
|
@@ -69,7 +70,7 @@ function MarkElement(props) {
|
|
|
69
70
|
const ownerState = {
|
|
70
71
|
id,
|
|
71
72
|
classes: innerClasses,
|
|
72
|
-
isHighlighted:
|
|
73
|
+
isHighlighted: xAxisIdentifier?.index === dataIndex || isHighlighted,
|
|
73
74
|
isFaded,
|
|
74
75
|
color
|
|
75
76
|
};
|
|
@@ -5,7 +5,6 @@ import { ChartsGridProps } from '../ChartsGrid';
|
|
|
5
5
|
import { ChartsLegendProps } from '../ChartsLegend';
|
|
6
6
|
import { ChartsOnAxisClickHandlerProps } from '../ChartsOnAxisClickHandler';
|
|
7
7
|
import { ChartsOverlayProps } from '../ChartsOverlay';
|
|
8
|
-
import { ChartsTooltipProps } from '../ChartsTooltip';
|
|
9
8
|
import { ChartContainerProps } from '../ChartContainer';
|
|
10
9
|
import { AreaPlotProps } from './AreaPlot';
|
|
11
10
|
import type { LineChartProps } from './LineChart';
|
|
@@ -35,6 +34,5 @@ export declare const useLineChartProps: (props: LineChartProps) => {
|
|
|
35
34
|
axisHighlightProps: ChartsAxisHighlightProps;
|
|
36
35
|
lineHighlightPlotProps: LineHighlightPlotProps;
|
|
37
36
|
legendProps: ChartsLegendProps;
|
|
38
|
-
tooltipProps: ChartsTooltipProps<"line">;
|
|
39
37
|
children: import("react").ReactNode;
|
|
40
38
|
};
|
|
@@ -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", "
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "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
|
/**
|
|
@@ -23,7 +23,6 @@ export const useLineChartProps = props => {
|
|
|
23
23
|
colors,
|
|
24
24
|
dataset,
|
|
25
25
|
sx,
|
|
26
|
-
tooltip,
|
|
27
26
|
onAxisClick,
|
|
28
27
|
onAreaClick,
|
|
29
28
|
onLineClick,
|
|
@@ -69,7 +68,7 @@ export const useLineChartProps = props => {
|
|
|
69
68
|
sx,
|
|
70
69
|
highlightedItem,
|
|
71
70
|
onHighlightChange,
|
|
72
|
-
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
71
|
+
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
73
72
|
className,
|
|
74
73
|
skipAnimation
|
|
75
74
|
});
|
|
@@ -127,10 +126,6 @@ export const useLineChartProps = props => {
|
|
|
127
126
|
slots,
|
|
128
127
|
slotProps
|
|
129
128
|
};
|
|
130
|
-
const tooltipProps = _extends({}, tooltip, {
|
|
131
|
-
slots,
|
|
132
|
-
slotProps
|
|
133
|
-
});
|
|
134
129
|
return {
|
|
135
130
|
chartContainerProps,
|
|
136
131
|
axisClickHandlerProps,
|
|
@@ -145,7 +140,6 @@ export const useLineChartProps = props => {
|
|
|
145
140
|
axisHighlightProps,
|
|
146
141
|
lineHighlightPlotProps,
|
|
147
142
|
legendProps,
|
|
148
|
-
tooltipProps,
|
|
149
143
|
children
|
|
150
144
|
};
|
|
151
145
|
};
|
package/PieChart/PieChart.d.ts
CHANGED
|
@@ -2,14 +2,14 @@ import * as React from 'react';
|
|
|
2
2
|
import { MakeOptional } from '@mui/x-internals/types';
|
|
3
3
|
import { ChartContainerProps } from '../ChartContainer';
|
|
4
4
|
import { PieSeriesType } from '../models/seriesType';
|
|
5
|
-
import {
|
|
5
|
+
import { ChartsTooltipSlots, ChartsTooltipSlotProps } from '../ChartsTooltip/ChartTooltip.types';
|
|
6
6
|
import { ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
7
7
|
import { PiePlotProps, PiePlotSlotProps, PiePlotSlots } from './PiePlot';
|
|
8
8
|
import { PieValueType } from '../models/seriesType/pie';
|
|
9
9
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
10
|
-
export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsTooltipSlots
|
|
10
|
+
export interface PieChartSlots extends PiePlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {
|
|
11
11
|
}
|
|
12
|
-
export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps
|
|
12
|
+
export interface PieChartSlotProps extends PiePlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {
|
|
13
13
|
}
|
|
14
14
|
export interface PieChartProps extends Omit<ChartContainerProps, 'series' | 'leftAxis' | 'bottomAxis' | 'plugins' | 'zAxis'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Pick<PiePlotProps, 'skipAnimation'> {
|
|
15
15
|
/**
|
|
@@ -17,12 +17,6 @@ export interface PieChartProps extends Omit<ChartContainerProps, 'series' | 'lef
|
|
|
17
17
|
* An array of [[PieSeriesType]] objects.
|
|
18
18
|
*/
|
|
19
19
|
series: MakeOptional<PieSeriesType<MakeOptional<PieValueType, 'id'>>, 'type'>[];
|
|
20
|
-
/**
|
|
21
|
-
* The configuration of the tooltip.
|
|
22
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
23
|
-
* @default { trigger: 'item' }
|
|
24
|
-
*/
|
|
25
|
-
tooltip?: ChartsTooltipProps<'pie'>;
|
|
26
20
|
/**
|
|
27
21
|
* If `true`, the legend is not rendered.
|
|
28
22
|
*/
|
package/PieChart/PieChart.js
CHANGED
|
@@ -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", "sx", "
|
|
5
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "sx", "skipAnimation", "hideLegend", "children", "slots", "slotProps", "onItemClick", "loading", "highlightedItem", "onHighlightChange", "className"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
@@ -48,9 +48,6 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
48
48
|
margin: marginProps,
|
|
49
49
|
colors,
|
|
50
50
|
sx,
|
|
51
|
-
tooltip = {
|
|
52
|
-
trigger: 'item'
|
|
53
|
-
},
|
|
54
51
|
skipAnimation,
|
|
55
52
|
hideLegend,
|
|
56
53
|
children,
|
|
@@ -65,6 +62,7 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
65
62
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
66
63
|
const isRtl = useRtl();
|
|
67
64
|
const margin = _extends({}, isRtl ? defaultRTLMargin : defaultMargin, marginProps);
|
|
65
|
+
const Tooltip = slots?.tooltip ?? ChartsTooltip;
|
|
68
66
|
return /*#__PURE__*/_jsxs(ChartContainer, _extends({}, other, {
|
|
69
67
|
ref: ref,
|
|
70
68
|
series: series.map(s => _extends({
|
|
@@ -96,10 +94,9 @@ const PieChart = /*#__PURE__*/React.forwardRef(function PieChart(inProps, ref) {
|
|
|
96
94
|
},
|
|
97
95
|
slots: slots,
|
|
98
96
|
slotProps: slotProps
|
|
99
|
-
}), !loading && /*#__PURE__*/_jsx(
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
})), children]
|
|
97
|
+
}), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({
|
|
98
|
+
trigger: "item"
|
|
99
|
+
}, slotProps?.tooltip)), children]
|
|
103
100
|
}));
|
|
104
101
|
});
|
|
105
102
|
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
@@ -167,16 +164,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
167
164
|
* Callback fired when a pie arc is clicked.
|
|
168
165
|
*/
|
|
169
166
|
onItemClick: PropTypes.func,
|
|
170
|
-
/**
|
|
171
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
172
|
-
* before it renders for the first time.
|
|
173
|
-
*
|
|
174
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
175
|
-
* the first render, like when used inside a grid.
|
|
176
|
-
*
|
|
177
|
-
* @default false
|
|
178
|
-
*/
|
|
179
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
180
167
|
/**
|
|
181
168
|
* The series to display in the pie chart.
|
|
182
169
|
* An array of [[PieSeriesType]] objects.
|
|
@@ -199,25 +186,6 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
199
186
|
slots: PropTypes.object,
|
|
200
187
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
201
188
|
title: PropTypes.string,
|
|
202
|
-
/**
|
|
203
|
-
* The configuration of the tooltip.
|
|
204
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
205
|
-
* @default { trigger: 'item' }
|
|
206
|
-
*/
|
|
207
|
-
tooltip: PropTypes.shape({
|
|
208
|
-
axisContent: PropTypes.elementType,
|
|
209
|
-
classes: PropTypes.object,
|
|
210
|
-
itemContent: PropTypes.elementType,
|
|
211
|
-
slotProps: PropTypes.object,
|
|
212
|
-
slots: PropTypes.object,
|
|
213
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
214
|
-
}),
|
|
215
|
-
viewBox: PropTypes.shape({
|
|
216
|
-
height: PropTypes.number,
|
|
217
|
-
width: PropTypes.number,
|
|
218
|
-
x: PropTypes.number,
|
|
219
|
-
y: PropTypes.number
|
|
220
|
-
}),
|
|
221
189
|
/**
|
|
222
190
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
223
191
|
*/
|
package/PieChart/PiePlot.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
5
|
-
import {
|
|
5
|
+
import { DrawingAreaContext } from "../context/DrawingAreaProvider/index.js";
|
|
6
6
|
import { PieArcPlot } from "./PieArcPlot.js";
|
|
7
7
|
import { PieArcLabelPlot } from "./PieArcLabelPlot.js";
|
|
8
8
|
import { getPercentageValue } from "../internals/getPercentageValue.js";
|
|
@@ -33,7 +33,7 @@ function PiePlot(props) {
|
|
|
33
33
|
top,
|
|
34
34
|
width,
|
|
35
35
|
height
|
|
36
|
-
} = React.useContext(
|
|
36
|
+
} = React.useContext(DrawingAreaContext);
|
|
37
37
|
const skipAnimation = useSkipAnimation(inSkipAnimation);
|
|
38
38
|
if (seriesData === undefined) {
|
|
39
39
|
return null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { DrawingAreaState } from '../context/DrawingAreaProvider';
|
|
2
2
|
import { DefaultizedPieSeriesType } from '../models/seriesType/pie';
|
|
3
|
-
export declare function getPieCoordinates(series: Pick<DefaultizedPieSeriesType, 'cx' | 'cy'>, drawing: Pick<
|
|
3
|
+
export declare function getPieCoordinates(series: Pick<DefaultizedPieSeriesType, 'cx' | 'cy'>, drawing: Pick<DrawingAreaState, 'width' | 'height'>): {
|
|
4
4
|
cx: number;
|
|
5
5
|
cy: number;
|
|
6
6
|
availableRadius: number;
|
package/README.md
CHANGED
|
@@ -16,8 +16,8 @@ This component has the following peer dependencies that you need to install as w
|
|
|
16
16
|
```json
|
|
17
17
|
"peerDependencies": {
|
|
18
18
|
"@mui/material": "^5.15.14 || ^6.0.0",
|
|
19
|
-
"react": "^17.0.0 || ^18.0.0",
|
|
20
|
-
"react-dom": "^17.0.0 || ^18.0.0"
|
|
19
|
+
"react": "^17.0.0 || ^18.0.0 || ^19.0.0",
|
|
20
|
+
"react-dom": "^17.0.0 || ^18.0.0 || ^19.0.0"
|
|
21
21
|
},
|
|
22
22
|
```
|
|
23
23
|
|
package/ScatterChart/Scatter.js
CHANGED
|
@@ -5,9 +5,11 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
7
7
|
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
8
|
-
import {
|
|
8
|
+
import { useStore } from "../internals/useStore.js";
|
|
9
|
+
import { useSelector } from "../internals/useSelector.js";
|
|
9
10
|
import { useHighlighted } from "../context/index.js";
|
|
10
11
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
12
|
+
import { selectorChartsInteractionIsVoronoiEnabled } from "../context/InteractionSelectors.js";
|
|
11
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
14
|
/**
|
|
13
15
|
* Demos:
|
|
@@ -30,10 +32,9 @@ function Scatter(props) {
|
|
|
30
32
|
onItemClick
|
|
31
33
|
} = props;
|
|
32
34
|
const drawingArea = useDrawingArea();
|
|
33
|
-
const
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
const skipInteractionHandlers = useVoronoiInteraction || series.disableHover;
|
|
35
|
+
const store = useStore();
|
|
36
|
+
const isVoronoiEnabled = useSelector(store, selectorChartsInteractionIsVoronoiEnabled);
|
|
37
|
+
const skipInteractionHandlers = isVoronoiEnabled || series.disableHover;
|
|
37
38
|
const getInteractionItemProps = useInteractionItemProps(skipInteractionHandlers);
|
|
38
39
|
const {
|
|
39
40
|
isFaded,
|
|
@@ -4,7 +4,7 @@ import { ScatterPlotProps, ScatterPlotSlotProps, ScatterPlotSlots } from './Scat
|
|
|
4
4
|
import { ChartContainerProps } from '../ChartContainer';
|
|
5
5
|
import { ChartsAxisProps } from '../ChartsAxis';
|
|
6
6
|
import { ScatterSeriesType } from '../models/seriesType/scatter';
|
|
7
|
-
import {
|
|
7
|
+
import { ChartsTooltipSlots, ChartsTooltipSlotProps } from '../ChartsTooltip/ChartTooltip.types';
|
|
8
8
|
import { ChartsLegendSlotProps, ChartsLegendSlots } from '../ChartsLegend';
|
|
9
9
|
import { ChartsOverlayProps, ChartsOverlaySlotProps, ChartsOverlaySlots } from '../ChartsOverlay';
|
|
10
10
|
import { ChartsAxisHighlightProps } from '../ChartsAxisHighlight';
|
|
@@ -12,9 +12,9 @@ import { ChartsAxisSlots, ChartsAxisSlotProps } from '../models/axis';
|
|
|
12
12
|
import { ChartsVoronoiHandlerProps } from '../ChartsVoronoiHandler/ChartsVoronoiHandler';
|
|
13
13
|
import { ChartsGridProps } from '../ChartsGrid';
|
|
14
14
|
import { ZAxisContextProviderProps } from '../context/ZAxisContextProvider';
|
|
15
|
-
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsTooltipSlots
|
|
15
|
+
export interface ScatterChartSlots extends ChartsAxisSlots, ScatterPlotSlots, ChartsLegendSlots, ChartsOverlaySlots, ChartsTooltipSlots {
|
|
16
16
|
}
|
|
17
|
-
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsTooltipSlotProps
|
|
17
|
+
export interface ScatterChartSlotProps extends ChartsAxisSlotProps, ScatterPlotSlotProps, ChartsLegendSlotProps, ChartsOverlaySlotProps, ChartsTooltipSlotProps {
|
|
18
18
|
}
|
|
19
19
|
export interface ScatterChartProps extends Omit<ChartContainerProps, 'series' | 'plugins'>, Omit<ZAxisContextProviderProps, 'children' | 'dataset'>, Omit<ChartsAxisProps, 'slots' | 'slotProps'>, Omit<ChartsOverlayProps, 'slots' | 'slotProps'>, Omit<ChartsVoronoiHandlerProps, 'onItemClick'> {
|
|
20
20
|
/**
|
|
@@ -22,15 +22,9 @@ export interface ScatterChartProps extends Omit<ChartContainerProps, 'series' |
|
|
|
22
22
|
* An array of [[ScatterSeriesType]] objects.
|
|
23
23
|
*/
|
|
24
24
|
series: MakeOptional<ScatterSeriesType, 'type'>[];
|
|
25
|
-
/**
|
|
26
|
-
* The configuration of the tooltip.
|
|
27
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
28
|
-
* @default { trigger: 'item' }
|
|
29
|
-
*/
|
|
30
|
-
tooltip?: ChartsTooltipProps<'scatter'>;
|
|
31
25
|
/**
|
|
32
26
|
* The configuration of axes highlight.
|
|
33
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
27
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
34
28
|
* @default { x: 'none', y: 'none' }
|
|
35
29
|
*/
|
|
36
30
|
axisHighlight?: ChartsAxisHighlightProps;
|