@mui/x-charts 8.0.0-beta.1 → 8.0.0-beta.3
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 +38 -8
- package/BarChart/AnimatedBarElement.js +5 -5
- package/BarChart/BarChart.js +2 -0
- package/BarChart/BarClipPath.d.ts +19 -1
- package/BarChart/BarClipPath.js +84 -17
- package/BarChart/BarElement.d.ts +9 -20
- package/BarChart/BarElement.js +29 -26
- package/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/BarChart/BarLabel/BarLabel.js +32 -5
- package/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/BarChart/BarPlot.js +37 -61
- package/BarChart/barElementClasses.d.ts +21 -0
- package/BarChart/barElementClasses.js +29 -0
- package/BarChart/getRadius.d.ts +1 -1
- package/BarChart/index.d.ts +2 -1
- package/BarChart/index.js +11 -0
- package/BarChart/seriesConfig/index.js +3 -1
- package/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/BarChart/seriesConfig/tooltip.js +14 -1
- package/BarChart/types.d.ts +2 -2
- package/BarChart/useBarChartProps.d.ts +2 -1
- package/BarChart/useBarChartProps.js +20 -13
- package/CHANGELOG.md +235 -0
- package/ChartContainer/ChartContainer.js +4 -0
- package/ChartsAxisHighlight/ChartsXAxisHighlight.js +8 -8
- package/ChartsAxisHighlight/ChartsYAxisHighlight.js +8 -8
- package/ChartsLabel/ChartsLabelMark.js +0 -4
- package/ChartsLabel/index.d.ts +1 -0
- package/ChartsLabel/index.js +7 -0
- package/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/ChartsOverlay/ChartsLoadingOverlay.js +1 -1
- package/ChartsOverlay/ChartsNoDataOverlay.js +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/ChartsTooltip/ChartsTooltip.js +2 -2
- package/ChartsTooltip/ChartsTooltipContainer.js +4 -8
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/ChartsTooltip/ChartsTooltipTable.js +24 -9
- package/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/ChartsTooltip/index.d.ts +1 -0
- package/ChartsTooltip/index.js +12 -0
- package/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/ChartsTooltip/useAxesTooltip.js +18 -0
- package/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/ChartsTooltip/useAxisTooltip.js +72 -38
- package/ChartsTooltip/useItemTooltip.js +4 -1
- package/ChartsXAxis/ChartsXAxis.js +5 -2
- package/ChartsYAxis/ChartsYAxis.js +69 -17
- package/LineChart/AnimatedArea.js +5 -22
- package/LineChart/AnimatedLine.d.ts +1 -4
- package/LineChart/AnimatedLine.js +10 -25
- package/LineChart/AppearingMask.d.ts +5 -0
- package/LineChart/AppearingMask.js +25 -18
- package/LineChart/CircleMarkElement.js +17 -23
- package/LineChart/LineChart.js +2 -0
- package/LineChart/LineHighlightPlot.js +3 -4
- package/LineChart/MarkElement.js +16 -27
- package/LineChart/MarkPlot.js +0 -1
- package/LineChart/markElementClasses.d.ts +3 -0
- package/LineChart/markElementClasses.js +4 -3
- package/LineChart/seriesConfig/index.js +3 -1
- package/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/LineChart/seriesConfig/tooltip.js +8 -1
- package/LineChart/useLineChartProps.d.ts +2 -1
- package/LineChart/useLineChartProps.js +7 -4
- package/PieChart/PieArc.d.ts +19 -11
- package/PieChart/PieArc.js +37 -24
- package/PieChart/PieArcLabel.d.ts +22 -13
- package/PieChart/PieArcLabel.js +52 -48
- package/PieChart/PieArcLabelPlot.js +16 -34
- package/PieChart/PieArcPlot.js +21 -34
- package/PieChart/seriesConfig/tooltip.js +3 -0
- package/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +9 -5
- package/RadarChart/RadarGrid/RadarGrid.d.ts +1 -1
- package/RadarChart/RadarGrid/RadarGrid.js +5 -1
- package/RadarChart/RadarGrid/useRadarGridData.d.ts +1 -1
- package/RadarChart/RadarGrid/useRadarGridData.js +3 -0
- package/RadarChart/RadarSeriesPlot/useRadarSeriesData.js +2 -2
- package/ScatterChart/ScatterChart.js +2 -0
- package/ScatterChart/useScatterChartProps.d.ts +2 -1
- package/ScatterChart/useScatterChartProps.js +6 -3
- package/SparkLineChart/SparkLineChart.js +2 -0
- package/colorPalettes/colorPalettes.js +2 -2
- package/constants/index.d.ts +1 -1
- package/constants/index.js +1 -1
- package/context/AnimationProvider/AnimationProvider.js +4 -6
- package/esm/BarChart/AnimatedBarElement.d.ts +38 -8
- package/esm/BarChart/AnimatedBarElement.js +5 -5
- package/esm/BarChart/BarChart.js +2 -0
- package/esm/BarChart/BarClipPath.d.ts +19 -1
- package/esm/BarChart/BarClipPath.js +84 -17
- package/esm/BarChart/BarElement.d.ts +9 -20
- package/esm/BarChart/BarElement.js +28 -23
- package/esm/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/esm/BarChart/BarLabel/BarLabel.js +32 -5
- package/esm/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/esm/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/esm/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/esm/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/esm/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/esm/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/esm/BarChart/BarPlot.js +37 -61
- package/esm/BarChart/barElementClasses.d.ts +21 -0
- package/esm/BarChart/barElementClasses.js +19 -0
- package/esm/BarChart/getRadius.d.ts +1 -1
- package/esm/BarChart/index.d.ts +2 -1
- package/esm/BarChart/index.js +2 -1
- package/esm/BarChart/seriesConfig/index.js +2 -1
- package/esm/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/esm/BarChart/seriesConfig/tooltip.js +12 -0
- package/esm/BarChart/types.d.ts +2 -2
- package/esm/BarChart/useBarChartProps.d.ts +2 -1
- package/esm/BarChart/useBarChartProps.js +19 -13
- package/esm/ChartContainer/ChartContainer.js +4 -0
- package/esm/ChartsAxisHighlight/ChartsXAxisHighlight.js +8 -8
- package/esm/ChartsAxisHighlight/ChartsYAxisHighlight.js +8 -8
- package/esm/ChartsLabel/ChartsLabelMark.js +0 -4
- package/esm/ChartsLabel/index.d.ts +1 -0
- package/esm/ChartsLabel/index.js +1 -0
- package/esm/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/esm/ChartsOverlay/ChartsLoadingOverlay.js +1 -1
- package/esm/ChartsOverlay/ChartsNoDataOverlay.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +5 -9
- package/esm/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/esm/ChartsTooltip/ChartsTooltipTable.js +23 -9
- package/esm/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/esm/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/esm/ChartsTooltip/index.d.ts +1 -0
- package/esm/ChartsTooltip/index.js +1 -0
- package/esm/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/esm/ChartsTooltip/useAxesTooltip.js +12 -0
- package/esm/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/esm/ChartsTooltip/useAxisTooltip.js +72 -38
- package/esm/ChartsTooltip/useItemTooltip.js +4 -1
- package/esm/ChartsXAxis/ChartsXAxis.js +5 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +69 -17
- package/esm/LineChart/AnimatedArea.js +5 -22
- package/esm/LineChart/AnimatedLine.d.ts +1 -4
- package/esm/LineChart/AnimatedLine.js +9 -24
- package/esm/LineChart/AppearingMask.d.ts +5 -0
- package/esm/LineChart/AppearingMask.js +23 -18
- package/esm/LineChart/CircleMarkElement.js +19 -25
- package/esm/LineChart/LineChart.js +2 -0
- package/esm/LineChart/LineHighlightPlot.js +3 -4
- package/esm/LineChart/MarkElement.js +17 -28
- package/esm/LineChart/MarkPlot.js +0 -1
- package/esm/LineChart/markElementClasses.d.ts +3 -0
- package/esm/LineChart/markElementClasses.js +4 -3
- package/esm/LineChart/seriesConfig/index.js +2 -1
- package/esm/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/esm/LineChart/seriesConfig/tooltip.js +6 -0
- package/esm/LineChart/useLineChartProps.d.ts +2 -1
- package/esm/LineChart/useLineChartProps.js +6 -4
- package/esm/PieChart/PieArc.d.ts +19 -11
- package/esm/PieChart/PieArc.js +36 -23
- package/esm/PieChart/PieArcLabel.d.ts +22 -13
- package/esm/PieChart/PieArcLabel.js +51 -47
- package/esm/PieChart/PieArcLabelPlot.js +16 -34
- package/esm/PieChart/PieArcPlot.js +21 -34
- package/esm/PieChart/seriesConfig/tooltip.js +3 -0
- package/esm/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +9 -5
- package/esm/RadarChart/RadarGrid/RadarGrid.d.ts +1 -1
- package/esm/RadarChart/RadarGrid/RadarGrid.js +5 -1
- package/esm/RadarChart/RadarGrid/useRadarGridData.d.ts +1 -1
- package/esm/RadarChart/RadarGrid/useRadarGridData.js +3 -0
- package/esm/RadarChart/RadarSeriesPlot/useRadarSeriesData.js +2 -2
- package/esm/ScatterChart/ScatterChart.js +2 -0
- package/esm/ScatterChart/useScatterChartProps.d.ts +2 -1
- package/esm/ScatterChart/useScatterChartProps.js +5 -3
- package/esm/SparkLineChart/SparkLineChart.js +2 -0
- package/esm/colorPalettes/colorPalettes.js +2 -2
- package/esm/constants/index.d.ts +1 -1
- package/esm/constants/index.js +1 -1
- package/esm/context/AnimationProvider/AnimationProvider.js +3 -6
- package/esm/hooks/animation/index.d.ts +6 -0
- package/esm/hooks/animation/index.js +6 -0
- package/esm/hooks/animation/useAnimateArea.d.ts +15 -0
- package/esm/hooks/animation/useAnimateArea.js +27 -0
- package/esm/hooks/animation/useAnimateBar.d.ts +17 -0
- package/esm/hooks/animation/useAnimateBar.js +56 -0
- package/esm/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/esm/hooks/animation/useAnimateBarLabel.js +59 -0
- package/esm/hooks/animation/useAnimateLine.d.ts +14 -0
- package/esm/hooks/animation/useAnimateLine.js +26 -0
- package/esm/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/esm/hooks/animation/useAnimatePieArc.js +70 -0
- package/esm/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/esm/hooks/animation/useAnimatePieArcLabel.js +72 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useAxis.d.ts +5 -5
- package/esm/hooks/useInteractionItemProps.js +11 -0
- package/esm/hooks/useScale.d.ts +2 -2
- package/esm/hooks/useScale.js +2 -2
- package/esm/index.js +1 -1
- package/esm/internals/animation/Transition.d.ts +37 -0
- package/esm/internals/animation/Transition.js +83 -0
- package/esm/internals/animation/animation.d.ts +4 -0
- package/esm/internals/animation/animation.js +4 -0
- package/esm/internals/animation/useAnimate.d.ts +19 -0
- package/esm/internals/animation/useAnimate.js +74 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +8 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +28 -22
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +9 -42
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +75 -0
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +7 -20
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +36 -242
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +4 -10
- package/esm/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +9 -15
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +12 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +8 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.d.ts +6 -4
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.js +18 -13
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +16 -32
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3669 -0
- package/esm/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +22 -0
- package/esm/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/esm/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/esm/internals/shallowEqual.d.ts +8 -0
- package/esm/internals/shallowEqual.js +31 -0
- package/esm/models/axis.d.ts +8 -0
- package/esm/themeAugmentation/overrides.d.ts +1 -1
- package/hooks/animation/index.d.ts +6 -0
- package/hooks/animation/index.js +71 -0
- package/hooks/animation/useAnimateArea.d.ts +15 -0
- package/hooks/animation/useAnimateArea.js +34 -0
- package/hooks/animation/useAnimateBar.d.ts +17 -0
- package/hooks/animation/useAnimateBar.js +62 -0
- package/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/hooks/animation/useAnimateBarLabel.js +65 -0
- package/hooks/animation/useAnimateLine.d.ts +14 -0
- package/hooks/animation/useAnimateLine.js +33 -0
- package/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/hooks/animation/useAnimatePieArc.js +77 -0
- package/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/hooks/animation/useAnimatePieArcLabel.js +79 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +13 -1
- package/hooks/useAxis.d.ts +5 -5
- package/hooks/useInteractionItemProps.js +11 -0
- package/hooks/useScale.d.ts +2 -2
- package/hooks/useScale.js +2 -2
- package/index.js +1 -1
- package/internals/animation/Transition.d.ts +37 -0
- package/internals/animation/Transition.js +89 -0
- package/internals/animation/animation.d.ts +4 -0
- package/internals/animation/animation.js +11 -0
- package/internals/animation/useAnimate.d.ts +19 -0
- package/internals/animation/useAnimate.js +80 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +28 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +8 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +29 -22
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +12 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +7 -40
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +81 -0
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +7 -20
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +36 -242
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +5 -11
- package/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +9 -15
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +12 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +17 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.d.ts +6 -4
- package/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.js +19 -13
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +16 -32
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3669 -0
- package/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +28 -0
- package/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/internals/shallowEqual.d.ts +8 -0
- package/internals/shallowEqual.js +37 -0
- package/models/axis.d.ts +8 -0
- package/modern/BarChart/AnimatedBarElement.d.ts +38 -8
- package/modern/BarChart/AnimatedBarElement.js +5 -5
- package/modern/BarChart/BarChart.js +2 -0
- package/modern/BarChart/BarClipPath.d.ts +19 -1
- package/modern/BarChart/BarClipPath.js +84 -17
- package/modern/BarChart/BarElement.d.ts +9 -20
- package/modern/BarChart/BarElement.js +28 -23
- package/modern/BarChart/BarLabel/BarLabel.d.ts +27 -854
- package/modern/BarChart/BarLabel/BarLabel.js +32 -5
- package/modern/BarChart/BarLabel/BarLabel.types.d.ts +2 -0
- package/modern/BarChart/BarLabel/BarLabelItem.d.ts +24 -0
- package/modern/BarChart/BarLabel/BarLabelItem.js +18 -6
- package/modern/BarChart/BarLabel/BarLabelPlot.js +16 -46
- package/modern/BarChart/BarLabel/barLabelClasses.d.ts +3 -1
- package/modern/BarChart/BarLabel/barLabelClasses.js +4 -3
- package/modern/BarChart/BarPlot.js +37 -61
- package/modern/BarChart/barElementClasses.d.ts +21 -0
- package/modern/BarChart/barElementClasses.js +19 -0
- package/modern/BarChart/getRadius.d.ts +1 -1
- package/modern/BarChart/index.d.ts +2 -1
- package/modern/BarChart/index.js +2 -1
- package/modern/BarChart/seriesConfig/index.js +2 -1
- package/modern/BarChart/seriesConfig/tooltip.d.ts +2 -1
- package/modern/BarChart/seriesConfig/tooltip.js +12 -0
- package/modern/BarChart/types.d.ts +2 -2
- package/modern/BarChart/useBarChartProps.d.ts +2 -1
- package/modern/BarChart/useBarChartProps.js +19 -13
- package/modern/ChartContainer/ChartContainer.js +4 -0
- package/modern/ChartsAxisHighlight/ChartsXAxisHighlight.js +8 -8
- package/modern/ChartsAxisHighlight/ChartsYAxisHighlight.js +8 -8
- package/modern/ChartsLabel/ChartsLabelMark.js +0 -4
- package/modern/ChartsLabel/index.d.ts +1 -0
- package/modern/ChartsLabel/index.js +1 -0
- package/modern/ChartsLegend/continuousColorLegendClasses.d.ts +1 -1
- package/modern/ChartsOverlay/ChartsLoadingOverlay.js +1 -1
- package/modern/ChartsOverlay/ChartsNoDataOverlay.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +5 -9
- package/modern/ChartsTooltip/ChartsTooltipTable.d.ts +3 -1
- package/modern/ChartsTooltip/ChartsTooltipTable.js +23 -9
- package/modern/ChartsTooltip/chartsTooltipClasses.d.ts +4 -4
- package/modern/ChartsTooltip/chartsTooltipClasses.js +2 -2
- package/modern/ChartsTooltip/index.d.ts +1 -0
- package/modern/ChartsTooltip/index.js +1 -0
- package/modern/ChartsTooltip/useAxesTooltip.d.ts +7 -0
- package/modern/ChartsTooltip/useAxesTooltip.js +12 -0
- package/modern/ChartsTooltip/useAxisTooltip.d.ts +24 -3
- package/modern/ChartsTooltip/useAxisTooltip.js +72 -38
- package/modern/ChartsTooltip/useItemTooltip.js +4 -1
- package/modern/ChartsXAxis/ChartsXAxis.js +5 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +69 -17
- package/modern/LineChart/AnimatedArea.js +5 -22
- package/modern/LineChart/AnimatedLine.d.ts +1 -4
- package/modern/LineChart/AnimatedLine.js +9 -24
- package/modern/LineChart/AppearingMask.d.ts +5 -0
- package/modern/LineChart/AppearingMask.js +23 -18
- package/modern/LineChart/CircleMarkElement.js +19 -25
- package/modern/LineChart/LineChart.js +2 -0
- package/modern/LineChart/LineHighlightPlot.js +3 -4
- package/modern/LineChart/MarkElement.js +17 -28
- package/modern/LineChart/MarkPlot.js +0 -1
- package/modern/LineChart/markElementClasses.d.ts +3 -0
- package/modern/LineChart/markElementClasses.js +4 -3
- package/modern/LineChart/seriesConfig/index.js +2 -1
- package/modern/LineChart/seriesConfig/tooltip.d.ts +2 -1
- package/modern/LineChart/seriesConfig/tooltip.js +6 -0
- package/modern/LineChart/useLineChartProps.d.ts +2 -1
- package/modern/LineChart/useLineChartProps.js +6 -4
- package/modern/PieChart/PieArc.d.ts +19 -11
- package/modern/PieChart/PieArc.js +36 -23
- package/modern/PieChart/PieArcLabel.d.ts +22 -13
- package/modern/PieChart/PieArcLabel.js +51 -47
- package/modern/PieChart/PieArcLabelPlot.js +16 -34
- package/modern/PieChart/PieArcPlot.js +21 -34
- package/modern/PieChart/seriesConfig/tooltip.js +3 -0
- package/modern/RadarChart/RadarAxisHighlight/useRadarAxisHighlight.js +9 -5
- package/modern/RadarChart/RadarGrid/RadarGrid.d.ts +1 -1
- package/modern/RadarChart/RadarGrid/RadarGrid.js +5 -1
- package/modern/RadarChart/RadarGrid/useRadarGridData.d.ts +1 -1
- package/modern/RadarChart/RadarGrid/useRadarGridData.js +3 -0
- package/modern/RadarChart/RadarSeriesPlot/useRadarSeriesData.js +2 -2
- package/modern/ScatterChart/ScatterChart.js +2 -0
- package/modern/ScatterChart/useScatterChartProps.d.ts +2 -1
- package/modern/ScatterChart/useScatterChartProps.js +5 -3
- package/modern/SparkLineChart/SparkLineChart.js +2 -0
- package/modern/colorPalettes/colorPalettes.js +2 -2
- package/modern/constants/index.d.ts +1 -1
- package/modern/constants/index.js +1 -1
- package/modern/context/AnimationProvider/AnimationProvider.js +3 -6
- package/modern/hooks/animation/index.d.ts +6 -0
- package/modern/hooks/animation/index.js +6 -0
- package/modern/hooks/animation/useAnimateArea.d.ts +15 -0
- package/modern/hooks/animation/useAnimateArea.js +27 -0
- package/modern/hooks/animation/useAnimateBar.d.ts +17 -0
- package/modern/hooks/animation/useAnimateBar.js +56 -0
- package/modern/hooks/animation/useAnimateBarLabel.d.ts +19 -0
- package/modern/hooks/animation/useAnimateBarLabel.js +59 -0
- package/modern/hooks/animation/useAnimateLine.d.ts +14 -0
- package/modern/hooks/animation/useAnimateLine.js +26 -0
- package/modern/hooks/animation/useAnimatePieArc.d.ts +15 -0
- package/modern/hooks/animation/useAnimatePieArc.js +70 -0
- package/modern/hooks/animation/useAnimatePieArcLabel.d.ts +15 -0
- package/modern/hooks/animation/useAnimatePieArcLabel.js +72 -0
- package/modern/hooks/index.d.ts +2 -1
- package/modern/hooks/index.js +2 -1
- package/modern/hooks/useAxis.d.ts +5 -5
- package/modern/hooks/useInteractionItemProps.js +11 -0
- package/modern/hooks/useScale.d.ts +2 -2
- package/modern/hooks/useScale.js +2 -2
- package/modern/index.js +1 -1
- package/modern/internals/animation/Transition.d.ts +37 -0
- package/modern/internals/animation/Transition.js +83 -0
- package/modern/internals/animation/animation.d.ts +4 -0
- package/modern/internals/animation/animation.js +4 -0
- package/modern/internals/animation/useAnimate.d.ts +19 -0
- package/modern/internals/animation/useAnimate.js +74 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.d.ts +1 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/computeAxisValue.js +9 -3
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.d.ts +5 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisTriggerTooltip.js +21 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +8 -6
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +28 -22
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.d.ts +1 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/index.js +1 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.js +9 -42
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -0
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +75 -0
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.js +7 -20
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.d.ts +36 -242
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.selectors.js +4 -10
- package/modern/internals/plugins/featurePlugins/useChartInteraction/useChartInteraction.types.d.ts +9 -15
- package/modern/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.d.ts +12 -0
- package/modern/internals/plugins/featurePlugins/useChartPolarAxis/coordinateTransformation.js +8 -0
- package/modern/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.d.ts +6 -4
- package/modern/internals/plugins/featurePlugins/useChartPolarAxis/getAxisValue.js +18 -13
- package/modern/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarAxis.js +16 -32
- package/modern/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.d.ts +3669 -0
- package/modern/internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors.js +22 -0
- package/modern/internals/plugins/models/seriesConfig/seriesConfig.types.d.ts +3 -1
- package/modern/internals/plugins/models/seriesConfig/tooltipGetter.types.d.ts +10 -4
- package/modern/internals/shallowEqual.d.ts +8 -0
- package/modern/internals/shallowEqual.js +31 -0
- package/modern/models/axis.d.ts +8 -0
- package/modern/themeAugmentation/overrides.d.ts +1 -1
- package/package.json +8 -9
- package/themeAugmentation/overrides.d.ts +1 -1
- package/tsconfig.build.tsbuildinfo +1 -1
- package/PieChart/dataTransform/transition.d.ts +0 -4
- package/PieChart/dataTransform/transition.js +0 -145
- package/esm/PieChart/dataTransform/transition.d.ts +0 -4
- package/esm/PieChart/dataTransform/transition.js +0 -137
- package/modern/PieChart/dataTransform/transition.d.ts +0 -4
- package/modern/PieChart/dataTransform/transition.js +0 -137
|
@@ -1,12 +1,25 @@
|
|
|
1
1
|
import { SeriesId } from "../models/seriesType/common.js";
|
|
2
|
+
import { AxisId } from "../models/axis.js";
|
|
2
3
|
import { CartesianChartSeriesType, ChartsSeriesConfig } from "../models/seriesType/config.js";
|
|
3
4
|
import { ChartsLabelMarkProps } from "../ChartsLabel/index.js";
|
|
4
5
|
export interface UseAxisTooltipReturnValue<SeriesT extends CartesianChartSeriesType = CartesianChartSeriesType, AxisValueT extends string | number | Date = string | number | Date> {
|
|
5
6
|
axisDirection: 'x' | 'y';
|
|
6
|
-
|
|
7
|
-
seriesItems: SeriesItem<SeriesT>[];
|
|
7
|
+
axisId: AxisId;
|
|
8
8
|
axisValue: AxisValueT;
|
|
9
9
|
axisFormattedValue: string;
|
|
10
|
+
dataIndex: number;
|
|
11
|
+
seriesItems: SeriesItem<SeriesT>[];
|
|
12
|
+
}
|
|
13
|
+
export interface UseAxisTooltipParams {
|
|
14
|
+
/**
|
|
15
|
+
* If `true`, the hook returns an array with an object per active axis.
|
|
16
|
+
*/
|
|
17
|
+
multipleAxes?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* The axis directions to consider.
|
|
20
|
+
* If not defined, all directions are considered
|
|
21
|
+
*/
|
|
22
|
+
directions?: ('x' | 'y')[];
|
|
10
23
|
}
|
|
11
24
|
interface SeriesItem<T extends CartesianChartSeriesType> {
|
|
12
25
|
seriesId: SeriesId;
|
|
@@ -16,5 +29,13 @@ interface SeriesItem<T extends CartesianChartSeriesType> {
|
|
|
16
29
|
formattedLabel: string | null;
|
|
17
30
|
markType: ChartsLabelMarkProps['type'];
|
|
18
31
|
}
|
|
19
|
-
|
|
32
|
+
/**
|
|
33
|
+
* @deprecated Use `useAxesTooltip` instead.
|
|
34
|
+
*/
|
|
35
|
+
export declare function useAxisTooltip(params: UseAxisTooltipParams & {
|
|
36
|
+
multipleAxes: true;
|
|
37
|
+
}): UseAxisTooltipReturnValue[] | null;
|
|
38
|
+
export declare function useAxisTooltip(params?: UseAxisTooltipParams & {
|
|
39
|
+
multipleAxes?: false;
|
|
40
|
+
}): UseAxisTooltipReturnValue | null;
|
|
20
41
|
export {};
|
|
@@ -9,13 +9,38 @@ import { isCartesianSeriesType } from "../internals/isCartesian.js";
|
|
|
9
9
|
import { utcFormatter } from "./utils.js";
|
|
10
10
|
import { useXAxes, useXAxis, useYAxes, useYAxis } from "../hooks/useAxis.js";
|
|
11
11
|
import { useZAxes } from "../hooks/useZAxis.js";
|
|
12
|
-
import {
|
|
13
|
-
|
|
12
|
+
import { selectorChartsInteractionTooltipXAxes, selectorChartsInteractionTooltipYAxes } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
13
|
+
function defaultAxisTooltipConfig(axis, dataIndex, axisDirection) {
|
|
14
|
+
const axisValue = axis.data?.[dataIndex] ?? null;
|
|
15
|
+
const axisFormatter = axis.valueFormatter ?? (v => axis.scaleType === 'utc' ? utcFormatter(v) : v.toLocaleString());
|
|
16
|
+
const axisFormattedValue = axisFormatter(axisValue, {
|
|
17
|
+
location: 'tooltip',
|
|
18
|
+
scale: axis.scale
|
|
19
|
+
});
|
|
20
|
+
return {
|
|
21
|
+
axisDirection,
|
|
22
|
+
axisId: axis.id,
|
|
23
|
+
dataIndex,
|
|
24
|
+
axisValue,
|
|
25
|
+
axisFormattedValue,
|
|
26
|
+
seriesItems: []
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @deprecated Use `useAxesTooltip` instead.
|
|
32
|
+
*/
|
|
33
|
+
|
|
34
|
+
export function useAxisTooltip(params = {}) {
|
|
35
|
+
const {
|
|
36
|
+
multipleAxes,
|
|
37
|
+
directions
|
|
38
|
+
} = params;
|
|
14
39
|
const defaultXAxis = useXAxis();
|
|
15
40
|
const defaultYAxis = useYAxis();
|
|
16
|
-
const xAxisHasData = defaultXAxis.data !== undefined && defaultXAxis.data.length !== 0;
|
|
17
41
|
const store = useStore();
|
|
18
|
-
const
|
|
42
|
+
const tooltipXAxes = useSelector(store, selectorChartsInteractionTooltipXAxes);
|
|
43
|
+
const tooltipYAxes = useSelector(store, selectorChartsInteractionTooltipYAxes);
|
|
19
44
|
const series = useSeries();
|
|
20
45
|
const {
|
|
21
46
|
xAxis
|
|
@@ -28,61 +53,70 @@ export function useAxisTooltip() {
|
|
|
28
53
|
zAxisIds
|
|
29
54
|
} = useZAxes();
|
|
30
55
|
const colorProcessors = useColorProcessor();
|
|
31
|
-
if (
|
|
56
|
+
if (tooltipXAxes.length === 0 && tooltipYAxes.length === 0) {
|
|
32
57
|
return null;
|
|
33
58
|
}
|
|
34
|
-
const
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
59
|
+
const tooltipAxes = [];
|
|
60
|
+
if (directions === undefined || directions.includes('x')) {
|
|
61
|
+
tooltipXAxes.forEach(({
|
|
62
|
+
axisId,
|
|
63
|
+
dataIndex
|
|
64
|
+
}) => {
|
|
65
|
+
if (!multipleAxes && tooltipAxes.length > 1) {
|
|
66
|
+
return;
|
|
67
|
+
}
|
|
68
|
+
tooltipAxes.push(defaultAxisTooltipConfig(xAxis[axisId], dataIndex, 'x'));
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (directions === undefined || directions.includes('y')) {
|
|
72
|
+
tooltipYAxes.forEach(({
|
|
73
|
+
axisId,
|
|
74
|
+
dataIndex
|
|
75
|
+
}) => {
|
|
76
|
+
if (!multipleAxes && tooltipAxes.length > 1) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
tooltipAxes.push(defaultAxisTooltipConfig(yAxis[axisId], dataIndex, 'y'));
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
Object.keys(series).filter(isCartesianSeriesType).flatMap(seriesType => {
|
|
41
83
|
const seriesOfType = series[seriesType];
|
|
42
84
|
if (!seriesOfType) {
|
|
43
85
|
return [];
|
|
44
86
|
}
|
|
45
|
-
return seriesOfType.seriesOrder.
|
|
87
|
+
return seriesOfType.seriesOrder.forEach(seriesId => {
|
|
46
88
|
const seriesToAdd = seriesOfType.series[seriesId];
|
|
47
|
-
const providedXAxisId = seriesToAdd.xAxisId;
|
|
48
|
-
const providedYAxisId = seriesToAdd.yAxisId;
|
|
49
|
-
const
|
|
50
|
-
|
|
89
|
+
const providedXAxisId = seriesToAdd.xAxisId ?? defaultXAxis.id;
|
|
90
|
+
const providedYAxisId = seriesToAdd.yAxisId ?? defaultYAxis.id;
|
|
91
|
+
const tooltipItemIndex = tooltipAxes.findIndex(({
|
|
92
|
+
axisDirection,
|
|
93
|
+
axisId
|
|
94
|
+
}) => axisDirection === 'x' && axisId === providedXAxisId || axisDirection === 'y' && axisId === providedYAxisId);
|
|
51
95
|
// Test if the series uses the default axis
|
|
52
|
-
if (
|
|
53
|
-
const xAxisId = providedXAxisId ?? defaultXAxis.id;
|
|
54
|
-
const yAxisId = providedYAxisId ?? defaultYAxis.id;
|
|
96
|
+
if (tooltipItemIndex >= 0) {
|
|
55
97
|
const zAxisId = 'zAxisId' in seriesToAdd ? seriesToAdd.zAxisId : zAxisIds[0];
|
|
56
|
-
const
|
|
98
|
+
const {
|
|
99
|
+
dataIndex
|
|
100
|
+
} = tooltipAxes[tooltipItemIndex];
|
|
101
|
+
const color = colorProcessors[seriesType]?.(seriesToAdd, xAxis[providedXAxisId], yAxis[providedYAxisId], zAxisId ? zAxis[zAxisId] : undefined)(dataIndex) ?? '';
|
|
57
102
|
const value = seriesToAdd.data[dataIndex] ?? null;
|
|
58
103
|
const formattedValue = seriesToAdd.valueFormatter(value, {
|
|
59
104
|
dataIndex
|
|
60
105
|
});
|
|
61
106
|
const formattedLabel = getLabel(seriesToAdd.label, 'tooltip') ?? null;
|
|
62
|
-
|
|
107
|
+
tooltipAxes[tooltipItemIndex].seriesItems.push({
|
|
63
108
|
seriesId,
|
|
64
109
|
color,
|
|
65
110
|
value,
|
|
66
111
|
formattedValue,
|
|
67
112
|
formattedLabel,
|
|
68
113
|
markType: seriesToAdd.labelMarkType
|
|
69
|
-
};
|
|
114
|
+
});
|
|
70
115
|
}
|
|
71
|
-
return undefined;
|
|
72
116
|
});
|
|
73
|
-
}).filter(function truthy(item) {
|
|
74
|
-
return Boolean(item);
|
|
75
|
-
});
|
|
76
|
-
const axisFormatter = usedAxis.valueFormatter ?? (v => usedAxis.scaleType === 'utc' ? utcFormatter(v) : v.toLocaleString());
|
|
77
|
-
const axisFormattedValue = axisFormatter(axisValue, {
|
|
78
|
-
location: 'tooltip',
|
|
79
|
-
scale: usedAxis.scale
|
|
80
117
|
});
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
axisValue,
|
|
86
|
-
axisFormattedValue
|
|
87
|
-
};
|
|
118
|
+
if (!multipleAxes) {
|
|
119
|
+
return tooltipAxes.length === 0 ? tooltipAxes[0] : null;
|
|
120
|
+
}
|
|
121
|
+
return tooltipAxes;
|
|
88
122
|
}
|
|
@@ -30,7 +30,10 @@ export function useItemTooltip() {
|
|
|
30
30
|
if (!identifier || identifier.dataIndex === undefined) {
|
|
31
31
|
return null;
|
|
32
32
|
}
|
|
33
|
-
const itemSeries = series[identifier.type]
|
|
33
|
+
const itemSeries = series[identifier.type]?.series[identifier.seriesId];
|
|
34
|
+
if (!itemSeries) {
|
|
35
|
+
return null;
|
|
36
|
+
}
|
|
34
37
|
const getColor = seriesConfig[itemSeries.type].colorProcessor?.(itemSeries, xAxisId && xAxis[xAxisId], yAxisId && yAxis[yAxisId], zAxisId && zAxis[zAxisId]) ?? (() => '');
|
|
35
38
|
return seriesConfig[itemSeries.type].tooltipGetter({
|
|
36
39
|
series: itemSeries,
|
|
@@ -111,7 +111,7 @@ function getVisibleLabels(xTicks, {
|
|
|
111
111
|
return true;
|
|
112
112
|
}));
|
|
113
113
|
}
|
|
114
|
-
function shortenLabels(visibleLabels, drawingArea, maxHeight, tickLabelStyle) {
|
|
114
|
+
function shortenLabels(visibleLabels, drawingArea, maxHeight, isRtl, tickLabelStyle) {
|
|
115
115
|
const shortenedLabels = new Map();
|
|
116
116
|
const angle = clampAngle(tickLabelStyle?.angle ?? 0);
|
|
117
117
|
|
|
@@ -132,6 +132,9 @@ function shortenLabels(visibleLabels, drawingArea, maxHeight, tickLabelStyle) {
|
|
|
132
132
|
if (angle > 90 && angle < 270) {
|
|
133
133
|
[leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
|
|
134
134
|
}
|
|
135
|
+
if (isRtl) {
|
|
136
|
+
[leftBoundFactor, rightBoundFactor] = [rightBoundFactor, leftBoundFactor];
|
|
137
|
+
}
|
|
135
138
|
for (const item of visibleLabels) {
|
|
136
139
|
if (item.formattedValue) {
|
|
137
140
|
// That maximum width of the tick depends on its proximity to the axis bounds.
|
|
@@ -293,7 +296,7 @@ function ChartsXAxis(inProps) {
|
|
|
293
296
|
|
|
294
297
|
/* If there's an axis title, the tick labels have less space to render */
|
|
295
298
|
const tickLabelsMaxHeight = Math.max(0, axisHeight - (label ? labelHeight + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
|
|
296
|
-
const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
|
|
299
|
+
const tickLabels = isHydrated ? shortenLabels(visibleLabels, drawingArea, tickLabelsMaxHeight, isRtl, axisTickLabelProps.style) : new Map(Array.from(visibleLabels).map(item => [item, item.formattedValue]));
|
|
297
300
|
return /*#__PURE__*/_jsxs(XAxisRoot, {
|
|
298
301
|
transform: `translate(0, ${position === 'bottom' ? top + height + offset : top - offset})`,
|
|
299
302
|
className: classes.root,
|
|
@@ -9,6 +9,9 @@ import useSlotProps from '@mui/utils/useSlotProps';
|
|
|
9
9
|
import composeClasses from '@mui/utils/composeClasses';
|
|
10
10
|
import { useThemeProps, styled, useTheme } from '@mui/material/styles';
|
|
11
11
|
import { useRtl } from '@mui/system/RtlProvider';
|
|
12
|
+
import { useIsHydrated } from "../hooks/useIsHydrated.js";
|
|
13
|
+
import { getDefaultBaseline, getDefaultTextAnchor } from "../ChartsText/defaultTextPlacement.js";
|
|
14
|
+
import { doesTextFitInRect, ellipsize } from "../internals/ellipsize.js";
|
|
12
15
|
import { getStringSize } from "../internals/domUtils.js";
|
|
13
16
|
import { useTicks } from "../hooks/useTicks.js";
|
|
14
17
|
import { useDrawingArea } from "../hooks/useDrawingArea.js";
|
|
@@ -19,6 +22,8 @@ import { isInfinity } from "../internals/isInfinity.js";
|
|
|
19
22
|
import { isBandScale } from "../internals/isBandScale.js";
|
|
20
23
|
import { useChartContext } from "../context/ChartProvider/index.js";
|
|
21
24
|
import { useYAxes } from "../hooks/index.js";
|
|
25
|
+
import { clampAngle } from "../internals/clampAngle.js";
|
|
26
|
+
import { invertTextAnchor } from "../internals/invertTextAnchor.js";
|
|
22
27
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
28
|
const useUtilityClasses = ownerState => {
|
|
24
29
|
const {
|
|
@@ -35,6 +40,47 @@ const useUtilityClasses = ownerState => {
|
|
|
35
40
|
};
|
|
36
41
|
return composeClasses(slots, getAxisUtilityClass, classes);
|
|
37
42
|
};
|
|
43
|
+
|
|
44
|
+
/* Gap between a tick and its label. */
|
|
45
|
+
const TICK_LABEL_GAP = 2;
|
|
46
|
+
/* Gap between the axis label and tick labels. */
|
|
47
|
+
const AXIS_LABEL_TICK_LABEL_GAP = 2;
|
|
48
|
+
function shortenLabels(visibleLabels, drawingArea, maxWidth, isRtl, tickLabelStyle) {
|
|
49
|
+
const shortenedLabels = new Map();
|
|
50
|
+
const angle = clampAngle(tickLabelStyle?.angle ?? 0);
|
|
51
|
+
let topBoundFactor = 1;
|
|
52
|
+
let bottomBoundFactor = 1;
|
|
53
|
+
if (tickLabelStyle?.textAnchor === 'start') {
|
|
54
|
+
topBoundFactor = Infinity;
|
|
55
|
+
bottomBoundFactor = 1;
|
|
56
|
+
} else if (tickLabelStyle?.textAnchor === 'end') {
|
|
57
|
+
topBoundFactor = 1;
|
|
58
|
+
bottomBoundFactor = Infinity;
|
|
59
|
+
} else {
|
|
60
|
+
topBoundFactor = 2;
|
|
61
|
+
bottomBoundFactor = 2;
|
|
62
|
+
}
|
|
63
|
+
if (angle > 180) {
|
|
64
|
+
[topBoundFactor, bottomBoundFactor] = [bottomBoundFactor, topBoundFactor];
|
|
65
|
+
}
|
|
66
|
+
if (isRtl) {
|
|
67
|
+
[topBoundFactor, bottomBoundFactor] = [bottomBoundFactor, topBoundFactor];
|
|
68
|
+
}
|
|
69
|
+
for (const item of visibleLabels) {
|
|
70
|
+
if (item.formattedValue) {
|
|
71
|
+
// That maximum height of the tick depends on its proximity to the axis bounds.
|
|
72
|
+
const height = Math.min((item.offset + item.labelOffset) * topBoundFactor, (drawingArea.top + drawingArea.height + drawingArea.bottom - item.offset - item.labelOffset) * bottomBoundFactor);
|
|
73
|
+
const doesTextFit = text => doesTextFitInRect(text, {
|
|
74
|
+
width: maxWidth,
|
|
75
|
+
height,
|
|
76
|
+
angle,
|
|
77
|
+
measureText: string => getStringSize(string, tickLabelStyle)
|
|
78
|
+
});
|
|
79
|
+
shortenedLabels.set(item, ellipsize(item.formattedValue.toString(), doesTextFit));
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return shortenedLabels;
|
|
83
|
+
}
|
|
38
84
|
const YAxisRoot = styled(AxisRoot, {
|
|
39
85
|
name: 'MuiChartsYAxis',
|
|
40
86
|
slot: 'Root',
|
|
@@ -92,16 +138,18 @@ function ChartsYAxis(inProps) {
|
|
|
92
138
|
} = defaultizedProps;
|
|
93
139
|
const theme = useTheme();
|
|
94
140
|
const isRtl = useRtl();
|
|
141
|
+
const isHydrated = useIsHydrated();
|
|
95
142
|
const classes = useUtilityClasses(defaultizedProps);
|
|
96
143
|
const {
|
|
97
144
|
instance
|
|
98
145
|
} = useChartContext();
|
|
146
|
+
const drawingArea = useDrawingArea();
|
|
99
147
|
const {
|
|
100
148
|
left,
|
|
101
149
|
top,
|
|
102
150
|
width,
|
|
103
151
|
height
|
|
104
|
-
} =
|
|
152
|
+
} = drawingArea;
|
|
105
153
|
const tickSize = disableTicks ? 4 : tickSizeProp;
|
|
106
154
|
const yTicks = useTicks({
|
|
107
155
|
scale: yScale,
|
|
@@ -117,15 +165,16 @@ function ChartsYAxis(inProps) {
|
|
|
117
165
|
const Tick = slots?.axisTick ?? 'line';
|
|
118
166
|
const TickLabel = slots?.axisTickLabel ?? ChartsText;
|
|
119
167
|
const Label = slots?.axisLabel ?? ChartsText;
|
|
120
|
-
const
|
|
168
|
+
const defaultTextAnchor = getDefaultTextAnchor((position === 'right' ? -90 : 90) - (tickLabelStyle?.angle ?? 0));
|
|
169
|
+
const defaultDominantBaseline = getDefaultBaseline((position === 'right' ? -90 : 90) - (tickLabelStyle?.angle ?? 0));
|
|
121
170
|
const axisTickLabelProps = useSlotProps({
|
|
122
171
|
elementType: TickLabel,
|
|
123
172
|
externalSlotProps: slotProps?.axisTickLabel,
|
|
124
173
|
additionalProps: {
|
|
125
174
|
style: _extends({}, theme.typography.caption, {
|
|
126
175
|
fontSize: tickFontSize,
|
|
127
|
-
textAnchor:
|
|
128
|
-
dominantBaseline:
|
|
176
|
+
textAnchor: isRtl ? invertTextAnchor(defaultTextAnchor) : defaultTextAnchor,
|
|
177
|
+
dominantBaseline: defaultDominantBaseline
|
|
129
178
|
}, tickLabelStyle)
|
|
130
179
|
},
|
|
131
180
|
className: classes.tickLabel,
|
|
@@ -140,7 +189,7 @@ function ChartsYAxis(inProps) {
|
|
|
140
189
|
fontSize: 14,
|
|
141
190
|
angle: positionSign * 90,
|
|
142
191
|
textAnchor: 'middle',
|
|
143
|
-
dominantBaseline: '
|
|
192
|
+
dominantBaseline: 'text-before-edge'
|
|
144
193
|
}, labelStyle)
|
|
145
194
|
},
|
|
146
195
|
ownerState: {}
|
|
@@ -163,11 +212,13 @@ function ChartsYAxis(inProps) {
|
|
|
163
212
|
if (ordinalAxis && domain.length === 0 || !ordinalAxis && domain.some(isInfinity) || position === 'none') {
|
|
164
213
|
return null;
|
|
165
214
|
}
|
|
166
|
-
const labelHeight = label ? getStringSize(label, axisLabelProps.style).height : 0;
|
|
167
215
|
const labelRefPoint = {
|
|
168
|
-
x: positionSign *
|
|
216
|
+
x: positionSign * axisWidth,
|
|
169
217
|
y: top + height / 2
|
|
170
218
|
};
|
|
219
|
+
/* If there's an axis title, the tick labels have less space to render */
|
|
220
|
+
const tickLabelsMaxWidth = Math.max(0, axisWidth - (label ? getStringSize(label, axisLabelProps.style).height + AXIS_LABEL_TICK_LABEL_GAP : 0) - tickSize - TICK_LABEL_GAP);
|
|
221
|
+
const tickLabels = isHydrated ? shortenLabels(yTicks, drawingArea, tickLabelsMaxWidth, isRtl, axisTickLabelProps.style) : new Map(Array.from(yTicks).map(item => [item, item.formattedValue]));
|
|
171
222
|
return /*#__PURE__*/_jsxs(YAxisRoot, {
|
|
172
223
|
transform: `translate(${position === 'right' ? left + width + offset : left - offset}, 0)`,
|
|
173
224
|
className: classes.root,
|
|
@@ -176,13 +227,13 @@ function ChartsYAxis(inProps) {
|
|
|
176
227
|
y1: top,
|
|
177
228
|
y2: top + height,
|
|
178
229
|
className: classes.line
|
|
179
|
-
}, lineSlotProps)), yTicks.map(({
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
const xTickLabel = positionSign * (tickSize +
|
|
230
|
+
}, lineSlotProps)), yTicks.map((item, index) => {
|
|
231
|
+
const {
|
|
232
|
+
offset: tickOffset,
|
|
233
|
+
labelOffset,
|
|
234
|
+
value
|
|
235
|
+
} = item;
|
|
236
|
+
const xTickLabel = positionSign * (tickSize + TICK_LABEL_GAP);
|
|
186
237
|
const yTickLabel = labelOffset;
|
|
187
238
|
const skipLabel = typeof tickLabelInterval === 'function' && !tickLabelInterval?.(value, index);
|
|
188
239
|
const showLabel = instance.isPointInside({
|
|
@@ -191,6 +242,7 @@ function ChartsYAxis(inProps) {
|
|
|
191
242
|
}, {
|
|
192
243
|
direction: 'y'
|
|
193
244
|
});
|
|
245
|
+
const tickLabel = tickLabels.get(item);
|
|
194
246
|
if (!showLabel) {
|
|
195
247
|
return null;
|
|
196
248
|
}
|
|
@@ -200,13 +252,13 @@ function ChartsYAxis(inProps) {
|
|
|
200
252
|
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
201
253
|
x2: positionSign * tickSize,
|
|
202
254
|
className: classes.tick
|
|
203
|
-
}, slotProps?.axisTick)),
|
|
255
|
+
}, slotProps?.axisTick)), tickLabel !== undefined && !skipLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
204
256
|
x: xTickLabel,
|
|
205
257
|
y: yTickLabel,
|
|
206
|
-
text:
|
|
258
|
+
text: tickLabel
|
|
207
259
|
}, axisTickLabelProps))]
|
|
208
260
|
}, index);
|
|
209
|
-
}), label && /*#__PURE__*/_jsx("g", {
|
|
261
|
+
}), label && isHydrated && /*#__PURE__*/_jsx("g", {
|
|
210
262
|
className: classes.label,
|
|
211
263
|
children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
|
|
212
264
|
text: label
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["skipAnimation", "ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import {
|
|
9
|
-
import { useStringInterpolator } from "../internals/useStringInterpolator.js";
|
|
8
|
+
import { useAnimateArea } from "../hooks/animation/useAnimateArea.js";
|
|
10
9
|
import { AppearingMask } from "./AppearingMask.js";
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
/**
|
|
@@ -21,38 +20,22 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
21
20
|
*/
|
|
22
21
|
function AnimatedArea(props) {
|
|
23
22
|
const {
|
|
24
|
-
d,
|
|
25
23
|
skipAnimation,
|
|
26
24
|
ownerState
|
|
27
25
|
} = props,
|
|
28
26
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
29
|
-
const
|
|
30
|
-
const transitionChange = useTransition([stringInterpolator], {
|
|
31
|
-
from: skipAnimation ? undefined : {
|
|
32
|
-
value: 0
|
|
33
|
-
},
|
|
34
|
-
to: {
|
|
35
|
-
value: 1
|
|
36
|
-
},
|
|
37
|
-
enter: {
|
|
38
|
-
value: 1
|
|
39
|
-
},
|
|
40
|
-
reset: false,
|
|
41
|
-
immediate: skipAnimation
|
|
42
|
-
});
|
|
27
|
+
const animatedProps = useAnimateArea(props);
|
|
43
28
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
44
29
|
skipAnimation: skipAnimation,
|
|
45
30
|
id: `${ownerState.id}-area-clip`,
|
|
46
|
-
children:
|
|
47
|
-
// @ts-expect-error
|
|
48
|
-
d: style.value.to(interpolator),
|
|
31
|
+
children: /*#__PURE__*/_jsx("path", _extends({
|
|
49
32
|
fill: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
50
33
|
filter:
|
|
51
34
|
// eslint-disable-next-line no-nested-ternary
|
|
52
35
|
ownerState.isHighlighted ? 'brightness(140%)' : ownerState.gradientId ? undefined : 'brightness(120%)',
|
|
53
36
|
opacity: ownerState.isFaded ? 0.3 : 1,
|
|
54
37
|
stroke: "none"
|
|
55
|
-
}, other))
|
|
38
|
+
}, other, animatedProps))
|
|
56
39
|
});
|
|
57
40
|
}
|
|
58
41
|
process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
|
|
@@ -19,8 +19,5 @@ export interface AnimatedLineProps extends React.ComponentPropsWithoutRef<'path'
|
|
|
19
19
|
*
|
|
20
20
|
* - [AnimatedLine API](https://mui.com/x/api/charts/animated-line/)
|
|
21
21
|
*/
|
|
22
|
-
declare
|
|
23
|
-
declare namespace AnimatedLine {
|
|
24
|
-
var propTypes: any;
|
|
25
|
-
}
|
|
22
|
+
declare const AnimatedLine: React.ForwardRefExoticComponent<AnimatedLineProps & React.RefAttributes<SVGPathElement>>;
|
|
26
23
|
export { AnimatedLine };
|
|
@@ -2,11 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["skipAnimation", "ownerState"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
-
import {
|
|
9
|
-
import { useStringInterpolator } from "../internals/useStringInterpolator.js";
|
|
8
|
+
import { useAnimateLine } from "../hooks/index.js";
|
|
10
9
|
import { AppearingMask } from "./AppearingMask.js";
|
|
11
10
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
11
|
/**
|
|
@@ -19,42 +18,28 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
19
18
|
*
|
|
20
19
|
* - [AnimatedLine API](https://mui.com/x/api/charts/animated-line/)
|
|
21
20
|
*/
|
|
22
|
-
function AnimatedLine(props) {
|
|
21
|
+
const AnimatedLine = /*#__PURE__*/React.forwardRef(function AnimatedLine(props, ref) {
|
|
23
22
|
const {
|
|
24
|
-
d,
|
|
25
23
|
skipAnimation,
|
|
26
24
|
ownerState
|
|
27
25
|
} = props,
|
|
28
26
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
value: 0
|
|
33
|
-
},
|
|
34
|
-
to: {
|
|
35
|
-
value: 1
|
|
36
|
-
},
|
|
37
|
-
enter: {
|
|
38
|
-
value: 1
|
|
39
|
-
},
|
|
40
|
-
reset: false,
|
|
41
|
-
immediate: skipAnimation
|
|
42
|
-
});
|
|
27
|
+
const animateProps = useAnimateLine(_extends({}, props, {
|
|
28
|
+
ref
|
|
29
|
+
}));
|
|
43
30
|
return /*#__PURE__*/_jsx(AppearingMask, {
|
|
44
31
|
skipAnimation: skipAnimation,
|
|
45
32
|
id: `${ownerState.id}-line-clip`,
|
|
46
|
-
children:
|
|
47
|
-
// @ts-expect-error
|
|
48
|
-
d: style.value.to(interpolator),
|
|
33
|
+
children: /*#__PURE__*/_jsx("path", _extends({
|
|
49
34
|
stroke: ownerState.gradientId ? `url(#${ownerState.gradientId})` : ownerState.color,
|
|
50
35
|
strokeWidth: 2,
|
|
51
36
|
strokeLinejoin: "round",
|
|
52
37
|
fill: "none",
|
|
53
38
|
filter: ownerState.isHighlighted ? 'brightness(120%)' : undefined,
|
|
54
39
|
opacity: ownerState.isFaded ? 0.3 : 1
|
|
55
|
-
}, other))
|
|
40
|
+
}, other, animateProps))
|
|
56
41
|
});
|
|
57
|
-
}
|
|
42
|
+
});
|
|
58
43
|
process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
|
59
44
|
// ----------------------------- Warning --------------------------------
|
|
60
45
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -5,6 +5,11 @@ interface AppearingMaskProps {
|
|
|
5
5
|
skipAnimation?: boolean;
|
|
6
6
|
children: React.ReactNode;
|
|
7
7
|
}
|
|
8
|
+
export interface AppearingMaskClasses {
|
|
9
|
+
/** Styles applied if the element should be animated. */
|
|
10
|
+
animate: string;
|
|
11
|
+
}
|
|
12
|
+
export declare const appearingMaskClasses: AppearingMaskClasses;
|
|
8
13
|
/**
|
|
9
14
|
* @ignore - internal component.
|
|
10
15
|
*/
|
|
@@ -1,40 +1,45 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import * as React from 'react';
|
|
4
|
-
import {
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
6
|
+
import clsx from 'clsx';
|
|
7
|
+
import { ANIMATION_DURATION_MS, ANIMATION_TIMING_FUNCTION } from "../internals/animation/animation.js";
|
|
5
8
|
import { cleanId } from "../internals/cleanId.js";
|
|
6
9
|
import { useChartId, useDrawingArea } from "../hooks/index.js";
|
|
7
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export const appearingMaskClasses = generateUtilityClasses('MuiAppearingMask', ['animate']);
|
|
12
|
+
const AnimatedRect = styled('rect')({
|
|
13
|
+
animationName: 'animate-width',
|
|
14
|
+
animationTimingFunction: ANIMATION_TIMING_FUNCTION,
|
|
15
|
+
animationDuration: '0s',
|
|
16
|
+
[`&.${appearingMaskClasses.animate}`]: {
|
|
17
|
+
animationDuration: `${ANIMATION_DURATION_MS}ms`
|
|
18
|
+
},
|
|
19
|
+
'@keyframes animate-width': {
|
|
20
|
+
from: {
|
|
21
|
+
width: 0
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
|
|
8
26
|
/**
|
|
9
27
|
* @ignore - internal component.
|
|
10
28
|
*/
|
|
11
29
|
export function AppearingMask(props) {
|
|
12
30
|
const drawingArea = useDrawingArea();
|
|
13
31
|
const chartId = useChartId();
|
|
14
|
-
const transitionAppear = useTransition([drawingArea], {
|
|
15
|
-
from: props.skipAnimation ? undefined : v => ({
|
|
16
|
-
animatedWidth: v.left
|
|
17
|
-
}),
|
|
18
|
-
enter: v => ({
|
|
19
|
-
animatedWidth: v.width + v.left + v.right
|
|
20
|
-
}),
|
|
21
|
-
leave: v => ({
|
|
22
|
-
animatedWidth: v.width + v.left + v.right
|
|
23
|
-
}),
|
|
24
|
-
reset: false,
|
|
25
|
-
immediate: props.skipAnimation
|
|
26
|
-
});
|
|
27
32
|
const clipId = cleanId(`${chartId}-${props.id}`);
|
|
28
33
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
29
34
|
children: [/*#__PURE__*/_jsx("clipPath", {
|
|
30
35
|
id: clipId,
|
|
31
|
-
children:
|
|
32
|
-
|
|
36
|
+
children: /*#__PURE__*/_jsx(AnimatedRect, {
|
|
37
|
+
className: clsx(!props.skipAnimation && appearingMaskClasses.animate),
|
|
33
38
|
x: 0,
|
|
34
39
|
y: 0,
|
|
35
|
-
width:
|
|
40
|
+
width: drawingArea.left + drawingArea.width + drawingArea.right,
|
|
36
41
|
height: drawingArea.top + drawingArea.height + drawingArea.bottom
|
|
37
|
-
})
|
|
42
|
+
})
|
|
38
43
|
}), /*#__PURE__*/_jsx("g", {
|
|
39
44
|
clipPath: `url(#${clipId})`,
|
|
40
45
|
children: props.children
|