@mui/x-charts 7.15.0 → 7.17.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.js +26 -12
- package/BarChart/BarClipPath.js +1 -1
- package/BarChart/BarElement.js +4 -2
- package/BarChart/BarLabel/BarLabel.js +3 -1
- package/BarChart/BarLabel/BarLabelItem.js +4 -4
- package/BarChart/BarLabel/BarLabelPlot.js +1 -1
- package/BarChart/BarLabel/index.js +2 -2
- package/BarChart/BarPlot.js +10 -8
- package/BarChart/checkScaleErrors.js +2 -2
- package/BarChart/formatter.js +2 -2
- package/BarChart/index.js +4 -4
- package/BarChart/legend.js +4 -3
- package/BarChart/plugin.js +3 -3
- package/BarChart/useBarChartProps.js +3 -1
- package/CHANGELOG.md +185 -1
- package/ChartContainer/ChartContainer.js +11 -9
- package/ChartContainer/index.js +1 -1
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartContainer/useDefaultizeAxis.js +3 -1
- package/ChartsAxis/ChartsAxis.js +5 -3
- package/ChartsAxis/index.js +2 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +6 -4
- package/ChartsAxisHighlight/index.js +1 -1
- package/ChartsClipPath/ChartsClipPath.js +3 -1
- package/ChartsClipPath/index.js +1 -1
- package/ChartsGrid/ChartsGrid.js +20 -66
- package/ChartsGrid/ChartsHorizontalGrid.d.ts +14 -0
- package/ChartsGrid/ChartsHorizontalGrid.js +36 -0
- package/ChartsGrid/ChartsVerticalGrid.d.ts +14 -0
- package/ChartsGrid/ChartsVerticalGrid.js +36 -0
- package/ChartsGrid/index.js +2 -2
- package/ChartsGrid/styledCommonents.d.ts +2 -0
- package/ChartsGrid/styledCommonents.js +22 -0
- package/ChartsLegend/ChartsLegend.d.ts +4 -13
- package/ChartsLegend/ChartsLegend.js +70 -26
- package/ChartsLegend/ChartsLegendItem.d.ts +26 -0
- package/ChartsLegend/ChartsLegendItem.js +65 -0
- package/ChartsLegend/ContinuousColorLegend.js +9 -7
- package/ChartsLegend/DefaultChartsLegend.d.ts +15 -2
- package/ChartsLegend/DefaultChartsLegend.js +31 -5
- package/ChartsLegend/LegendPerItem.d.ts +10 -6
- package/ChartsLegend/LegendPerItem.js +22 -35
- package/ChartsLegend/PiecewiseColorLegend.d.ts +9 -1
- package/ChartsLegend/PiecewiseColorLegend.js +31 -15
- package/ChartsLegend/chartsLegend.types.d.ts +39 -1
- package/ChartsLegend/chartsLegendClasses.d.ts +2 -0
- package/ChartsLegend/chartsLegendClasses.js +1 -1
- package/ChartsLegend/index.js +6 -6
- package/ChartsLegend/useAxis.js +4 -2
- package/ChartsLegend/utils.js +4 -4
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +7 -5
- package/ChartsOnAxisClickHandler/index.js +1 -1
- package/ChartsOverlay/ChartsLoadingOverlay.js +3 -1
- package/ChartsOverlay/ChartsNoDataOverlay.js +3 -1
- package/ChartsOverlay/ChartsOverlay.js +5 -3
- package/ChartsOverlay/index.js +3 -3
- package/ChartsReferenceLine/ChartsReferenceLine.js +4 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +7 -5
- package/ChartsReferenceLine/ChartsYReferenceLine.js +7 -5
- package/ChartsReferenceLine/common.js +1 -1
- package/ChartsReferenceLine/index.js +2 -2
- package/ChartsSurface/ChartsSurface.js +3 -1
- package/ChartsSurface/index.js +1 -1
- package/ChartsText/ChartsText.js +3 -1
- package/ChartsText/index.js +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +6 -6
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +1 -1
- package/ChartsTooltip/ChartsItemTooltipContent.js +5 -5
- package/ChartsTooltip/ChartsTooltip.d.ts +2 -2
- package/ChartsTooltip/ChartsTooltip.js +15 -11
- package/ChartsTooltip/ChartsTooltipTable.js +10 -5
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -5
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +5 -3
- package/ChartsTooltip/chartsTooltipClasses.d.ts +2 -0
- package/ChartsTooltip/chartsTooltipClasses.js +1 -1
- package/ChartsTooltip/index.js +7 -7
- package/ChartsTooltip/utils.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +9 -7
- package/ChartsVoronoiHandler/index.js +1 -1
- package/ChartsXAxis/ChartsXAxis.js +20 -13
- package/ChartsXAxis/index.js +1 -1
- package/ChartsYAxis/ChartsYAxis.js +17 -10
- package/ChartsYAxis/index.js +1 -1
- package/Gauge/Gauge.js +7 -5
- package/Gauge/GaugeContainer.js +6 -4
- package/Gauge/GaugeProvider.js +3 -3
- package/Gauge/GaugeReferenceArc.js +3 -1
- package/Gauge/GaugeValueArc.js +3 -1
- package/Gauge/GaugeValueText.js +4 -2
- package/Gauge/index.js +7 -7
- package/LineChart/AnimatedArea.js +33 -14
- package/LineChart/AnimatedLine.js +34 -15
- package/LineChart/AreaElement.js +5 -3
- package/LineChart/AreaPlot.js +85 -78
- package/LineChart/CircleMarkElement.d.ts +34 -0
- package/LineChart/CircleMarkElement.js +107 -0
- package/LineChart/LineChart.d.ts +4 -0
- package/LineChart/LineChart.js +33 -15
- package/LineChart/LineElement.js +5 -3
- package/LineChart/LineHighlightElement.js +2 -0
- package/LineChart/LineHighlightPlot.js +10 -8
- package/LineChart/LinePlot.js +67 -60
- package/LineChart/MarkElement.d.ts +1 -19
- package/LineChart/MarkElement.js +7 -23
- package/LineChart/MarkPlot.d.ts +6 -0
- package/LineChart/MarkPlot.js +22 -12
- package/LineChart/formatter.js +2 -2
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +12 -11
- package/LineChart/legend.js +4 -3
- package/LineChart/markElementClasses.d.ts +20 -0
- package/LineChart/markElementClasses.js +19 -0
- package/LineChart/plugin.js +3 -3
- package/LineChart/useLineChartProps.js +8 -4
- package/PieChart/PieArc.js +3 -1
- package/PieChart/PieArcLabel.js +2 -0
- package/PieChart/PieArcLabelPlot.js +6 -4
- package/PieChart/PieArcPlot.js +6 -4
- package/PieChart/PieChart.js +22 -8
- package/PieChart/PiePlot.js +8 -6
- package/PieChart/dataTransform/useTransformData.js +3 -1
- package/PieChart/formatter.js +1 -1
- package/PieChart/getPieCoordinates.js +1 -1
- package/PieChart/index.js +7 -7
- package/PieChart/legend.js +4 -2
- package/PieChart/plugin.js +2 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +5 -3
- package/ResponsiveChartContainer/index.js +1 -1
- package/ResponsiveChartContainer/useChartContainerDimensions.js +3 -1
- package/ResponsiveChartContainer/useResponsiveChartContainerProps.js +3 -1
- package/ScatterChart/Scatter.js +7 -5
- package/ScatterChart/ScatterChart.js +26 -12
- package/ScatterChart/ScatterPlot.js +7 -5
- package/ScatterChart/formatter.js +1 -1
- package/ScatterChart/index.js +3 -3
- package/ScatterChart/legend.js +4 -3
- package/ScatterChart/plugin.js +3 -3
- package/ScatterChart/useScatterChartProps.js +2 -0
- package/SparkLineChart/SparkLineChart.js +8 -6
- package/SparkLineChart/index.js +1 -1
- package/colorPalettes/index.js +1 -1
- package/context/CartesianProvider/CartesianProvider.js +8 -6
- package/context/CartesianProvider/computeValue.js +6 -6
- package/context/CartesianProvider/defaultizeAxis.js +1 -1
- package/context/CartesianProvider/index.js +5 -5
- package/context/CartesianProvider/useCartesianContext.js +3 -1
- package/context/DrawingProvider.js +3 -1
- package/context/HighlightedProvider/HighlightedProvider.js +6 -4
- package/context/HighlightedProvider/index.js +4 -4
- package/context/HighlightedProvider/useHighlighted.js +3 -1
- package/context/HighlightedProvider/useItemHighlighted.js +3 -1
- package/context/InteractionProvider.js +2 -0
- package/context/PluginProvider/PluginProvider.js +4 -2
- package/context/PluginProvider/index.js +10 -10
- package/context/PluginProvider/mergePlugins.js +4 -4
- package/context/PluginProvider/useColorProcessor.js +3 -1
- package/context/PluginProvider/useSeriesFormatter.js +3 -1
- package/context/PluginProvider/useXExtremumGetter.js +1 -1
- package/context/PluginProvider/useYExtremumGetter.js +1 -1
- package/context/SeriesProvider/SeriesProvider.js +6 -4
- package/context/SeriesProvider/index.js +4 -4
- package/context/SeriesProvider/processSeries.js +1 -1
- package/context/ZAxisContextProvider.js +3 -1
- package/context/index.js +2 -2
- package/hooks/index.js +7 -7
- package/hooks/useAxis.js +3 -1
- package/hooks/useAxisEvents.js +8 -6
- package/hooks/useChartDimensions.js +3 -1
- package/hooks/useChartId.js +3 -1
- package/hooks/useColorScale.js +4 -2
- package/hooks/useDrawingArea.js +3 -1
- package/hooks/useInteractionItemProps.js +4 -2
- package/hooks/useMounted.js +2 -0
- package/hooks/useReducedMotion.js +15 -12
- package/hooks/useScale.js +4 -2
- package/hooks/useSeries.js +3 -1
- package/hooks/useSvgRef.js +3 -1
- package/hooks/useTicks.js +4 -2
- package/index.js +27 -27
- package/internals/components/AxisSharedComponents.js +1 -1
- package/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +5 -5
- package/internals/components/ChartsAxesGradients/index.js +1 -1
- package/internals/getWordsByLines.js +1 -1
- package/internals/index.js +31 -31
- package/internals/isCartesian.js +1 -1
- package/internals/useStringInterpolator.d.ts +1 -0
- package/{modern/internals/useAnimatedPath.js → internals/useStringInterpolator.js} +2 -15
- package/models/index.d.ts +1 -0
- package/models/index.js +5 -3
- package/models/seriesType/index.js +4 -4
- package/modern/BarChart/BarChart.js +26 -12
- package/modern/BarChart/BarClipPath.js +1 -1
- package/modern/BarChart/BarElement.js +4 -2
- package/modern/BarChart/BarLabel/BarLabel.js +3 -1
- package/modern/BarChart/BarLabel/BarLabelItem.js +4 -4
- package/modern/BarChart/BarLabel/BarLabelPlot.js +1 -1
- package/modern/BarChart/BarLabel/index.js +2 -2
- package/modern/BarChart/BarPlot.js +10 -8
- package/modern/BarChart/checkScaleErrors.js +2 -2
- package/modern/BarChart/formatter.js +2 -2
- package/modern/BarChart/index.js +4 -4
- package/modern/BarChart/legend.js +4 -3
- package/modern/BarChart/plugin.js +3 -3
- package/modern/BarChart/useBarChartProps.js +3 -1
- package/modern/ChartContainer/ChartContainer.js +11 -9
- package/modern/ChartContainer/index.js +1 -1
- package/modern/ChartContainer/useChartContainerProps.js +4 -2
- package/modern/ChartContainer/useDefaultizeAxis.js +3 -1
- package/modern/ChartsAxis/ChartsAxis.js +5 -3
- package/modern/ChartsAxis/index.js +2 -2
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +6 -4
- package/modern/ChartsAxisHighlight/index.js +1 -1
- package/modern/ChartsClipPath/ChartsClipPath.js +3 -1
- package/modern/ChartsClipPath/index.js +1 -1
- package/modern/ChartsGrid/ChartsGrid.js +20 -66
- package/modern/ChartsGrid/ChartsHorizontalGrid.js +36 -0
- package/modern/ChartsGrid/ChartsVerticalGrid.js +36 -0
- package/modern/ChartsGrid/index.js +2 -2
- package/modern/ChartsGrid/styledCommonents.js +22 -0
- package/modern/ChartsLegend/ChartsLegend.js +70 -26
- package/modern/ChartsLegend/ChartsLegendItem.js +65 -0
- package/modern/ChartsLegend/ContinuousColorLegend.js +9 -7
- package/modern/ChartsLegend/DefaultChartsLegend.js +31 -5
- package/modern/ChartsLegend/LegendPerItem.js +22 -35
- package/modern/ChartsLegend/PiecewiseColorLegend.js +31 -15
- package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
- package/modern/ChartsLegend/index.js +6 -6
- package/modern/ChartsLegend/useAxis.js +4 -2
- package/modern/ChartsLegend/utils.js +4 -4
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +7 -5
- package/modern/ChartsOnAxisClickHandler/index.js +1 -1
- package/modern/ChartsOverlay/ChartsLoadingOverlay.js +3 -1
- package/modern/ChartsOverlay/ChartsNoDataOverlay.js +3 -1
- package/modern/ChartsOverlay/ChartsOverlay.js +5 -3
- package/modern/ChartsOverlay/index.js +3 -3
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +4 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +7 -5
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +7 -5
- package/modern/ChartsReferenceLine/common.js +1 -1
- package/modern/ChartsReferenceLine/index.js +2 -2
- package/modern/ChartsSurface/ChartsSurface.js +3 -1
- package/modern/ChartsSurface/index.js +1 -1
- package/modern/ChartsText/ChartsText.js +3 -1
- package/modern/ChartsText/index.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +6 -6
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +5 -5
- package/modern/ChartsTooltip/ChartsTooltip.js +15 -11
- package/modern/ChartsTooltip/ChartsTooltipTable.js +10 -5
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +7 -5
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +5 -3
- package/modern/ChartsTooltip/chartsTooltipClasses.js +1 -1
- package/modern/ChartsTooltip/index.js +7 -7
- package/modern/ChartsTooltip/utils.js +1 -1
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +9 -7
- package/modern/ChartsVoronoiHandler/index.js +1 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +20 -13
- package/modern/ChartsXAxis/index.js +1 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +17 -10
- package/modern/ChartsYAxis/index.js +1 -1
- package/modern/Gauge/Gauge.js +7 -5
- package/modern/Gauge/GaugeContainer.js +6 -4
- package/modern/Gauge/GaugeProvider.js +3 -3
- package/modern/Gauge/GaugeReferenceArc.js +3 -1
- package/modern/Gauge/GaugeValueArc.js +3 -1
- package/modern/Gauge/GaugeValueText.js +4 -2
- package/modern/Gauge/index.js +7 -7
- package/modern/LineChart/AnimatedArea.js +33 -14
- package/modern/LineChart/AnimatedLine.js +34 -15
- package/modern/LineChart/AreaElement.js +5 -3
- package/modern/LineChart/AreaPlot.js +85 -78
- package/modern/LineChart/CircleMarkElement.js +107 -0
- package/modern/LineChart/LineChart.js +33 -15
- package/modern/LineChart/LineElement.js +5 -3
- package/modern/LineChart/LineHighlightElement.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +10 -8
- package/modern/LineChart/LinePlot.js +67 -60
- package/modern/LineChart/MarkElement.js +7 -23
- package/modern/LineChart/MarkPlot.js +22 -12
- package/modern/LineChart/formatter.js +2 -2
- package/modern/LineChart/index.js +12 -11
- package/modern/LineChart/legend.js +4 -3
- package/modern/LineChart/markElementClasses.js +19 -0
- package/modern/LineChart/plugin.js +3 -3
- package/modern/LineChart/useLineChartProps.js +8 -4
- package/modern/PieChart/PieArc.js +3 -1
- package/modern/PieChart/PieArcLabel.js +2 -0
- package/modern/PieChart/PieArcLabelPlot.js +6 -4
- package/modern/PieChart/PieArcPlot.js +6 -4
- package/modern/PieChart/PieChart.js +22 -8
- package/modern/PieChart/PiePlot.js +8 -6
- package/modern/PieChart/dataTransform/useTransformData.js +3 -1
- package/modern/PieChart/formatter.js +1 -1
- package/modern/PieChart/getPieCoordinates.js +1 -1
- package/modern/PieChart/index.js +7 -7
- package/modern/PieChart/legend.js +4 -2
- package/modern/PieChart/plugin.js +2 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +5 -3
- package/modern/ResponsiveChartContainer/index.js +1 -1
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +3 -1
- package/modern/ResponsiveChartContainer/useResponsiveChartContainerProps.js +3 -1
- package/modern/ScatterChart/Scatter.js +7 -5
- package/modern/ScatterChart/ScatterChart.js +26 -12
- package/modern/ScatterChart/ScatterPlot.js +7 -5
- package/modern/ScatterChart/formatter.js +1 -1
- package/modern/ScatterChart/index.js +3 -3
- package/modern/ScatterChart/legend.js +4 -3
- package/modern/ScatterChart/plugin.js +3 -3
- package/modern/ScatterChart/useScatterChartProps.js +2 -0
- package/modern/SparkLineChart/SparkLineChart.js +8 -6
- package/modern/SparkLineChart/index.js +1 -1
- package/modern/colorPalettes/index.js +1 -1
- package/modern/context/CartesianProvider/CartesianProvider.js +8 -6
- package/modern/context/CartesianProvider/computeValue.js +6 -6
- package/modern/context/CartesianProvider/defaultizeAxis.js +1 -1
- package/modern/context/CartesianProvider/index.js +5 -5
- package/modern/context/CartesianProvider/useCartesianContext.js +3 -1
- package/modern/context/DrawingProvider.js +3 -1
- package/modern/context/HighlightedProvider/HighlightedProvider.js +6 -4
- package/modern/context/HighlightedProvider/index.js +4 -4
- package/modern/context/HighlightedProvider/useHighlighted.js +3 -1
- package/modern/context/HighlightedProvider/useItemHighlighted.js +3 -1
- package/modern/context/InteractionProvider.js +2 -0
- package/modern/context/PluginProvider/PluginProvider.js +4 -2
- package/modern/context/PluginProvider/index.js +10 -10
- package/modern/context/PluginProvider/mergePlugins.js +4 -4
- package/modern/context/PluginProvider/useColorProcessor.js +3 -1
- package/modern/context/PluginProvider/useSeriesFormatter.js +3 -1
- package/modern/context/PluginProvider/useXExtremumGetter.js +1 -1
- package/modern/context/PluginProvider/useYExtremumGetter.js +1 -1
- package/modern/context/SeriesProvider/SeriesProvider.js +6 -4
- package/modern/context/SeriesProvider/index.js +4 -4
- package/modern/context/SeriesProvider/processSeries.js +1 -1
- package/modern/context/ZAxisContextProvider.js +3 -1
- package/modern/context/index.js +2 -2
- package/modern/hooks/index.js +7 -7
- package/modern/hooks/useAxis.js +3 -1
- package/modern/hooks/useAxisEvents.js +8 -6
- package/modern/hooks/useChartDimensions.js +3 -1
- package/modern/hooks/useChartId.js +3 -1
- package/modern/hooks/useColorScale.js +4 -2
- package/modern/hooks/useDrawingArea.js +3 -1
- package/modern/hooks/useInteractionItemProps.js +4 -2
- package/modern/hooks/useMounted.js +2 -0
- package/modern/hooks/useReducedMotion.js +15 -12
- package/modern/hooks/useScale.js +4 -2
- package/modern/hooks/useSeries.js +3 -1
- package/modern/hooks/useSvgRef.js +3 -1
- package/modern/hooks/useTicks.js +4 -2
- package/modern/index.js +27 -27
- package/modern/internals/components/AxisSharedComponents.js +1 -1
- package/modern/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +5 -5
- package/modern/internals/components/ChartsAxesGradients/index.js +1 -1
- package/modern/internals/getWordsByLines.js +1 -1
- package/modern/internals/index.js +31 -31
- package/modern/internals/isCartesian.js +1 -1
- package/{internals/useAnimatedPath.js → modern/internals/useStringInterpolator.js} +2 -15
- package/modern/models/index.js +5 -3
- package/modern/models/seriesType/index.js +4 -4
- package/modern/themeAugmentation/index.js +0 -3
- package/node/BarChart/BarChart.js +16 -4
- package/node/BarChart/BarClipPath.js +2 -3
- package/node/BarChart/BarElement.js +3 -3
- package/node/BarChart/BarLabel/BarLabel.js +3 -3
- package/node/BarChart/BarLabel/BarLabelItem.js +2 -3
- package/node/BarChart/BarLabel/BarLabelPlot.js +2 -3
- package/node/BarChart/BarLabel/barLabelClasses.js +1 -1
- package/node/BarChart/BarPlot.js +3 -3
- package/node/BarChart/formatter.js +1 -1
- package/node/BarChart/legend.js +3 -2
- package/node/BarChart/plugin.js +1 -1
- package/node/BarChart/useBarChartProps.js +2 -1
- package/node/ChartContainer/ChartContainer.js +3 -3
- package/node/ChartContainer/useChartContainerProps.js +3 -3
- package/node/ChartContainer/useDefaultizeAxis.js +3 -3
- package/node/ChartsAxis/ChartsAxis.js +3 -3
- package/node/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -3
- package/node/ChartsClipPath/ChartsClipPath.js +3 -3
- package/node/ChartsGrid/ChartsGrid.js +18 -66
- package/node/ChartsGrid/ChartsHorizontalGrid.js +43 -0
- package/node/ChartsGrid/ChartsVerticalGrid.js +43 -0
- package/node/ChartsGrid/chartsGridClasses.js +1 -1
- package/node/ChartsGrid/styledCommonents.js +28 -0
- package/node/ChartsLegend/ChartsLegend.js +66 -24
- package/node/ChartsLegend/ChartsLegendItem.js +72 -0
- package/node/ChartsLegend/ContinuousColorLegend.js +3 -3
- package/node/ChartsLegend/DefaultChartsLegend.js +31 -7
- package/node/ChartsLegend/LegendPerItem.js +20 -35
- package/node/ChartsLegend/PiecewiseColorLegend.js +29 -15
- package/node/ChartsLegend/chartsLegendClasses.js +1 -1
- package/node/ChartsLegend/legendItemsPlacement.js +1 -1
- package/node/ChartsLegend/useAxis.js +2 -2
- package/node/ChartsLegend/utils.js +1 -1
- package/node/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +4 -4
- package/node/ChartsOverlay/ChartsLoadingOverlay.js +3 -3
- package/node/ChartsOverlay/ChartsNoDataOverlay.js +3 -3
- package/node/ChartsOverlay/ChartsOverlay.js +3 -3
- package/node/ChartsReferenceLine/ChartsReferenceLine.js +3 -3
- package/node/ChartsReferenceLine/ChartsXReferenceLine.js +4 -4
- package/node/ChartsReferenceLine/ChartsYReferenceLine.js +4 -4
- package/node/ChartsReferenceLine/chartsReferenceLineClasses.js +1 -1
- package/node/ChartsReferenceLine/common.js +1 -1
- package/node/ChartsSurface/ChartsSurface.js +3 -3
- package/node/ChartsText/ChartsText.js +3 -3
- package/node/ChartsTooltip/ChartsAxisTooltipContent.js +2 -3
- package/node/ChartsTooltip/ChartsItemTooltipContent.js +2 -3
- package/node/ChartsTooltip/ChartsTooltip.js +11 -9
- package/node/ChartsTooltip/ChartsTooltipTable.js +9 -4
- package/node/ChartsTooltip/DefaultChartsAxisTooltipContent.js +4 -4
- package/node/ChartsTooltip/DefaultChartsItemTooltipContent.js +4 -4
- package/node/ChartsTooltip/chartsTooltipClasses.js +1 -1
- package/node/ChartsTooltip/utils.js +2 -3
- package/node/ChartsVoronoiHandler/ChartsVoronoiHandler.js +3 -3
- package/node/ChartsXAxis/ChartsXAxis.js +9 -4
- package/node/ChartsYAxis/ChartsYAxis.js +9 -4
- package/node/Gauge/Gauge.js +3 -3
- package/node/Gauge/GaugeContainer.js +3 -3
- package/node/Gauge/GaugeProvider.js +1 -2
- package/node/Gauge/GaugeReferenceArc.js +3 -3
- package/node/Gauge/GaugeValueArc.js +3 -3
- package/node/Gauge/GaugeValueText.js +3 -3
- package/node/Gauge/gaugeClasses.js +1 -1
- package/node/LineChart/AnimatedArea.js +31 -14
- package/node/LineChart/AnimatedLine.js +31 -14
- package/node/LineChart/AreaElement.js +3 -3
- package/node/LineChart/AreaPlot.js +79 -74
- package/node/LineChart/CircleMarkElement.js +113 -0
- package/node/LineChart/LineChart.js +20 -4
- package/node/LineChart/LineElement.js +3 -3
- package/node/LineChart/LineHighlightElement.js +3 -3
- package/node/LineChart/LineHighlightPlot.js +3 -3
- package/node/LineChart/LinePlot.js +61 -56
- package/node/LineChart/MarkElement.js +5 -25
- package/node/LineChart/MarkPlot.js +14 -6
- package/node/LineChart/formatter.js +1 -1
- package/node/LineChart/index.js +29 -1
- package/node/LineChart/legend.js +3 -2
- package/node/LineChart/markElementClasses.js +28 -0
- package/node/LineChart/plugin.js +1 -1
- package/node/LineChart/useLineChartProps.js +7 -4
- package/node/PieChart/PieArc.js +3 -3
- package/node/PieChart/PieArcLabel.js +3 -3
- package/node/PieChart/PieArcLabelPlot.js +3 -3
- package/node/PieChart/PieArcPlot.js +3 -3
- package/node/PieChart/PieChart.js +15 -3
- package/node/PieChart/PiePlot.js +3 -3
- package/node/PieChart/dataTransform/useTransformData.js +3 -3
- package/node/PieChart/formatter.js +1 -1
- package/node/PieChart/legend.js +3 -1
- package/node/PieChart/plugin.js +1 -1
- package/node/ResponsiveChartContainer/ResponsiveChartContainer.js +3 -3
- package/node/ResponsiveChartContainer/useChartContainerDimensions.js +4 -4
- package/node/ResponsiveChartContainer/useResponsiveChartContainerProps.js +2 -1
- package/node/ScatterChart/Scatter.js +3 -3
- package/node/ScatterChart/ScatterChart.js +16 -4
- package/node/ScatterChart/ScatterPlot.js +3 -3
- package/node/ScatterChart/legend.js +3 -2
- package/node/ScatterChart/plugin.js +1 -1
- package/node/ScatterChart/useScatterChartProps.js +2 -1
- package/node/SparkLineChart/SparkLineChart.js +3 -3
- package/node/context/CartesianProvider/CartesianContext.js +1 -2
- package/node/context/CartesianProvider/CartesianProvider.js +2 -2
- package/node/context/CartesianProvider/computeValue.js +1 -1
- package/node/context/CartesianProvider/defaultizeAxis.js +1 -1
- package/node/context/CartesianProvider/useCartesianContext.js +2 -2
- package/node/context/DrawingProvider.js +3 -3
- package/node/context/HighlightedProvider/HighlightedContext.js +1 -2
- package/node/context/HighlightedProvider/HighlightedProvider.js +3 -3
- package/node/context/HighlightedProvider/useHighlighted.js +2 -2
- package/node/context/HighlightedProvider/useItemHighlighted.js +1 -0
- package/node/context/InteractionProvider.js +3 -3
- package/node/context/PluginProvider/PluginContext.js +1 -2
- package/node/context/PluginProvider/PluginProvider.js +2 -2
- package/node/context/PluginProvider/useColorProcessor.js +2 -2
- package/node/context/PluginProvider/useSeriesFormatter.js +2 -2
- package/node/context/PluginProvider/useXExtremumGetter.js +1 -2
- package/node/context/PluginProvider/useYExtremumGetter.js +1 -2
- package/node/context/SeriesProvider/SeriesContext.js +1 -2
- package/node/context/SeriesProvider/SeriesProvider.js +2 -2
- package/node/context/SeriesProvider/processSeries.js +1 -1
- package/node/context/ZAxisContextProvider.js +3 -3
- package/node/hooks/useAxis.js +1 -0
- package/node/hooks/useAxisEvents.js +2 -2
- package/node/hooks/useChartDimensions.js +3 -3
- package/node/hooks/useChartId.js +2 -2
- package/node/hooks/useColorScale.js +2 -2
- package/node/hooks/useDrawingArea.js +2 -2
- package/node/hooks/useInteractionItemProps.js +2 -2
- package/node/hooks/useMounted.js +3 -3
- package/node/hooks/useReducedMotion.js +15 -12
- package/node/hooks/useScale.js +1 -0
- package/node/hooks/useSeries.js +2 -2
- package/node/hooks/useSvgRef.js +2 -2
- package/node/hooks/useTicks.js +2 -2
- package/node/index.js +1 -1
- package/node/internals/components/AxisSharedComponents.js +1 -1
- package/node/internals/components/ChartsAxesGradients/ChartsAxesGradients.js +2 -3
- package/node/internals/components/ChartsAxesGradients/ChartsContinuousGradient.js +1 -2
- package/node/internals/components/ChartsAxesGradients/ChartsPiecewiseGradient.js +1 -2
- package/node/internals/defaultizeColor.js +1 -1
- package/node/internals/defaultizeValueFormatter.js +1 -1
- package/node/internals/domUtils.js +1 -1
- package/node/internals/getWordsByLines.js +1 -1
- package/node/internals/useStringInterpolator.js +28 -0
- package/node/tests/firePointerEvent.js +1 -1
- package/node/themeAugmentation/index.js +1 -38
- package/package.json +4 -3
- package/themeAugmentation/components.d.ts +2 -0
- package/themeAugmentation/index.d.ts +3 -3
- package/themeAugmentation/index.js +0 -3
- package/themeAugmentation/overrides.d.ts +6 -4
- package/internals/useAnimatedPath.d.ts +0 -1
- package/internals/warning.d.ts +0 -2
- package/internals/warning.js +0 -21
- package/modern/internals/warning.js +0 -21
- package/node/internals/useAnimatedPath.js +0 -42
- package/node/internals/warning.js +0 -28
|
@@ -1,15 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["d", "skipAnimation", "ownerState"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { animated,
|
|
8
|
+
import { animated, useTransition } from '@react-spring/web';
|
|
7
9
|
import { color as d3Color } from '@mui/x-charts-vendor/d3-color';
|
|
8
10
|
import { styled } from '@mui/material/styles';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import { cleanId } from "../internals/cleanId.js";
|
|
12
|
+
import { useChartId } from "../hooks/useChartId.js";
|
|
13
|
+
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
14
|
+
import { useStringInterpolator } from "../internals/useStringInterpolator.js";
|
|
13
15
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
16
|
export const LineElementPath = styled(animated.path, {
|
|
15
17
|
name: 'MuiLineElement',
|
|
@@ -51,16 +53,33 @@ function AnimatedLine(props) {
|
|
|
51
53
|
right
|
|
52
54
|
} = useDrawingArea();
|
|
53
55
|
const chartId = useChartId();
|
|
54
|
-
const
|
|
55
|
-
const {
|
|
56
|
-
animatedWidth
|
|
57
|
-
} = useSpring({
|
|
56
|
+
const stringInterpolator = useStringInterpolator(d);
|
|
57
|
+
const transitionAppear = useTransition([1], {
|
|
58
58
|
from: {
|
|
59
59
|
animatedWidth: left
|
|
60
60
|
},
|
|
61
61
|
to: {
|
|
62
62
|
animatedWidth: width + left + right
|
|
63
63
|
},
|
|
64
|
+
enter: {
|
|
65
|
+
animatedWidth: width + left + right
|
|
66
|
+
},
|
|
67
|
+
leave: {
|
|
68
|
+
animatedWidth: left
|
|
69
|
+
},
|
|
70
|
+
reset: false,
|
|
71
|
+
immediate: skipAnimation
|
|
72
|
+
});
|
|
73
|
+
const transitionChange = useTransition([stringInterpolator], {
|
|
74
|
+
from: {
|
|
75
|
+
value: 0
|
|
76
|
+
},
|
|
77
|
+
to: {
|
|
78
|
+
value: 1
|
|
79
|
+
},
|
|
80
|
+
enter: {
|
|
81
|
+
value: 1
|
|
82
|
+
},
|
|
64
83
|
reset: false,
|
|
65
84
|
immediate: skipAnimation
|
|
66
85
|
});
|
|
@@ -68,18 +87,18 @@ function AnimatedLine(props) {
|
|
|
68
87
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
69
88
|
children: [/*#__PURE__*/_jsx("clipPath", {
|
|
70
89
|
id: clipId,
|
|
71
|
-
children: /*#__PURE__*/_jsx(animated.rect, {
|
|
90
|
+
children: transitionAppear(style => /*#__PURE__*/_jsx(animated.rect, {
|
|
72
91
|
x: 0,
|
|
73
92
|
y: 0,
|
|
74
|
-
width: animatedWidth,
|
|
93
|
+
width: style.animatedWidth,
|
|
75
94
|
height: top + height + bottom
|
|
76
|
-
})
|
|
95
|
+
}))
|
|
77
96
|
}), /*#__PURE__*/_jsx("g", {
|
|
78
97
|
clipPath: `url(#${clipId})`,
|
|
79
|
-
children: /*#__PURE__*/_jsx(LineElementPath, _extends({}, other, {
|
|
98
|
+
children: transitionChange((style, interpolator) => /*#__PURE__*/_jsx(LineElementPath, _extends({}, other, {
|
|
80
99
|
ownerState: ownerState,
|
|
81
|
-
d:
|
|
82
|
-
}))
|
|
100
|
+
d: style.value.to(interpolator)
|
|
101
|
+
})))
|
|
83
102
|
})]
|
|
84
103
|
});
|
|
85
104
|
}
|
package/LineChart/AreaElement.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick"];
|
|
@@ -7,9 +9,9 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
7
9
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
10
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
11
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
10
|
-
import { useInteractionItemProps } from
|
|
11
|
-
import { AnimatedArea } from
|
|
12
|
-
import { useItemHighlighted } from
|
|
12
|
+
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
13
|
+
import { AnimatedArea } from "./AnimatedArea.js";
|
|
14
|
+
import { useItemHighlighted } from "../context/index.js";
|
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
16
|
export function getAreaElementUtilityClass(slot) {
|
|
15
17
|
return generateUtilityClass('MuiAreaElement', slot);
|
package/LineChart/AreaPlot.js
CHANGED
|
@@ -1,94 +1,101 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
5
|
const _excluded = ["slots", "slotProps", "onItemClick", "skipAnimation"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
8
|
import { area as d3Area } from '@mui/x-charts-vendor/d3-shape';
|
|
7
|
-
import { useCartesianContext } from
|
|
8
|
-
import { AreaElement } from
|
|
9
|
-
import { getValueToPositionMapper } from
|
|
10
|
-
import getCurveFactory from
|
|
11
|
-
import { DEFAULT_X_AXIS_KEY } from
|
|
12
|
-
import { useChartGradient } from
|
|
13
|
-
import { useLineSeries } from
|
|
9
|
+
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
10
|
+
import { AreaElement } from "./AreaElement.js";
|
|
11
|
+
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
12
|
+
import getCurveFactory from "../internals/getCurve.js";
|
|
13
|
+
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
14
|
+
import { useChartGradient } from "../internals/components/ChartsAxesGradients/index.js";
|
|
15
|
+
import { useLineSeries } from "../hooks/useSeries.js";
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
const useAggregatedData = () => {
|
|
16
18
|
const seriesData = useLineSeries();
|
|
17
19
|
const axisData = useCartesianContext();
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
return
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
return yScale(baseline);
|
|
65
|
-
}
|
|
66
|
-
if (baseline === 'max') {
|
|
67
|
-
return yScale.range()[1];
|
|
68
|
-
}
|
|
69
|
-
if (baseline === 'min') {
|
|
70
|
-
return yScale.range()[0];
|
|
71
|
-
}
|
|
72
|
-
const value = d.y && yScale(d.y[0]);
|
|
73
|
-
if (Number.isNaN(value)) {
|
|
74
|
-
return yScale.range()[0];
|
|
20
|
+
|
|
21
|
+
// This memo prevents odd line chart behavior when hydrating.
|
|
22
|
+
const allData = React.useMemo(() => {
|
|
23
|
+
if (seriesData === undefined) {
|
|
24
|
+
return [];
|
|
25
|
+
}
|
|
26
|
+
const {
|
|
27
|
+
series,
|
|
28
|
+
stackingGroups
|
|
29
|
+
} = seriesData;
|
|
30
|
+
const {
|
|
31
|
+
xAxis,
|
|
32
|
+
yAxis,
|
|
33
|
+
xAxisIds,
|
|
34
|
+
yAxisIds
|
|
35
|
+
} = axisData;
|
|
36
|
+
const defaultXAxisId = xAxisIds[0];
|
|
37
|
+
const defaultYAxisId = yAxisIds[0];
|
|
38
|
+
return stackingGroups.flatMap(({
|
|
39
|
+
ids: groupIds
|
|
40
|
+
}) => {
|
|
41
|
+
return [...groupIds].reverse() // Revert stacked area for a more pleasant animation
|
|
42
|
+
.map(seriesId => {
|
|
43
|
+
const {
|
|
44
|
+
xAxisId: xAxisIdProp,
|
|
45
|
+
yAxisId: yAxisIdProp,
|
|
46
|
+
xAxisKey = defaultXAxisId,
|
|
47
|
+
yAxisKey = defaultYAxisId,
|
|
48
|
+
stackedData,
|
|
49
|
+
data,
|
|
50
|
+
connectNulls,
|
|
51
|
+
baseline
|
|
52
|
+
} = series[seriesId];
|
|
53
|
+
const xAxisId = xAxisIdProp ?? xAxisKey;
|
|
54
|
+
const yAxisId = yAxisIdProp ?? yAxisKey;
|
|
55
|
+
const xScale = getValueToPositionMapper(xAxis[xAxisId].scale);
|
|
56
|
+
const yScale = yAxis[yAxisId].scale;
|
|
57
|
+
const xData = xAxis[xAxisId].data;
|
|
58
|
+
const gradientUsed = yAxis[yAxisId].colorScale && [yAxisId, 'y'] || xAxis[xAxisId].colorScale && [xAxisId, 'x'] || undefined;
|
|
59
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
60
|
+
if (xData === undefined) {
|
|
61
|
+
throw new Error(`MUI X: ${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.`);
|
|
62
|
+
}
|
|
63
|
+
if (xData.length < stackedData.length) {
|
|
64
|
+
throw new Error(`MUI X: The data length of the x axis (${xData.length} items) is lower than the length of series (${stackedData.length} items).`);
|
|
65
|
+
}
|
|
75
66
|
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
67
|
+
const areaPath = d3Area().x(d => xScale(d.x)).defined((_, i) => connectNulls || data[i] != null).y0(d => {
|
|
68
|
+
if (typeof baseline === 'number') {
|
|
69
|
+
return yScale(baseline);
|
|
70
|
+
}
|
|
71
|
+
if (baseline === 'max') {
|
|
72
|
+
return yScale.range()[1];
|
|
73
|
+
}
|
|
74
|
+
if (baseline === 'min') {
|
|
75
|
+
return yScale.range()[0];
|
|
76
|
+
}
|
|
77
|
+
const value = d.y && yScale(d.y[0]);
|
|
78
|
+
if (Number.isNaN(value)) {
|
|
79
|
+
return yScale.range()[0];
|
|
80
|
+
}
|
|
81
|
+
return value;
|
|
82
|
+
}).y1(d => d.y && yScale(d.y[1]));
|
|
83
|
+
const curve = getCurveFactory(series[seriesId].curve);
|
|
84
|
+
const formattedData = xData?.map((x, index) => ({
|
|
85
|
+
x,
|
|
86
|
+
y: stackedData[index]
|
|
87
|
+
})) ?? [];
|
|
88
|
+
const d3Data = connectNulls ? formattedData.filter((_, i) => data[i] != null) : formattedData;
|
|
89
|
+
const d = areaPath.curve(curve)(d3Data) || '';
|
|
90
|
+
return _extends({}, series[seriesId], {
|
|
91
|
+
gradientUsed,
|
|
92
|
+
d,
|
|
93
|
+
seriesId
|
|
94
|
+
});
|
|
89
95
|
});
|
|
90
96
|
});
|
|
91
|
-
});
|
|
97
|
+
}, [seriesData, axisData]);
|
|
98
|
+
return allData;
|
|
92
99
|
};
|
|
93
100
|
|
|
94
101
|
/**
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { MarkElementOwnerState } from './markElementClasses';
|
|
3
|
+
export type CircleMarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighlighted'> & Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> & {
|
|
4
|
+
/**
|
|
5
|
+
* The shape of the marker.
|
|
6
|
+
*/
|
|
7
|
+
shape: 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye';
|
|
8
|
+
/**
|
|
9
|
+
* If `true`, animations are skipped.
|
|
10
|
+
* @default false
|
|
11
|
+
*/
|
|
12
|
+
skipAnimation?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* The index to the element in the series' data array.
|
|
15
|
+
*/
|
|
16
|
+
dataIndex: number;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* The line mark element that only render circle for performance improvement.
|
|
20
|
+
*
|
|
21
|
+
* Demos:
|
|
22
|
+
*
|
|
23
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
24
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
25
|
+
*
|
|
26
|
+
* API:
|
|
27
|
+
*
|
|
28
|
+
* - [CircleMarkElement API](https://mui.com/x/api/charts/circle-mark-element/)
|
|
29
|
+
*/
|
|
30
|
+
declare function CircleMarkElement(props: CircleMarkElementProps): React.JSX.Element;
|
|
31
|
+
declare namespace CircleMarkElement {
|
|
32
|
+
var propTypes: any;
|
|
33
|
+
}
|
|
34
|
+
export { CircleMarkElement };
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["x", "y", "id", "classes", "color", "dataIndex", "onClick", "skipAnimation", "shape"];
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import { useTheme } from '@mui/material/styles';
|
|
9
|
+
import { warnOnce } from '@mui/x-internals/warning';
|
|
10
|
+
import { animated, useSpring } from '@react-spring/web';
|
|
11
|
+
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
12
|
+
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
13
|
+
import { useItemHighlighted } from "../context/index.js";
|
|
14
|
+
import { useUtilityClasses } from "./markElementClasses.js";
|
|
15
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
|
+
/**
|
|
17
|
+
* The line mark element that only render circle for performance improvement.
|
|
18
|
+
*
|
|
19
|
+
* Demos:
|
|
20
|
+
*
|
|
21
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
22
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
23
|
+
*
|
|
24
|
+
* API:
|
|
25
|
+
*
|
|
26
|
+
* - [CircleMarkElement API](https://mui.com/x/api/charts/circle-mark-element/)
|
|
27
|
+
*/
|
|
28
|
+
function CircleMarkElement(props) {
|
|
29
|
+
const {
|
|
30
|
+
x,
|
|
31
|
+
y,
|
|
32
|
+
id,
|
|
33
|
+
classes: innerClasses,
|
|
34
|
+
color,
|
|
35
|
+
dataIndex,
|
|
36
|
+
onClick,
|
|
37
|
+
skipAnimation,
|
|
38
|
+
shape
|
|
39
|
+
} = props,
|
|
40
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
41
|
+
if (shape !== 'circle') {
|
|
42
|
+
warnOnce([`MUI X: The mark element of your line chart have shape "${shape}" which is not supported when using \`experimentalRendering=true\`.`, 'Only "circle" are supported with `experimentalRendering`.'].join('\n'), 'error');
|
|
43
|
+
}
|
|
44
|
+
const theme = useTheme();
|
|
45
|
+
const getInteractionItemProps = useInteractionItemProps();
|
|
46
|
+
const {
|
|
47
|
+
isFaded,
|
|
48
|
+
isHighlighted
|
|
49
|
+
} = useItemHighlighted({
|
|
50
|
+
seriesId: id
|
|
51
|
+
});
|
|
52
|
+
const {
|
|
53
|
+
axis
|
|
54
|
+
} = React.useContext(InteractionContext);
|
|
55
|
+
const position = useSpring({
|
|
56
|
+
to: {
|
|
57
|
+
x,
|
|
58
|
+
y
|
|
59
|
+
},
|
|
60
|
+
immediate: skipAnimation
|
|
61
|
+
});
|
|
62
|
+
const ownerState = {
|
|
63
|
+
id,
|
|
64
|
+
classes: innerClasses,
|
|
65
|
+
isHighlighted: axis.x?.index === dataIndex || isHighlighted,
|
|
66
|
+
isFaded,
|
|
67
|
+
color
|
|
68
|
+
};
|
|
69
|
+
const classes = useUtilityClasses(ownerState);
|
|
70
|
+
return /*#__PURE__*/_jsx(animated.circle, _extends({}, other, {
|
|
71
|
+
cx: position.x,
|
|
72
|
+
cy: position.y,
|
|
73
|
+
r: 5,
|
|
74
|
+
fill: (theme.vars || theme).palette.background.paper,
|
|
75
|
+
stroke: color,
|
|
76
|
+
strokeWidth: 2,
|
|
77
|
+
className: classes.root,
|
|
78
|
+
onClick: onClick,
|
|
79
|
+
cursor: onClick ? 'pointer' : 'unset'
|
|
80
|
+
}, getInteractionItemProps({
|
|
81
|
+
type: 'line',
|
|
82
|
+
seriesId: id,
|
|
83
|
+
dataIndex
|
|
84
|
+
})));
|
|
85
|
+
}
|
|
86
|
+
process.env.NODE_ENV !== "production" ? CircleMarkElement.propTypes = {
|
|
87
|
+
// ----------------------------- Warning --------------------------------
|
|
88
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
89
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
90
|
+
// ----------------------------------------------------------------------
|
|
91
|
+
classes: PropTypes.object,
|
|
92
|
+
/**
|
|
93
|
+
* The index to the element in the series' data array.
|
|
94
|
+
*/
|
|
95
|
+
dataIndex: PropTypes.number.isRequired,
|
|
96
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
97
|
+
/**
|
|
98
|
+
* The shape of the marker.
|
|
99
|
+
*/
|
|
100
|
+
shape: PropTypes.oneOf(['circle', 'cross', 'diamond', 'square', 'star', 'triangle', 'wye']).isRequired,
|
|
101
|
+
/**
|
|
102
|
+
* If `true`, animations are skipped.
|
|
103
|
+
* @default false
|
|
104
|
+
*/
|
|
105
|
+
skipAnimation: PropTypes.bool
|
|
106
|
+
} : void 0;
|
|
107
|
+
export { CircleMarkElement };
|
package/LineChart/LineChart.d.ts
CHANGED
|
@@ -75,6 +75,10 @@ export interface LineChartProps extends Omit<ResponsiveChartContainerProps, 'ser
|
|
|
75
75
|
* @default false
|
|
76
76
|
*/
|
|
77
77
|
skipAnimation?: boolean;
|
|
78
|
+
/**
|
|
79
|
+
* If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
|
|
80
|
+
*/
|
|
81
|
+
experimentalMarkRendering?: boolean;
|
|
78
82
|
}
|
|
79
83
|
/**
|
|
80
84
|
* Demos:
|
package/LineChart/LineChart.js
CHANGED
|
@@ -1,21 +1,23 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import * as React from 'react';
|
|
3
5
|
import PropTypes from 'prop-types';
|
|
4
6
|
import { useThemeProps } from '@mui/material/styles';
|
|
5
|
-
import { AreaPlot } from
|
|
6
|
-
import { LinePlot } from
|
|
7
|
-
import { ResponsiveChartContainer } from
|
|
8
|
-
import { MarkPlot } from
|
|
9
|
-
import { ChartsAxis } from
|
|
10
|
-
import { ChartsTooltip } from
|
|
11
|
-
import { ChartsLegend } from
|
|
12
|
-
import { ChartsAxisHighlight } from
|
|
13
|
-
import { ChartsClipPath } from
|
|
14
|
-
import { LineHighlightPlot } from
|
|
15
|
-
import { ChartsGrid } from
|
|
16
|
-
import { ChartsOnAxisClickHandler } from
|
|
17
|
-
import { ChartsOverlay } from
|
|
18
|
-
import { useLineChartProps } from
|
|
7
|
+
import { AreaPlot } from "./AreaPlot.js";
|
|
8
|
+
import { LinePlot } from "./LinePlot.js";
|
|
9
|
+
import { ResponsiveChartContainer } from "../ResponsiveChartContainer/index.js";
|
|
10
|
+
import { MarkPlot } from "./MarkPlot.js";
|
|
11
|
+
import { ChartsAxis } from "../ChartsAxis/ChartsAxis.js";
|
|
12
|
+
import { ChartsTooltip } from "../ChartsTooltip/index.js";
|
|
13
|
+
import { ChartsLegend } from "../ChartsLegend/index.js";
|
|
14
|
+
import { ChartsAxisHighlight } from "../ChartsAxisHighlight/index.js";
|
|
15
|
+
import { ChartsClipPath } from "../ChartsClipPath/index.js";
|
|
16
|
+
import { LineHighlightPlot } from "./LineHighlightPlot.js";
|
|
17
|
+
import { ChartsGrid } from "../ChartsGrid/index.js";
|
|
18
|
+
import { ChartsOnAxisClickHandler } from "../ChartsOnAxisClickHandler/index.js";
|
|
19
|
+
import { ChartsOverlay } from "../ChartsOverlay/index.js";
|
|
20
|
+
import { useLineChartProps } from "./useLineChartProps.js";
|
|
19
21
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
22
|
/**
|
|
21
23
|
* Demos:
|
|
@@ -52,7 +54,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(inProps, ref)
|
|
|
52
54
|
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, _extends({
|
|
53
55
|
ref: ref
|
|
54
56
|
}, chartContainerProps, {
|
|
55
|
-
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)),
|
|
57
|
+
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
56
58
|
children: [/*#__PURE__*/_jsx(AreaPlot, _extends({}, areaPlotProps)), /*#__PURE__*/_jsx(LinePlot, _extends({}, linePlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
57
59
|
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), /*#__PURE__*/_jsx("g", {
|
|
58
60
|
"data-drawing-container": true,
|
|
@@ -102,6 +104,10 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
102
104
|
* If `true`, render the line highlight item.
|
|
103
105
|
*/
|
|
104
106
|
disableLineItemHighlight: PropTypes.bool,
|
|
107
|
+
/**
|
|
108
|
+
* If `true` marks will render `<circle />` instead of `<path />` and drop theme override for faster rendering.
|
|
109
|
+
*/
|
|
110
|
+
experimentalMarkRendering: PropTypes.bool,
|
|
105
111
|
/**
|
|
106
112
|
* Option to display a cartesian grid in the background.
|
|
107
113
|
*/
|
|
@@ -133,6 +139,18 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
133
139
|
classes: PropTypes.object,
|
|
134
140
|
direction: PropTypes.oneOf(['column', 'row']),
|
|
135
141
|
hidden: PropTypes.bool,
|
|
142
|
+
itemGap: PropTypes.number,
|
|
143
|
+
itemMarkHeight: PropTypes.number,
|
|
144
|
+
itemMarkWidth: PropTypes.number,
|
|
145
|
+
labelStyle: PropTypes.object,
|
|
146
|
+
markGap: PropTypes.number,
|
|
147
|
+
onItemClick: PropTypes.func,
|
|
148
|
+
padding: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
149
|
+
bottom: PropTypes.number,
|
|
150
|
+
left: PropTypes.number,
|
|
151
|
+
right: PropTypes.number,
|
|
152
|
+
top: PropTypes.number
|
|
153
|
+
})]),
|
|
136
154
|
position: PropTypes.shape({
|
|
137
155
|
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
138
156
|
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
package/LineChart/LineElement.js
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick"];
|
|
@@ -7,9 +9,9 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
7
9
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
10
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
11
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
10
|
-
import { useInteractionItemProps } from
|
|
11
|
-
import { AnimatedLine } from
|
|
12
|
-
import { useItemHighlighted } from
|
|
12
|
+
import { useInteractionItemProps } from "../hooks/useInteractionItemProps.js";
|
|
13
|
+
import { AnimatedLine } from "./AnimatedLine.js";
|
|
14
|
+
import { useItemHighlighted } from "../context/index.js";
|
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
16
|
export function getLineElementUtilityClass(slot) {
|
|
15
17
|
return generateUtilityClass('MuiLineElement', slot);
|
|
@@ -1,16 +1,18 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
1
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
5
|
const _excluded = ["slots", "slotProps"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import PropTypes from 'prop-types';
|
|
6
|
-
import { useCartesianContext } from
|
|
7
|
-
import { LineHighlightElement } from
|
|
8
|
-
import { getValueToPositionMapper } from
|
|
9
|
-
import { InteractionContext } from
|
|
10
|
-
import { DEFAULT_X_AXIS_KEY } from
|
|
11
|
-
import getColor from
|
|
12
|
-
import { useLineSeries } from
|
|
13
|
-
import { useDrawingArea } from
|
|
8
|
+
import { useCartesianContext } from "../context/CartesianProvider/index.js";
|
|
9
|
+
import { LineHighlightElement } from "./LineHighlightElement.js";
|
|
10
|
+
import { getValueToPositionMapper } from "../hooks/useScale.js";
|
|
11
|
+
import { InteractionContext } from "../context/InteractionProvider.js";
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
13
|
+
import getColor from "./getColor.js";
|
|
14
|
+
import { useLineSeries } from "../hooks/useSeries.js";
|
|
15
|
+
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
14
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
17
|
/**
|
|
16
18
|
* Demos:
|