@mui/x-charts 8.0.0-beta.2 → 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/CHANGELOG.md +141 -0
- package/ChartContainer/ChartContainer.js +4 -0
- 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/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/ChartsTooltip/ChartsTooltip.js +2 -2
- package/ChartsTooltip/ChartsTooltipContainer.js +3 -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 +71 -37
- 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 +16 -22
- package/LineChart/LineChart.js +2 -0
- package/LineChart/LineHighlightPlot.js +2 -3
- 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/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/ScatterChart/ScatterChart.js +2 -0
- 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/ChartContainer/ChartContainer.js +4 -0
- 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/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/esm/ChartsTooltip/ChartsTooltip.js +2 -2
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +4 -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/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/ScatterChart/ScatterChart.js +2 -0
- 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/useInteractionItemProps.js +11 -0
- 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/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +60 -26
- 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/useInteractionItemProps.js +11 -0
- 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/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +61 -27
- 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/ChartContainer/ChartContainer.js +4 -0
- 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/ChartsTooltip/ChartsAxisTooltipContent.js +47 -55
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +11 -9
- package/modern/ChartsTooltip/ChartsTooltip.js +2 -2
- package/modern/ChartsTooltip/ChartsTooltipContainer.js +4 -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/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/ScatterChart/ScatterChart.js +2 -0
- 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/useInteractionItemProps.js +11 -0
- 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/useChartCartesianAxisRendering.selectors.d.ts +8 -32
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.d.ts +9 -1
- package/modern/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +60 -26
- 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
|
@@ -6,7 +6,7 @@ import Typography from '@mui/material/Typography';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import { useUtilityClasses } from "./chartsTooltipClasses.js";
|
|
8
8
|
import { ChartsTooltipCell, ChartsTooltipPaper, ChartsTooltipRow, ChartsTooltipTable } from "./ChartsTooltipTable.js";
|
|
9
|
-
import {
|
|
9
|
+
import { useAxesTooltip } from "./useAxesTooltip.js";
|
|
10
10
|
import { useXAxis, useYAxis } from "../hooks/index.js";
|
|
11
11
|
import { ChartsLabelMark } from "../ChartsLabel/ChartsLabelMark.js";
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -15,70 +15,62 @@ function ChartsAxisTooltipContent(props) {
|
|
|
15
15
|
classes: propClasses,
|
|
16
16
|
sx
|
|
17
17
|
} = props;
|
|
18
|
-
const tooltipData =
|
|
18
|
+
const tooltipData = useAxesTooltip();
|
|
19
19
|
const xAxis = useXAxis();
|
|
20
20
|
const yAxis = useYAxis();
|
|
21
21
|
const classes = useUtilityClasses(propClasses);
|
|
22
22
|
if (tooltipData === null) {
|
|
23
23
|
return null;
|
|
24
24
|
}
|
|
25
|
-
const {
|
|
26
|
-
axisDirection,
|
|
27
|
-
axisValue,
|
|
28
|
-
axisFormattedValue,
|
|
29
|
-
seriesItems
|
|
30
|
-
} = tooltipData;
|
|
31
|
-
const axis = axisDirection === 'x' ? xAxis : yAxis;
|
|
32
25
|
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
33
26
|
sx: sx,
|
|
34
27
|
className: classes.paper,
|
|
35
|
-
children:
|
|
36
|
-
|
|
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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
})
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
children: /*#__PURE__*/_jsx(Typography, {
|
|
28
|
+
children: tooltipData.map(({
|
|
29
|
+
axisId,
|
|
30
|
+
axisDirection,
|
|
31
|
+
axisValue,
|
|
32
|
+
axisFormattedValue,
|
|
33
|
+
seriesItems
|
|
34
|
+
}) => {
|
|
35
|
+
const axis = axisDirection === 'x' ? xAxis : yAxis;
|
|
36
|
+
return /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
37
|
+
className: classes.table,
|
|
38
|
+
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx(Typography, {
|
|
39
|
+
component: "caption",
|
|
40
|
+
children: axisFormattedValue
|
|
41
|
+
}), /*#__PURE__*/_jsx("tbody", {
|
|
42
|
+
children: seriesItems.map(({
|
|
43
|
+
seriesId,
|
|
44
|
+
color,
|
|
45
|
+
formattedValue,
|
|
46
|
+
formattedLabel,
|
|
47
|
+
markType
|
|
48
|
+
}) => {
|
|
49
|
+
if (formattedValue == null) {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
53
|
+
className: classes.row,
|
|
54
|
+
children: [/*#__PURE__*/_jsxs(ChartsTooltipCell, {
|
|
55
|
+
className: clsx(classes.labelCell, classes.cell),
|
|
56
|
+
component: "th",
|
|
57
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
58
|
+
className: classes.markContainer,
|
|
59
|
+
children: /*#__PURE__*/_jsx(ChartsLabelMark, {
|
|
60
|
+
type: markType,
|
|
61
|
+
color: color,
|
|
62
|
+
className: classes.mark
|
|
63
|
+
})
|
|
64
|
+
}), formattedLabel || null]
|
|
65
|
+
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
66
|
+
className: clsx(classes.valueCell, classes.cell),
|
|
67
|
+
component: "td",
|
|
76
68
|
children: formattedValue
|
|
77
|
-
})
|
|
78
|
-
})
|
|
79
|
-
}
|
|
80
|
-
})
|
|
81
|
-
})
|
|
69
|
+
})]
|
|
70
|
+
}, seriesId);
|
|
71
|
+
})
|
|
72
|
+
})]
|
|
73
|
+
}, axisId);
|
|
82
74
|
})
|
|
83
75
|
});
|
|
84
76
|
}
|
|
@@ -32,18 +32,20 @@ function ChartsItemTooltipContent(props) {
|
|
|
32
32
|
children: /*#__PURE__*/_jsx("tbody", {
|
|
33
33
|
children: /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
34
34
|
className: classes.row,
|
|
35
|
-
children: [/*#__PURE__*/
|
|
36
|
-
className: clsx(classes.markCell, classes.cell),
|
|
37
|
-
children: /*#__PURE__*/_jsx(ChartsLabelMark, {
|
|
38
|
-
type: markType,
|
|
39
|
-
color: color,
|
|
40
|
-
className: classes.mark
|
|
41
|
-
})
|
|
42
|
-
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
35
|
+
children: [/*#__PURE__*/_jsxs(ChartsTooltipCell, {
|
|
43
36
|
className: clsx(classes.labelCell, classes.cell),
|
|
44
|
-
|
|
37
|
+
component: "th",
|
|
38
|
+
children: [/*#__PURE__*/_jsx("div", {
|
|
39
|
+
className: classes.markContainer,
|
|
40
|
+
children: /*#__PURE__*/_jsx(ChartsLabelMark, {
|
|
41
|
+
type: markType,
|
|
42
|
+
color: color,
|
|
43
|
+
className: classes.mark
|
|
44
|
+
})
|
|
45
|
+
}), label]
|
|
45
46
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
46
47
|
className: clsx(classes.valueCell, classes.cell),
|
|
48
|
+
component: "td",
|
|
47
49
|
children: formattedValue
|
|
48
50
|
})]
|
|
49
51
|
})
|
|
@@ -58,7 +58,7 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
58
58
|
* The components used for each slot inside the Popper.
|
|
59
59
|
* Either a string to use a HTML element or a component.
|
|
60
60
|
*
|
|
61
|
-
* @deprecated use the `slots` prop instead. This prop will be removed in
|
|
61
|
+
* @deprecated use the `slots` prop instead. This prop will be removed in a future major release. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
62
62
|
* @default {}
|
|
63
63
|
*/
|
|
64
64
|
components: PropTypes.shape({
|
|
@@ -67,7 +67,7 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
67
67
|
/**
|
|
68
68
|
* The props used for each slot inside the Popper.
|
|
69
69
|
*
|
|
70
|
-
* @deprecated use the `slotProps` prop instead. This prop will be removed in
|
|
70
|
+
* @deprecated use the `slotProps` prop instead. This prop will be removed in a future major release. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
71
71
|
* @default {}
|
|
72
72
|
*/
|
|
73
73
|
componentsProps: PropTypes.shape({
|
|
@@ -14,9 +14,8 @@ import { useSvgRef } from "../hooks/useSvgRef.js";
|
|
|
14
14
|
import { usePointerType } from "./utils.js";
|
|
15
15
|
import { useSelector } from "../internals/store/useSelector.js";
|
|
16
16
|
import { useStore } from "../internals/store/useStore.js";
|
|
17
|
-
import { useXAxis } from "../hooks/index.js";
|
|
18
17
|
import { selectorChartsInteractionItemIsDefined } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
19
|
-
import {
|
|
18
|
+
import { selectorChartsInteractionAxisTooltip } from "../internals/plugins/featurePlugins/useChartCartesianAxis/index.js";
|
|
20
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
20
|
const ChartsTooltipRoot = styled(Popper, {
|
|
22
21
|
name: 'MuiChartsTooltip',
|
|
@@ -28,7 +27,6 @@ const ChartsTooltipRoot = styled(Popper, {
|
|
|
28
27
|
pointerEvents: 'none',
|
|
29
28
|
zIndex: theme.zIndex.modal
|
|
30
29
|
}));
|
|
31
|
-
const axisHasData = axis => axis?.data !== undefined && axis.data.length !== 0;
|
|
32
30
|
|
|
33
31
|
/**
|
|
34
32
|
* Demos:
|
|
@@ -52,16 +50,13 @@ function ChartsTooltipContainer(inProps) {
|
|
|
52
50
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
53
51
|
const svgRef = useSvgRef();
|
|
54
52
|
const pointerType = usePointerType();
|
|
55
|
-
const xAxis = useXAxis();
|
|
56
53
|
const popperRef = React.useRef(null);
|
|
57
54
|
const positionRef = useLazyRef(() => ({
|
|
58
55
|
x: 0,
|
|
59
56
|
y: 0
|
|
60
57
|
}));
|
|
61
58
|
const store = useStore();
|
|
62
|
-
const isOpen = useSelector(store,
|
|
63
|
-
// eslint-disable-next-line no-nested-ternary
|
|
64
|
-
trigger === 'axis' ? axisHasData(xAxis) ? selectorChartsInteractionXAxisIsDefined : selectorChartsInteractionYAxisIsDefined : selectorChartsInteractionItemIsDefined);
|
|
59
|
+
const isOpen = useSelector(store, trigger === 'axis' ? selectorChartsInteractionAxisTooltip : selectorChartsInteractionItemIsDefined);
|
|
65
60
|
const popperOpen = pointerType !== null && isOpen; // tooltipHasData;
|
|
66
61
|
|
|
67
62
|
React.useEffect(() => {
|
|
@@ -155,7 +150,7 @@ process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
|
|
|
155
150
|
* The components used for each slot inside the Popper.
|
|
156
151
|
* Either a string to use a HTML element or a component.
|
|
157
152
|
*
|
|
158
|
-
* @deprecated use the `slots` prop instead. This prop will be removed in
|
|
153
|
+
* @deprecated use the `slots` prop instead. This prop will be removed in a future major release. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
159
154
|
* @default {}
|
|
160
155
|
*/
|
|
161
156
|
components: PropTypes.shape({
|
|
@@ -164,7 +159,7 @@ process.env.NODE_ENV !== "production" ? ChartsTooltipContainer.propTypes = {
|
|
|
164
159
|
/**
|
|
165
160
|
* The props used for each slot inside the Popper.
|
|
166
161
|
*
|
|
167
|
-
* @deprecated use the `slotProps` prop instead. This prop will be removed in
|
|
162
|
+
* @deprecated use the `slotProps` prop instead. This prop will be removed in a future major release. [How to migrate](/material-ui/migration/migrating-from-deprecated-apis/).
|
|
168
163
|
* @default {}
|
|
169
164
|
*/
|
|
170
165
|
componentsProps: PropTypes.shape({
|
|
@@ -13,4 +13,6 @@ export declare const ChartsTooltipRow: import("@emotion/styled").StyledComponent
|
|
|
13
13
|
/**
|
|
14
14
|
* @ignore - internal component.
|
|
15
15
|
*/
|
|
16
|
-
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<import("@mui/
|
|
16
|
+
export declare const ChartsTooltipCell: import("@emotion/styled").StyledComponent<Pick<import("@mui/material").TypographyOwnProps & import("@mui/material/OverridableComponent").CommonProps & Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLSpanElement>, HTMLSpanElement>, "p" | "style" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "className" | "children" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping">, "p" | "slot" | "style" | "title" | "ref" | "typography" | "zIndex" | "classes" | "border" | "boxShadow" | "fontWeight" | "alignContent" | "alignItems" | "alignSelf" | "bottom" | "boxSizing" | "color" | "columnGap" | "content" | "display" | "flexBasis" | "flexDirection" | "flexGrow" | "flexShrink" | "flexWrap" | "fontFamily" | "fontSize" | "fontStyle" | "gridAutoColumns" | "gridAutoFlow" | "gridAutoRows" | "gridTemplateAreas" | "gridTemplateColumns" | "gridTemplateRows" | "height" | "justifyContent" | "justifyItems" | "justifySelf" | "left" | "letterSpacing" | "lineHeight" | "marginBlockEnd" | "marginBlockStart" | "marginBottom" | "marginInlineEnd" | "marginInlineStart" | "marginLeft" | "marginRight" | "marginTop" | "maxHeight" | "maxWidth" | "minHeight" | "minWidth" | "order" | "paddingBlockEnd" | "paddingBlockStart" | "paddingBottom" | "paddingInlineEnd" | "paddingInlineStart" | "paddingLeft" | "paddingRight" | "paddingTop" | "position" | "right" | "rowGap" | "textAlign" | "textOverflow" | "textTransform" | "top" | "translate" | "visibility" | "whiteSpace" | "width" | "borderBottom" | "borderColor" | "borderLeft" | "borderRadius" | "borderRight" | "borderTop" | "flex" | "gap" | "gridArea" | "gridColumn" | "gridRow" | "margin" | "marginBlock" | "marginInline" | "overflow" | "padding" | "paddingBlock" | "paddingInline" | "bgcolor" | "m" | "mt" | "mr" | "mb" | "ml" | "mx" | "marginX" | "my" | "marginY" | "pt" | "pr" | "pb" | "pl" | "px" | "paddingX" | "py" | "paddingY" | "displayPrint" | "key" | "defaultChecked" | "defaultValue" | "suppressContentEditableWarning" | "suppressHydrationWarning" | "accessKey" | "autoCapitalize" | "autoFocus" | "className" | "contentEditable" | "contextMenu" | "dir" | "draggable" | "enterKeyHint" | "hidden" | "id" | "lang" | "nonce" | "spellCheck" | "tabIndex" | "radioGroup" | "role" | "about" | "datatype" | "inlist" | "prefix" | "property" | "rel" | "resource" | "rev" | "typeof" | "vocab" | "autoCorrect" | "autoSave" | "itemProp" | "itemScope" | "itemType" | "itemID" | "itemRef" | "results" | "security" | "unselectable" | "popover" | "popoverTargetAction" | "popoverTarget" | "inert" | "inputMode" | "is" | "exportparts" | "part" | "aria-activedescendant" | "aria-atomic" | "aria-autocomplete" | "aria-braillelabel" | "aria-brailleroledescription" | "aria-busy" | "aria-checked" | "aria-colcount" | "aria-colindex" | "aria-colindextext" | "aria-colspan" | "aria-controls" | "aria-current" | "aria-describedby" | "aria-description" | "aria-details" | "aria-disabled" | "aria-dropeffect" | "aria-errormessage" | "aria-expanded" | "aria-flowto" | "aria-grabbed" | "aria-haspopup" | "aria-hidden" | "aria-invalid" | "aria-keyshortcuts" | "aria-label" | "aria-labelledby" | "aria-level" | "aria-live" | "aria-modal" | "aria-multiline" | "aria-multiselectable" | "aria-orientation" | "aria-owns" | "aria-placeholder" | "aria-posinset" | "aria-pressed" | "aria-readonly" | "aria-relevant" | "aria-required" | "aria-roledescription" | "aria-rowcount" | "aria-rowindex" | "aria-rowindextext" | "aria-rowspan" | "aria-selected" | "aria-setsize" | "aria-sort" | "aria-valuemax" | "aria-valuemin" | "aria-valuenow" | "aria-valuetext" | "children" | "dangerouslySetInnerHTML" | "onCopy" | "onCopyCapture" | "onCut" | "onCutCapture" | "onPaste" | "onPasteCapture" | "onCompositionEnd" | "onCompositionEndCapture" | "onCompositionStart" | "onCompositionStartCapture" | "onCompositionUpdate" | "onCompositionUpdateCapture" | "onFocus" | "onFocusCapture" | "onBlur" | "onBlurCapture" | "onChange" | "onChangeCapture" | "onBeforeInput" | "onBeforeInputCapture" | "onInput" | "onInputCapture" | "onReset" | "onResetCapture" | "onSubmit" | "onSubmitCapture" | "onInvalid" | "onInvalidCapture" | "onLoad" | "onLoadCapture" | "onError" | "onErrorCapture" | "onKeyDown" | "onKeyDownCapture" | "onKeyPress" | "onKeyPressCapture" | "onKeyUp" | "onKeyUpCapture" | "onAbort" | "onAbortCapture" | "onCanPlay" | "onCanPlayCapture" | "onCanPlayThrough" | "onCanPlayThroughCapture" | "onDurationChange" | "onDurationChangeCapture" | "onEmptied" | "onEmptiedCapture" | "onEncrypted" | "onEncryptedCapture" | "onEnded" | "onEndedCapture" | "onLoadedData" | "onLoadedDataCapture" | "onLoadedMetadata" | "onLoadedMetadataCapture" | "onLoadStart" | "onLoadStartCapture" | "onPause" | "onPauseCapture" | "onPlay" | "onPlayCapture" | "onPlaying" | "onPlayingCapture" | "onProgress" | "onProgressCapture" | "onRateChange" | "onRateChangeCapture" | "onResize" | "onResizeCapture" | "onSeeked" | "onSeekedCapture" | "onSeeking" | "onSeekingCapture" | "onStalled" | "onStalledCapture" | "onSuspend" | "onSuspendCapture" | "onTimeUpdate" | "onTimeUpdateCapture" | "onVolumeChange" | "onVolumeChangeCapture" | "onWaiting" | "onWaitingCapture" | "onAuxClick" | "onAuxClickCapture" | "onClick" | "onClickCapture" | "onContextMenu" | "onContextMenuCapture" | "onDoubleClick" | "onDoubleClickCapture" | "onDrag" | "onDragCapture" | "onDragEnd" | "onDragEndCapture" | "onDragEnter" | "onDragEnterCapture" | "onDragExit" | "onDragExitCapture" | "onDragLeave" | "onDragLeaveCapture" | "onDragOver" | "onDragOverCapture" | "onDragStart" | "onDragStartCapture" | "onDrop" | "onDropCapture" | "onMouseDown" | "onMouseDownCapture" | "onMouseEnter" | "onMouseLeave" | "onMouseMove" | "onMouseMoveCapture" | "onMouseOut" | "onMouseOutCapture" | "onMouseOver" | "onMouseOverCapture" | "onMouseUp" | "onMouseUpCapture" | "onSelect" | "onSelectCapture" | "onTouchCancel" | "onTouchCancelCapture" | "onTouchEnd" | "onTouchEndCapture" | "onTouchMove" | "onTouchMoveCapture" | "onTouchStart" | "onTouchStartCapture" | "onPointerDown" | "onPointerDownCapture" | "onPointerMove" | "onPointerMoveCapture" | "onPointerUp" | "onPointerUpCapture" | "onPointerCancel" | "onPointerCancelCapture" | "onPointerEnter" | "onPointerLeave" | "onPointerOver" | "onPointerOverCapture" | "onPointerOut" | "onPointerOutCapture" | "onGotPointerCapture" | "onGotPointerCaptureCapture" | "onLostPointerCapture" | "onLostPointerCaptureCapture" | "onScroll" | "onScrollCapture" | "onScrollEnd" | "onScrollEndCapture" | "onWheel" | "onWheelCapture" | "onAnimationStart" | "onAnimationStartCapture" | "onAnimationEnd" | "onAnimationEndCapture" | "onAnimationIteration" | "onAnimationIterationCapture" | "onToggle" | "onBeforeToggle" | "onTransitionCancel" | "onTransitionCancelCapture" | "onTransitionEnd" | "onTransitionEndCapture" | "onTransitionRun" | "onTransitionRunCapture" | "onTransitionStart" | "onTransitionStartCapture" | "sx" | "align" | "gutterBottom" | "noWrap" | "paragraph" | "variant" | "variantMapping"> & import("@mui/system").MUIStyledCommonProps<import("@mui/material").Theme> & {
|
|
17
|
+
component?: React.ElementType;
|
|
18
|
+
}, {}, {}>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { styled } from '@mui/material/styles';
|
|
2
|
+
import Typography from '@mui/material/Typography';
|
|
2
3
|
import { chartsTooltipClasses } from "./chartsTooltipClasses.js";
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -28,8 +29,14 @@ export const ChartsTooltipTable = styled('table', {
|
|
|
28
29
|
theme
|
|
29
30
|
}) => ({
|
|
30
31
|
borderSpacing: 0,
|
|
31
|
-
'&
|
|
32
|
-
borderBottom: `solid ${(theme.vars || theme).palette.divider} 1px
|
|
32
|
+
'& caption': {
|
|
33
|
+
borderBottom: `solid ${(theme.vars || theme).palette.divider} 1px`,
|
|
34
|
+
padding: theme.spacing(0.5, 1.5),
|
|
35
|
+
textAlign: 'start',
|
|
36
|
+
whiteSpace: 'nowrap',
|
|
37
|
+
'& span': {
|
|
38
|
+
marginRight: theme.spacing(1.5)
|
|
39
|
+
}
|
|
33
40
|
}
|
|
34
41
|
}));
|
|
35
42
|
|
|
@@ -54,20 +61,27 @@ export const ChartsTooltipRow = styled('tr', {
|
|
|
54
61
|
/**
|
|
55
62
|
* @ignore - internal component.
|
|
56
63
|
*/
|
|
57
|
-
export const ChartsTooltipCell = styled(
|
|
64
|
+
export const ChartsTooltipCell = styled(Typography, {
|
|
58
65
|
name: 'MuiChartsTooltip',
|
|
59
|
-
slot: 'Cell'
|
|
60
|
-
overridesResolver: (props, styles) => styles.cell
|
|
66
|
+
slot: 'Cell'
|
|
61
67
|
})(({
|
|
62
68
|
theme
|
|
63
69
|
}) => ({
|
|
64
70
|
verticalAlign: 'middle',
|
|
65
71
|
color: (theme.vars || theme).palette.text.secondary,
|
|
66
|
-
|
|
72
|
+
textAlign: 'start',
|
|
73
|
+
[`&.${chartsTooltipClasses.cell}`]: {
|
|
67
74
|
paddingLeft: theme.spacing(1),
|
|
68
|
-
paddingRight: theme.spacing(1
|
|
75
|
+
paddingRight: theme.spacing(1)
|
|
76
|
+
},
|
|
77
|
+
[`&.${chartsTooltipClasses.labelCell}`]: {
|
|
69
78
|
fontWeight: theme.typography.fontWeightRegular
|
|
70
79
|
},
|
|
80
|
+
[`& .${chartsTooltipClasses.markContainer}`]: {
|
|
81
|
+
display: 'inline-block',
|
|
82
|
+
width: `calc(20px + ${theme.spacing(1.5)})`,
|
|
83
|
+
verticalAlign: 'middle'
|
|
84
|
+
},
|
|
71
85
|
[`&.${chartsTooltipClasses.valueCell}, &.${chartsTooltipClasses.axisValueCell}`]: {
|
|
72
86
|
color: (theme.vars || theme).palette.text.primary,
|
|
73
87
|
fontWeight: theme.typography.fontWeightMedium
|
|
@@ -76,10 +90,10 @@ export const ChartsTooltipCell = styled('td', {
|
|
|
76
90
|
paddingLeft: theme.spacing(1.5),
|
|
77
91
|
paddingRight: theme.spacing(1.5)
|
|
78
92
|
},
|
|
79
|
-
'td:first-of-type&': {
|
|
93
|
+
'td:first-of-type&, th:first-of-type&': {
|
|
80
94
|
paddingLeft: theme.spacing(1.5)
|
|
81
95
|
},
|
|
82
|
-
'td:last-of-type&': {
|
|
96
|
+
'td:last-of-type&, th:last-of-type&': {
|
|
83
97
|
paddingRight: theme.spacing(1.5)
|
|
84
98
|
}
|
|
85
99
|
}));
|
|
@@ -11,8 +11,8 @@ export interface ChartsTooltipClasses {
|
|
|
11
11
|
cell: string;
|
|
12
12
|
/** Styles applied to the mark element. */
|
|
13
13
|
mark: string;
|
|
14
|
-
/** Styles applied to the
|
|
15
|
-
|
|
14
|
+
/** Styles applied to the markContainer element. */
|
|
15
|
+
markContainer: string;
|
|
16
16
|
/** Styles applied to the labelCell element. */
|
|
17
17
|
labelCell: string;
|
|
18
18
|
/** Styles applied to the valueCell element. */
|
|
@@ -20,7 +20,7 @@ export interface ChartsTooltipClasses {
|
|
|
20
20
|
/** Styles applied to the axisValueCell element. Only available for axis tooltip. */
|
|
21
21
|
axisValueCell: string;
|
|
22
22
|
}
|
|
23
|
-
export type ChartsTooltipClassKey = keyof Omit<ChartsTooltipClasses, '
|
|
23
|
+
export type ChartsTooltipClassKey = keyof Omit<ChartsTooltipClasses, 'markContainer' | 'labelCell' | 'valueCell'>;
|
|
24
24
|
export declare function getChartsTooltipUtilityClass(slot: string): string;
|
|
25
25
|
export declare const chartsTooltipClasses: ChartsTooltipClasses;
|
|
26
|
-
export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"root" | "mark" | "table" | "cell" | "row" | "
|
|
26
|
+
export declare const useUtilityClasses: (classes?: Partial<ChartsTooltipClasses>) => Record<"root" | "mark" | "table" | "cell" | "row" | "markContainer" | "labelCell" | "valueCell" | "paper" | "axisValueCell", string>;
|
|
@@ -4,7 +4,7 @@ import composeClasses from '@mui/utils/composeClasses';
|
|
|
4
4
|
export function getChartsTooltipUtilityClass(slot) {
|
|
5
5
|
return generateUtilityClass('MuiChartsTooltip', slot);
|
|
6
6
|
}
|
|
7
|
-
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', '
|
|
7
|
+
export const chartsTooltipClasses = generateUtilityClasses('MuiChartsTooltip', ['root', 'paper', 'table', 'row', 'cell', 'mark', 'markContainer', 'labelCell', 'valueCell', 'axisValueCell']);
|
|
8
8
|
export const useUtilityClasses = classes => {
|
|
9
9
|
const slots = {
|
|
10
10
|
root: ['root'],
|
|
@@ -13,7 +13,7 @@ export const useUtilityClasses = classes => {
|
|
|
13
13
|
row: ['row'],
|
|
14
14
|
cell: ['cell'],
|
|
15
15
|
mark: ['mark'],
|
|
16
|
-
|
|
16
|
+
markContainer: ['markContainer'],
|
|
17
17
|
labelCell: ['labelCell'],
|
|
18
18
|
valueCell: ['valueCell'],
|
|
19
19
|
axisValueCell: ['axisValueCell']
|
|
@@ -7,5 +7,6 @@ export * from "./ChartsItemTooltipContent.js";
|
|
|
7
7
|
export * from "./ChartsTooltipTable.js";
|
|
8
8
|
export * from "./useItemTooltip.js";
|
|
9
9
|
export * from "./useAxisTooltip.js";
|
|
10
|
+
export * from "./useAxesTooltip.js";
|
|
10
11
|
export { useMouseTracker } from "./utils.js";
|
|
11
12
|
export * from "./ChartTooltip.types.js";
|
|
@@ -6,5 +6,6 @@ export * from "./ChartsItemTooltipContent.js";
|
|
|
6
6
|
export * from "./ChartsTooltipTable.js";
|
|
7
7
|
export * from "./useItemTooltip.js";
|
|
8
8
|
export * from "./useAxisTooltip.js";
|
|
9
|
+
export * from "./useAxesTooltip.js";
|
|
9
10
|
export { useMouseTracker } from "./utils.js";
|
|
10
11
|
export * from "./ChartTooltip.types.js";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { UseAxisTooltipParams, UseAxisTooltipReturnValue } from "./useAxisTooltip.js";
|
|
2
|
+
type UseAxesTooltipParams = Omit<UseAxisTooltipParams, 'multipleAxes'>;
|
|
3
|
+
/**
|
|
4
|
+
* Returns the axes to display in the tooltip and the series item related to them.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useAxesTooltip(params?: UseAxesTooltipParams): UseAxisTooltipReturnValue[] | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import { useAxisTooltip } from "./useAxisTooltip.js";
|
|
5
|
+
/**
|
|
6
|
+
* Returns the axes to display in the tooltip and the series item related to them.
|
|
7
|
+
*/
|
|
8
|
+
export function useAxesTooltip(params) {
|
|
9
|
+
return useAxisTooltip(_extends({}, params, {
|
|
10
|
+
multipleAxes: true
|
|
11
|
+
}));
|
|
12
|
+
}
|
|
@@ -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,
|