@mui/x-charts 6.0.0-alpha.9 → 6.18.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +26 -5
- package/BarChart/BarChart.js +93 -17
- package/BarChart/BarElement.d.ts +1319 -4
- package/BarChart/BarElement.js +10 -10
- package/BarChart/BarPlot.d.ts +17 -1
- package/BarChart/BarPlot.js +152 -66
- package/BarChart/formatter.js +2 -3
- package/BarChart/legend.js +1 -2
- package/CHANGELOG.md +797 -59
- package/ChartContainer/index.js +7 -5
- package/ChartsAxis/ChartsAxis.d.ts +9 -0
- package/ChartsAxis/ChartsAxis.js +33 -7
- package/ChartsAxis/axisClasses.d.ts +3 -3
- package/ChartsAxis/axisClasses.js +1 -2
- package/ChartsAxisHighlight/ChartsAxisHighlight.d.ts +21 -0
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +61 -22
- package/ChartsClipPath/ChartsClipPath.d.ts +5 -0
- package/ChartsClipPath/ChartsClipPath.js +7 -2
- package/ChartsLegend/ChartsLegend.d.ts +45 -24
- package/ChartsLegend/ChartsLegend.js +193 -151
- package/ChartsLegend/chartsLegendClasses.d.ts +1 -1
- package/ChartsLegend/chartsLegendClasses.js +3 -4
- package/ChartsLegend/utils.d.ts +1 -6
- package/ChartsReferenceLine/ChartsReferenceLine.d.ts +10 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +78 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.d.ts +13 -0
- package/ChartsReferenceLine/ChartsXReferenceLine.js +112 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.d.ts +13 -0
- package/ChartsReferenceLine/ChartsYReferenceLine.js +112 -0
- package/ChartsReferenceLine/chartsReferenceLineClasses.d.ts +15 -0
- package/ChartsReferenceLine/chartsReferenceLineClasses.js +14 -0
- package/ChartsReferenceLine/common.d.ts +41 -0
- package/ChartsReferenceLine/common.js +27 -0
- package/ChartsReferenceLine/index.d.ts +2 -0
- package/ChartsReferenceLine/index.js +27 -0
- package/ChartsReferenceLine/package.json +6 -0
- package/ChartsSurface.d.ts +12 -1
- package/ChartsSurface.js +9 -18
- package/ChartsTooltip/ChartsAxisTooltipContent.d.ts +1 -0
- package/ChartsTooltip/ChartsAxisTooltipContent.js +46 -32
- package/ChartsTooltip/ChartsItemTooltipContent.d.ts +3 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +18 -9
- package/ChartsTooltip/ChartsTooltip.d.ts +32 -0
- package/ChartsTooltip/ChartsTooltip.js +62 -18
- package/ChartsTooltip/ChartsTooltipTable.d.ts +3 -10
- package/ChartsTooltip/ChartsTooltipTable.js +22 -20
- package/ChartsTooltip/tooltipClasses.js +1 -2
- package/ChartsTooltip/utils.js +2 -2
- package/ChartsXAxis/ChartsXAxis.d.ts +9 -0
- package/ChartsXAxis/ChartsXAxis.js +170 -45
- package/ChartsYAxis/ChartsYAxis.d.ts +9 -0
- package/ChartsYAxis/ChartsYAxis.js +95 -38
- package/LineChart/AreaElement.d.ts +11 -1
- package/LineChart/AreaElement.js +14 -6
- package/LineChart/AreaPlot.d.ts +11 -0
- package/LineChart/AreaPlot.js +27 -8
- package/LineChart/LineChart.d.ts +23 -3
- package/LineChart/LineChart.js +89 -17
- package/LineChart/LineElement.d.ts +11 -1
- package/LineChart/LineElement.js +14 -6
- package/LineChart/LineHighlightElement.d.ts +10 -0
- package/LineChart/LineHighlightElement.js +13 -4
- package/LineChart/LineHighlightPlot.d.ts +10 -0
- package/LineChart/LineHighlightPlot.js +15 -4
- package/LineChart/LinePlot.d.ts +10 -0
- package/LineChart/LinePlot.js +25 -12
- package/LineChart/MarkElement.d.ts +10 -0
- package/LineChart/MarkElement.js +14 -5
- package/LineChart/MarkPlot.d.ts +10 -0
- package/LineChart/MarkPlot.js +42 -10
- package/LineChart/formatter.js +5 -5
- package/LineChart/legend.js +1 -2
- package/PieChart/PieArc.d.ts +11 -13
- package/PieChart/PieArc.js +28 -60
- package/PieChart/PieArcLabel.d.ts +8 -9
- package/PieChart/PieArcLabel.js +46 -38
- package/PieChart/PieArcLabelPlot.d.ts +28 -0
- package/PieChart/PieArcLabelPlot.js +99 -0
- package/PieChart/PieArcPlot.d.ts +35 -0
- package/PieChart/PieArcPlot.js +92 -0
- package/PieChart/PieChart.d.ts +19 -5
- package/PieChart/PieChart.js +95 -18
- package/PieChart/PiePlot.d.ts +15 -9
- package/PieChart/PiePlot.js +77 -55
- package/PieChart/dataTransform/transition.d.ts +4 -0
- package/PieChart/dataTransform/transition.js +136 -0
- package/PieChart/dataTransform/useTransformData.d.ts +15 -0
- package/PieChart/dataTransform/useTransformData.js +67 -0
- package/PieChart/formatter.js +1 -2
- package/PieChart/legend.js +1 -2
- package/README.md +8 -14
- package/ResponsiveChartContainer/index.d.ts +13 -3
- package/ResponsiveChartContainer/index.js +7 -8
- package/ScatterChart/Scatter.d.ts +10 -0
- package/ScatterChart/Scatter.js +12 -2
- package/ScatterChart/ScatterChart.d.ts +16 -3
- package/ScatterChart/ScatterChart.js +77 -16
- package/ScatterChart/ScatterPlot.d.ts +10 -0
- package/ScatterChart/ScatterPlot.js +12 -2
- package/ScatterChart/formatter.js +1 -2
- package/ScatterChart/legend.js +1 -2
- package/SparkLineChart/SparkLineChart.d.ts +12 -3
- package/SparkLineChart/SparkLineChart.js +50 -7
- package/colorPalettes/colorPalettes.js +6 -12
- package/constants.js +5 -8
- package/context/CartesianContextProvider.d.ts +26 -1
- package/context/CartesianContextProvider.js +42 -16
- package/context/DrawingProvider.d.ts +25 -0
- package/context/DrawingProvider.js +18 -6
- package/context/HighlightProvider.d.ts +17 -0
- package/context/HighlightProvider.js +3 -4
- package/context/InteractionProvider.d.ts +6 -0
- package/context/InteractionProvider.js +3 -4
- package/context/SeriesContextProvider.d.ts +5 -0
- package/context/SeriesContextProvider.js +3 -4
- package/esm/BarChart/BarChart.js +90 -13
- package/esm/BarChart/BarElement.js +7 -4
- package/esm/BarChart/BarPlot.js +152 -67
- package/esm/BarChart/formatter.js +1 -1
- package/esm/ChartContainer/index.js +3 -0
- package/esm/ChartsAxis/ChartsAxis.js +32 -5
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
- package/esm/ChartsClipPath/ChartsClipPath.js +5 -0
- package/esm/ChartsLegend/ChartsLegend.js +190 -144
- package/esm/ChartsLegend/chartsLegendClasses.js +1 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
- package/esm/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/esm/ChartsReferenceLine/common.js +20 -0
- package/esm/ChartsReferenceLine/index.js +2 -0
- package/esm/ChartsSurface.js +4 -12
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +44 -30
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
- package/esm/ChartsTooltip/ChartsTooltip.js +59 -14
- package/esm/ChartsTooltip/ChartsTooltipTable.js +17 -10
- package/esm/ChartsXAxis/ChartsXAxis.js +168 -43
- package/esm/ChartsYAxis/ChartsYAxis.js +93 -36
- package/esm/LineChart/AreaElement.js +10 -0
- package/esm/LineChart/AreaPlot.js +26 -6
- package/esm/LineChart/LineChart.js +86 -13
- package/esm/LineChart/LineElement.js +10 -0
- package/esm/LineChart/LineHighlightElement.js +10 -0
- package/esm/LineChart/LineHighlightPlot.js +13 -2
- package/esm/LineChart/LinePlot.js +25 -14
- package/esm/LineChart/MarkElement.js +11 -1
- package/esm/LineChart/MarkPlot.js +40 -8
- package/esm/LineChart/formatter.js +7 -3
- package/esm/PieChart/PieArc.js +26 -58
- package/esm/PieChart/PieArcLabel.js +43 -34
- package/esm/PieChart/PieArcLabelPlot.js +92 -0
- package/esm/PieChart/PieArcPlot.js +84 -0
- package/esm/PieChart/PieChart.js +93 -16
- package/esm/PieChart/PiePlot.js +76 -57
- package/esm/PieChart/dataTransform/transition.js +130 -0
- package/esm/PieChart/dataTransform/useTransformData.js +59 -0
- package/esm/ResponsiveChartContainer/index.js +3 -3
- package/esm/ScatterChart/Scatter.js +10 -0
- package/esm/ScatterChart/ScatterChart.js +74 -12
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +47 -3
- package/esm/constants.js +1 -1
- package/esm/context/CartesianContextProvider.js +41 -14
- package/esm/context/DrawingProvider.js +14 -0
- package/esm/hooks/useChartDimensions.js +2 -0
- package/esm/hooks/useMounted.js +16 -0
- package/esm/hooks/useReducedMotion.js +27 -0
- package/esm/hooks/useTicks.js +15 -9
- package/esm/index.js +1 -0
- package/esm/internals/components/AxisSharedComponents.js +15 -70
- package/esm/internals/components/ChartsText.js +77 -0
- package/esm/internals/domUtils.js +113 -0
- package/esm/internals/geometry.js +36 -0
- package/hooks/useAxisEvents.js +2 -2
- package/hooks/useChartDimensions.d.ts +2 -0
- package/hooks/useChartDimensions.js +5 -4
- package/hooks/useDrawingArea.js +2 -2
- package/hooks/useInteractionItemProps.js +2 -2
- package/hooks/useMounted.d.ts +1 -0
- package/hooks/useMounted.js +25 -0
- package/hooks/useReducedMotion.d.ts +8 -0
- package/hooks/useReducedMotion.js +33 -0
- package/hooks/useScale.d.ts +2 -2
- package/hooks/useScale.js +2 -2
- package/hooks/useTicks.d.ts +19 -11
- package/hooks/useTicks.js +19 -14
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/components/AxisSharedComponents.d.ts +0 -4
- package/internals/components/AxisSharedComponents.js +18 -78
- package/internals/components/ChartsText.d.ts +35 -0
- package/internals/components/ChartsText.js +87 -0
- package/internals/defaultizeColor.d.ts +7 -2
- package/internals/defaultizeValueFormatter.js +1 -2
- package/internals/domUtils.d.ts +13 -0
- package/internals/domUtils.js +122 -0
- package/internals/geometry.d.ts +9 -0
- package/internals/geometry.js +42 -0
- package/internals/isBandScale.d.ts +3 -1
- package/internals/stackSeries.js +2 -4
- package/internals/utils.d.ts +5 -0
- package/legacy/BarChart/BarChart.js +90 -13
- package/legacy/BarChart/BarElement.js +6 -3
- package/legacy/BarChart/BarPlot.js +151 -63
- package/legacy/BarChart/formatter.js +1 -1
- package/legacy/ChartContainer/index.js +3 -0
- package/legacy/ChartsAxis/ChartsAxis.js +32 -5
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -20
- package/legacy/ChartsClipPath/ChartsClipPath.js +5 -0
- package/legacy/ChartsLegend/ChartsLegend.js +205 -142
- package/legacy/ChartsLegend/chartsLegendClasses.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +105 -0
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +105 -0
- package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/legacy/ChartsReferenceLine/common.js +20 -0
- package/legacy/ChartsReferenceLine/index.js +2 -0
- package/legacy/ChartsSurface.js +3 -12
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +22 -10
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
- package/legacy/ChartsTooltip/ChartsTooltip.js +62 -14
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +34 -26
- package/legacy/ChartsXAxis/ChartsXAxis.js +176 -50
- package/legacy/ChartsYAxis/ChartsYAxis.js +97 -41
- package/legacy/LineChart/AreaElement.js +10 -0
- package/legacy/LineChart/AreaPlot.js +31 -7
- package/legacy/LineChart/LineChart.js +86 -13
- package/legacy/LineChart/LineElement.js +10 -0
- package/legacy/LineChart/LineHighlightElement.js +10 -0
- package/legacy/LineChart/LineHighlightPlot.js +13 -2
- package/legacy/LineChart/LinePlot.js +29 -12
- package/legacy/LineChart/MarkElement.js +11 -1
- package/legacy/LineChart/MarkPlot.js +39 -8
- package/legacy/LineChart/formatter.js +7 -3
- package/legacy/PieChart/PieArc.js +30 -62
- package/legacy/PieChart/PieArcLabel.js +48 -34
- package/legacy/PieChart/PieArcLabelPlot.js +93 -0
- package/legacy/PieChart/PieArcPlot.js +84 -0
- package/legacy/PieChart/PieChart.js +93 -16
- package/legacy/PieChart/PiePlot.js +76 -59
- package/legacy/PieChart/dataTransform/transition.js +142 -0
- package/legacy/PieChart/dataTransform/useTransformData.js +60 -0
- package/legacy/ResponsiveChartContainer/index.js +3 -3
- package/legacy/ScatterChart/Scatter.js +10 -0
- package/legacy/ScatterChart/ScatterChart.js +74 -12
- package/legacy/ScatterChart/ScatterPlot.js +10 -0
- package/legacy/SparkLineChart/SparkLineChart.js +47 -3
- package/legacy/constants.js +1 -1
- package/legacy/context/CartesianContextProvider.js +41 -14
- package/legacy/context/DrawingProvider.js +14 -0
- package/legacy/hooks/useChartDimensions.js +2 -0
- package/legacy/hooks/useMounted.js +21 -0
- package/legacy/hooks/useReducedMotion.js +27 -0
- package/legacy/hooks/useTicks.js +16 -9
- package/legacy/index.js +2 -1
- package/legacy/internals/components/AxisSharedComponents.js +11 -65
- package/legacy/internals/components/ChartsText.js +79 -0
- package/legacy/internals/domUtils.js +121 -0
- package/legacy/internals/geometry.js +37 -0
- package/models/axis.d.ts +58 -20
- package/models/layout.d.ts +13 -6
- package/models/seriesType/common.d.ts +16 -0
- package/models/seriesType/line.d.ts +8 -3
- package/models/seriesType/pie.d.ts +5 -1
- package/modern/BarChart/BarChart.js +90 -13
- package/modern/BarChart/BarElement.js +7 -4
- package/modern/BarChart/BarPlot.js +149 -65
- package/modern/BarChart/formatter.js +1 -1
- package/modern/ChartContainer/index.js +3 -0
- package/modern/ChartsAxis/ChartsAxis.js +31 -5
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
- package/modern/ChartsClipPath/ChartsClipPath.js +5 -0
- package/modern/ChartsLegend/ChartsLegend.js +190 -144
- package/modern/ChartsLegend/chartsLegendClasses.js +1 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +70 -0
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +104 -0
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +104 -0
- package/modern/ChartsReferenceLine/chartsReferenceLineClasses.js +6 -0
- package/modern/ChartsReferenceLine/common.js +20 -0
- package/modern/ChartsReferenceLine/index.js +2 -0
- package/modern/ChartsSurface.js +4 -12
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +44 -30
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +15 -7
- package/modern/ChartsTooltip/ChartsTooltip.js +58 -14
- package/modern/ChartsTooltip/ChartsTooltipTable.js +17 -10
- package/modern/ChartsXAxis/ChartsXAxis.js +167 -42
- package/modern/ChartsYAxis/ChartsYAxis.js +92 -35
- package/modern/LineChart/AreaElement.js +10 -0
- package/modern/LineChart/AreaPlot.js +25 -6
- package/modern/LineChart/LineChart.js +86 -13
- package/modern/LineChart/LineElement.js +10 -0
- package/modern/LineChart/LineHighlightElement.js +10 -0
- package/modern/LineChart/LineHighlightPlot.js +13 -2
- package/modern/LineChart/LinePlot.js +23 -10
- package/modern/LineChart/MarkElement.js +11 -1
- package/modern/LineChart/MarkPlot.js +40 -8
- package/modern/LineChart/formatter.js +4 -3
- package/modern/PieChart/PieArc.js +26 -57
- package/modern/PieChart/PieArcLabel.js +43 -34
- package/modern/PieChart/PieArcLabelPlot.js +90 -0
- package/modern/PieChart/PieArcPlot.js +83 -0
- package/modern/PieChart/PieChart.js +93 -16
- package/modern/PieChart/PiePlot.js +76 -55
- package/modern/PieChart/dataTransform/transition.js +130 -0
- package/modern/PieChart/dataTransform/useTransformData.js +58 -0
- package/modern/ResponsiveChartContainer/index.js +3 -3
- package/modern/ScatterChart/Scatter.js +10 -0
- package/modern/ScatterChart/ScatterChart.js +74 -12
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +47 -3
- package/modern/constants.js +1 -1
- package/modern/context/CartesianContextProvider.js +40 -13
- package/modern/context/DrawingProvider.js +14 -0
- package/modern/hooks/useChartDimensions.js +2 -0
- package/modern/hooks/useMounted.js +16 -0
- package/modern/hooks/useReducedMotion.js +27 -0
- package/modern/hooks/useTicks.js +15 -9
- package/modern/index.js +2 -1
- package/modern/internals/components/AxisSharedComponents.js +15 -70
- package/modern/internals/components/ChartsText.js +77 -0
- package/modern/internals/domUtils.js +113 -0
- package/modern/internals/geometry.js +36 -0
- package/package.json +9 -6
- package/themeAugmentation/components.d.ts +1 -0
- package/themeAugmentation/overrides.d.ts +2 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import * as React from 'react';
|
|
3
|
+
import PropTypes from 'prop-types';
|
|
4
|
+
import { ChartsXReferenceLine } from './ChartsXReferenceLine';
|
|
5
|
+
import { ChartsYReferenceLine } from './ChartsYReferenceLine';
|
|
6
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
|
+
function ChartsReferenceLine(props) {
|
|
8
|
+
if (props.x !== undefined && props.y !== undefined) {
|
|
9
|
+
throw new Error('MUI-X: The ChartsReferenceLine can not have both `x` and `y` props set.');
|
|
10
|
+
}
|
|
11
|
+
if (props.x === undefined && props.y === undefined) {
|
|
12
|
+
throw new Error('MUI-X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
13
|
+
}
|
|
14
|
+
if (props.x !== undefined) {
|
|
15
|
+
return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));
|
|
16
|
+
}
|
|
17
|
+
return /*#__PURE__*/_jsx(ChartsYReferenceLine, _extends({}, props));
|
|
18
|
+
}
|
|
19
|
+
process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
|
|
20
|
+
// ----------------------------- Warning --------------------------------
|
|
21
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
22
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
23
|
+
// ----------------------------------------------------------------------
|
|
24
|
+
/**
|
|
25
|
+
* The id of the axis used for the reference value.
|
|
26
|
+
* @default The `id` of the first defined axis.
|
|
27
|
+
*/
|
|
28
|
+
axisId: PropTypes.string,
|
|
29
|
+
/**
|
|
30
|
+
* Override or extend the styles applied to the component.
|
|
31
|
+
*/
|
|
32
|
+
classes: PropTypes.object,
|
|
33
|
+
/**
|
|
34
|
+
* The label to display along the reference line.
|
|
35
|
+
*/
|
|
36
|
+
label: PropTypes.string,
|
|
37
|
+
/**
|
|
38
|
+
* The alignment if the label is in the chart drawing area.
|
|
39
|
+
* @default 'middle'
|
|
40
|
+
*/
|
|
41
|
+
labelAlign: PropTypes.oneOf(['end', 'middle', 'start']),
|
|
42
|
+
/**
|
|
43
|
+
* The style applied to the label.
|
|
44
|
+
*/
|
|
45
|
+
labelStyle: PropTypes.object,
|
|
46
|
+
/**
|
|
47
|
+
* The style applied to the line.
|
|
48
|
+
*/
|
|
49
|
+
lineStyle: PropTypes.object,
|
|
50
|
+
/**
|
|
51
|
+
* Additional space arround the label in px.
|
|
52
|
+
* Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
|
|
53
|
+
* @default 5
|
|
54
|
+
*/
|
|
55
|
+
spacing: PropTypes.oneOfType([PropTypes.number, PropTypes.shape({
|
|
56
|
+
x: PropTypes.number,
|
|
57
|
+
y: PropTypes.number
|
|
58
|
+
})]),
|
|
59
|
+
/**
|
|
60
|
+
* The x value associated with the reference line.
|
|
61
|
+
* If defined the reference line will be vertical.
|
|
62
|
+
*/
|
|
63
|
+
x: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]),
|
|
64
|
+
/**
|
|
65
|
+
* The y value associated with the reference line.
|
|
66
|
+
* If defined the reference line will be horizontal.
|
|
67
|
+
*/
|
|
68
|
+
y: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string])
|
|
69
|
+
} : void 0;
|
|
70
|
+
export { ChartsReferenceLine };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
+
import { useDrawingArea, useXScale } from '../hooks';
|
|
6
|
+
import { ReferenceLineRoot } from './common';
|
|
7
|
+
import { ChartsText } from '../internals/components/ChartsText';
|
|
8
|
+
import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var getTextParams = function getTextParams(_ref) {
|
|
12
|
+
var top = _ref.top,
|
|
13
|
+
height = _ref.height,
|
|
14
|
+
spacingY = _ref.spacingY,
|
|
15
|
+
_ref$labelAlign = _ref.labelAlign,
|
|
16
|
+
labelAlign = _ref$labelAlign === void 0 ? 'middle' : _ref$labelAlign;
|
|
17
|
+
switch (labelAlign) {
|
|
18
|
+
case 'start':
|
|
19
|
+
return {
|
|
20
|
+
y: top + spacingY,
|
|
21
|
+
style: {
|
|
22
|
+
dominantBaseline: 'hanging',
|
|
23
|
+
textAnchor: 'start'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
case 'end':
|
|
27
|
+
return {
|
|
28
|
+
y: top + height - spacingY,
|
|
29
|
+
style: {
|
|
30
|
+
dominantBaseline: 'auto',
|
|
31
|
+
textAnchor: 'start'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
return {
|
|
36
|
+
y: top + height / 2,
|
|
37
|
+
style: {
|
|
38
|
+
dominantBaseline: 'central',
|
|
39
|
+
textAnchor: 'start'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
export function getXReferenceLineClasses(classes) {
|
|
45
|
+
return composeClasses({
|
|
46
|
+
root: ['root', 'vertical'],
|
|
47
|
+
line: ['line'],
|
|
48
|
+
label: ['label']
|
|
49
|
+
}, getReferenceLineUtilityClass, classes);
|
|
50
|
+
}
|
|
51
|
+
var warnedOnce = false;
|
|
52
|
+
function ChartsXReferenceLine(props) {
|
|
53
|
+
var _spacing$x, _spacing$y;
|
|
54
|
+
var x = props.x,
|
|
55
|
+
_props$label = props.label,
|
|
56
|
+
label = _props$label === void 0 ? '' : _props$label,
|
|
57
|
+
_props$spacing = props.spacing,
|
|
58
|
+
spacing = _props$spacing === void 0 ? 5 : _props$spacing,
|
|
59
|
+
inClasses = props.classes,
|
|
60
|
+
labelAlign = props.labelAlign,
|
|
61
|
+
lineStyle = props.lineStyle,
|
|
62
|
+
labelStyle = props.labelStyle,
|
|
63
|
+
axisId = props.axisId;
|
|
64
|
+
var _useDrawingArea = useDrawingArea(),
|
|
65
|
+
top = _useDrawingArea.top,
|
|
66
|
+
height = _useDrawingArea.height;
|
|
67
|
+
var xAxisScale = useXScale(axisId);
|
|
68
|
+
var xPosition = xAxisScale(x);
|
|
69
|
+
if (xPosition === undefined) {
|
|
70
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
71
|
+
if (!warnedOnce) {
|
|
72
|
+
warnedOnce = true;
|
|
73
|
+
console.error("MUI X: the value ".concat(x, " does not exist in the data of x axis with id ").concat(axisId, "."));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
var d = "M ".concat(xPosition, " ").concat(top, " l 0 ").concat(height);
|
|
79
|
+
var classes = getXReferenceLineClasses(inClasses);
|
|
80
|
+
var spacingX = _typeof(spacing) === 'object' ? (_spacing$x = spacing.x) != null ? _spacing$x : 0 : spacing;
|
|
81
|
+
var spacingY = _typeof(spacing) === 'object' ? (_spacing$y = spacing.y) != null ? _spacing$y : 0 : spacing;
|
|
82
|
+
var textParams = _extends({
|
|
83
|
+
x: xPosition + spacingX,
|
|
84
|
+
text: label,
|
|
85
|
+
fontSize: 12
|
|
86
|
+
}, getTextParams({
|
|
87
|
+
top: top,
|
|
88
|
+
height: height,
|
|
89
|
+
spacingY: spacingY,
|
|
90
|
+
labelAlign: labelAlign
|
|
91
|
+
}), {
|
|
92
|
+
className: classes.label
|
|
93
|
+
});
|
|
94
|
+
return /*#__PURE__*/_jsxs(ReferenceLineRoot, {
|
|
95
|
+
className: classes.root,
|
|
96
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
97
|
+
d: d,
|
|
98
|
+
className: classes.line,
|
|
99
|
+
style: lineStyle
|
|
100
|
+
}), /*#__PURE__*/_jsx(ChartsText, _extends({}, textParams, {
|
|
101
|
+
style: _extends({}, textParams.style, labelStyle)
|
|
102
|
+
}))]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export { ChartsXReferenceLine };
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _typeof from "@babel/runtime/helpers/esm/typeof";
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
+
import { useDrawingArea, useYScale } from '../hooks';
|
|
6
|
+
import { ReferenceLineRoot } from './common';
|
|
7
|
+
import { ChartsText } from '../internals/components/ChartsText';
|
|
8
|
+
import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
var getTextParams = function getTextParams(_ref) {
|
|
12
|
+
var left = _ref.left,
|
|
13
|
+
width = _ref.width,
|
|
14
|
+
spacingX = _ref.spacingX,
|
|
15
|
+
_ref$labelAlign = _ref.labelAlign,
|
|
16
|
+
labelAlign = _ref$labelAlign === void 0 ? 'middle' : _ref$labelAlign;
|
|
17
|
+
switch (labelAlign) {
|
|
18
|
+
case 'start':
|
|
19
|
+
return {
|
|
20
|
+
x: left + spacingX,
|
|
21
|
+
style: {
|
|
22
|
+
dominantBaseline: 'auto',
|
|
23
|
+
textAnchor: 'start'
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
case 'end':
|
|
27
|
+
return {
|
|
28
|
+
x: left + width - spacingX,
|
|
29
|
+
style: {
|
|
30
|
+
dominantBaseline: 'auto',
|
|
31
|
+
textAnchor: 'end'
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
default:
|
|
35
|
+
return {
|
|
36
|
+
x: left + width / 2,
|
|
37
|
+
style: {
|
|
38
|
+
dominantBaseline: 'auto',
|
|
39
|
+
textAnchor: 'middle'
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
var warnedOnce = false;
|
|
45
|
+
export function getYReferenceLineClasses(classes) {
|
|
46
|
+
return composeClasses({
|
|
47
|
+
root: ['root', 'horizontal'],
|
|
48
|
+
line: ['line'],
|
|
49
|
+
label: ['label']
|
|
50
|
+
}, getReferenceLineUtilityClass, classes);
|
|
51
|
+
}
|
|
52
|
+
function ChartsYReferenceLine(props) {
|
|
53
|
+
var _spacing$x, _spacing$y;
|
|
54
|
+
var y = props.y,
|
|
55
|
+
_props$label = props.label,
|
|
56
|
+
label = _props$label === void 0 ? '' : _props$label,
|
|
57
|
+
_props$spacing = props.spacing,
|
|
58
|
+
spacing = _props$spacing === void 0 ? 5 : _props$spacing,
|
|
59
|
+
inClasses = props.classes,
|
|
60
|
+
labelAlign = props.labelAlign,
|
|
61
|
+
lineStyle = props.lineStyle,
|
|
62
|
+
labelStyle = props.labelStyle,
|
|
63
|
+
axisId = props.axisId;
|
|
64
|
+
var _useDrawingArea = useDrawingArea(),
|
|
65
|
+
left = _useDrawingArea.left,
|
|
66
|
+
width = _useDrawingArea.width;
|
|
67
|
+
var yAxisScale = useYScale(axisId);
|
|
68
|
+
var yPosition = yAxisScale(y);
|
|
69
|
+
if (yPosition === undefined) {
|
|
70
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
71
|
+
if (!warnedOnce) {
|
|
72
|
+
warnedOnce = true;
|
|
73
|
+
console.error("MUI X: the value ".concat(y, " does not exist in the data of y axis with id ").concat(axisId, "."));
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
var d = "M ".concat(left, " ").concat(yPosition, " l ").concat(width, " 0");
|
|
79
|
+
var classes = getYReferenceLineClasses(inClasses);
|
|
80
|
+
var spacingX = _typeof(spacing) === 'object' ? (_spacing$x = spacing.x) != null ? _spacing$x : 0 : spacing;
|
|
81
|
+
var spacingY = _typeof(spacing) === 'object' ? (_spacing$y = spacing.y) != null ? _spacing$y : 0 : spacing;
|
|
82
|
+
var textParams = _extends({
|
|
83
|
+
y: yPosition - spacingY,
|
|
84
|
+
text: label,
|
|
85
|
+
fontSize: 12
|
|
86
|
+
}, getTextParams({
|
|
87
|
+
left: left,
|
|
88
|
+
width: width,
|
|
89
|
+
spacingX: spacingX,
|
|
90
|
+
labelAlign: labelAlign
|
|
91
|
+
}), {
|
|
92
|
+
className: classes.label
|
|
93
|
+
});
|
|
94
|
+
return /*#__PURE__*/_jsxs(ReferenceLineRoot, {
|
|
95
|
+
className: classes.root,
|
|
96
|
+
children: [/*#__PURE__*/_jsx("path", {
|
|
97
|
+
d: d,
|
|
98
|
+
className: classes.line,
|
|
99
|
+
style: lineStyle
|
|
100
|
+
}), /*#__PURE__*/_jsx(ChartsText, _extends({}, textParams, {
|
|
101
|
+
style: _extends({}, textParams.style, labelStyle)
|
|
102
|
+
}))]
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
export { ChartsYReferenceLine };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
2
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
|
+
export function getReferenceLineUtilityClass(slot) {
|
|
4
|
+
return generateUtilityClass('MuiChartsReferenceLine', slot);
|
|
5
|
+
}
|
|
6
|
+
export var referenceLineClasses = generateUtilityClasses('MuiChartsReferenceLine', ['root', 'vertical', 'horizontal', 'line', 'label']);
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
+
import { styled } from '@mui/material/styles';
|
|
4
|
+
import { referenceLineClasses } from './chartsReferenceLineClasses';
|
|
5
|
+
export var ReferenceLineRoot = styled('g')(function (_ref) {
|
|
6
|
+
var _ref2;
|
|
7
|
+
var theme = _ref.theme;
|
|
8
|
+
return _ref2 = {}, _defineProperty(_ref2, "& .".concat(referenceLineClasses.line), {
|
|
9
|
+
fill: 'none',
|
|
10
|
+
stroke: (theme.vars || theme).palette.text.primary,
|
|
11
|
+
shapeRendering: 'crispEdges',
|
|
12
|
+
strokeWidth: 1,
|
|
13
|
+
pointerEvents: 'none'
|
|
14
|
+
}), _defineProperty(_ref2, "& .".concat(referenceLineClasses.label), _extends({
|
|
15
|
+
fill: (theme.vars || theme).palette.text.primary,
|
|
16
|
+
stroke: 'none',
|
|
17
|
+
pointerEvents: 'none',
|
|
18
|
+
fontSize: 12
|
|
19
|
+
}, theme.typography.body1)), _ref2;
|
|
20
|
+
});
|
package/legacy/ChartsSurface.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
4
|
-
var _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className"
|
|
5
|
-
import { styled } from '@mui/
|
|
3
|
+
var _excluded = ["children", "width", "height", "viewBox", "disableAxisListener", "className"];
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
6
5
|
import * as React from 'react';
|
|
7
6
|
import { useAxisEvents } from './hooks/useAxisEvents';
|
|
8
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -21,7 +20,6 @@ export var ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(
|
|
|
21
20
|
_props$disableAxisLis = props.disableAxisListener,
|
|
22
21
|
disableAxisListener = _props$disableAxisLis === void 0 ? false : _props$disableAxisLis,
|
|
23
22
|
className = props.className,
|
|
24
|
-
sx = props.sx,
|
|
25
23
|
other = _objectWithoutProperties(props, _excluded);
|
|
26
24
|
var svgView = _extends({
|
|
27
25
|
width: width,
|
|
@@ -34,14 +32,7 @@ export var ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(
|
|
|
34
32
|
width: width,
|
|
35
33
|
height: height,
|
|
36
34
|
viewBox: "".concat(svgView.x, " ").concat(svgView.y, " ").concat(svgView.width, " ").concat(svgView.height),
|
|
37
|
-
ref: ref
|
|
38
|
-
sx: [{
|
|
39
|
-
'--ChartsLegend-itemWidth': '100px',
|
|
40
|
-
'--ChartsLegend-itemMarkSize': '20px',
|
|
41
|
-
'--ChartsLegend-rootSpacing': '5px',
|
|
42
|
-
'--ChartsLegend-labelSpacing': '5px',
|
|
43
|
-
'--ChartsLegend-rootOffsetY': '-20px'
|
|
44
|
-
}].concat(_toConsumableArray(Array.isArray(sx) ? sx : [sx]))
|
|
35
|
+
ref: ref
|
|
45
36
|
}, other, {
|
|
46
37
|
children: [/*#__PURE__*/_jsx("title", {
|
|
47
38
|
children: props.title
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import Typography from '@mui/material/Typography';
|
|
4
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
3
5
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
4
6
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
5
7
|
import { ChartsTooltipCell, ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipMark, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
@@ -21,7 +23,6 @@ export function DefaultChartsAxisContent(props) {
|
|
|
21
23
|
};
|
|
22
24
|
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
23
25
|
sx: sx,
|
|
24
|
-
variant: "outlined",
|
|
25
26
|
className: classes.root,
|
|
26
27
|
children: /*#__PURE__*/_jsxs(ChartsTooltipTable, {
|
|
27
28
|
children: [axisValue != null && !axis.hideTooltip && /*#__PURE__*/_jsx("thead", {
|
|
@@ -40,6 +41,10 @@ export function DefaultChartsAxisContent(props) {
|
|
|
40
41
|
label = _ref.label,
|
|
41
42
|
valueFormatter = _ref.valueFormatter,
|
|
42
43
|
data = _ref.data;
|
|
44
|
+
var formattedValue = valueFormatter(data[dataIndex]);
|
|
45
|
+
if (formattedValue == null) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
43
48
|
return /*#__PURE__*/_jsxs(ChartsTooltipRow, {
|
|
44
49
|
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
45
50
|
className: classes.markCell,
|
|
@@ -57,7 +62,7 @@ export function DefaultChartsAxisContent(props) {
|
|
|
57
62
|
}), /*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
58
63
|
className: classes.valueCell,
|
|
59
64
|
children: /*#__PURE__*/_jsx(Typography, {
|
|
60
|
-
children:
|
|
65
|
+
children: formattedValue
|
|
61
66
|
})
|
|
62
67
|
})]
|
|
63
68
|
}, id);
|
|
@@ -68,6 +73,7 @@ export function DefaultChartsAxisContent(props) {
|
|
|
68
73
|
}
|
|
69
74
|
export function ChartsAxisTooltipContent(props) {
|
|
70
75
|
var content = props.content,
|
|
76
|
+
contentProps = props.contentProps,
|
|
71
77
|
axisData = props.axisData,
|
|
72
78
|
sx = props.sx,
|
|
73
79
|
classes = props.classes;
|
|
@@ -100,13 +106,19 @@ export function ChartsAxisTooltipContent(props) {
|
|
|
100
106
|
return isXaxis ? xAxis[USED_AXIS_ID] : yAxis[USED_AXIS_ID];
|
|
101
107
|
}, [USED_AXIS_ID, isXaxis, xAxis, yAxis]);
|
|
102
108
|
var Content = content != null ? content : DefaultChartsAxisContent;
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
var chartTooltipContentProps = useSlotProps({
|
|
110
|
+
elementType: Content,
|
|
111
|
+
externalSlotProps: contentProps,
|
|
112
|
+
additionalProps: {
|
|
113
|
+
axisData: axisData,
|
|
114
|
+
series: relevantSeries,
|
|
115
|
+
axis: relevantAxis,
|
|
116
|
+
dataIndex: dataIndex,
|
|
117
|
+
axisValue: axisValue,
|
|
118
|
+
sx: sx,
|
|
119
|
+
classes: classes
|
|
120
|
+
},
|
|
121
|
+
ownerState: {}
|
|
111
122
|
});
|
|
123
|
+
return /*#__PURE__*/_jsx(Content, _extends({}, chartTooltipContentProps));
|
|
112
124
|
}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
3
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
2
4
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
3
5
|
import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltipPaper, ChartsTooltipRow } from './ChartsTooltipTable';
|
|
4
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -26,7 +28,6 @@ export function DefaultChartsItemContent(props) {
|
|
|
26
28
|
var formattedValue = series.valueFormatter(series.data[itemData.dataIndex]);
|
|
27
29
|
return /*#__PURE__*/_jsx(ChartsTooltipPaper, {
|
|
28
30
|
sx: sx,
|
|
29
|
-
variant: "outlined",
|
|
30
31
|
className: classes.root,
|
|
31
32
|
children: /*#__PURE__*/_jsx(ChartsTooltipTable, {
|
|
32
33
|
children: /*#__PURE__*/_jsx("tbody", {
|
|
@@ -54,13 +55,20 @@ export function ChartsItemTooltipContent(props) {
|
|
|
54
55
|
var content = props.content,
|
|
55
56
|
itemData = props.itemData,
|
|
56
57
|
sx = props.sx,
|
|
57
|
-
classes = props.classes
|
|
58
|
+
classes = props.classes,
|
|
59
|
+
contentProps = props.contentProps;
|
|
58
60
|
var series = React.useContext(SeriesContext)[itemData.type].series[itemData.seriesId];
|
|
59
61
|
var Content = content != null ? content : DefaultChartsItemContent;
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
62
|
+
var chartTooltipContentProps = useSlotProps({
|
|
63
|
+
elementType: Content,
|
|
64
|
+
externalSlotProps: contentProps,
|
|
65
|
+
additionalProps: {
|
|
66
|
+
itemData: itemData,
|
|
67
|
+
series: series,
|
|
68
|
+
sx: sx,
|
|
69
|
+
classes: classes
|
|
70
|
+
},
|
|
71
|
+
ownerState: {}
|
|
65
72
|
});
|
|
73
|
+
return /*#__PURE__*/_jsx(Content, _extends({}, chartTooltipContentProps));
|
|
66
74
|
}
|
|
@@ -1,8 +1,11 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
1
2
|
import * as React from 'react';
|
|
2
3
|
import PropTypes from 'prop-types';
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
4
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
5
|
+
import { styled } from '@mui/material/styles';
|
|
6
|
+
import { Popper } from '@mui/base/Popper';
|
|
7
|
+
import { NoSsr } from '@mui/base/NoSsr';
|
|
8
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
6
9
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
7
10
|
import { generateVirtualElement, useMouseTracker, getTootipHasData } from './utils';
|
|
8
11
|
import { ChartsItemTooltipContent } from './ChartsItemTooltipContent';
|
|
@@ -19,11 +22,37 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
19
22
|
};
|
|
20
23
|
return composeClasses(slots, getTooltipUtilityClass, classes);
|
|
21
24
|
};
|
|
25
|
+
var ChartsTooltipRoot = styled(Popper, {
|
|
26
|
+
name: 'MuiChartsTooltip',
|
|
27
|
+
slot: 'Root',
|
|
28
|
+
overridesResolver: function overridesResolver(_, styles) {
|
|
29
|
+
return styles.root;
|
|
30
|
+
}
|
|
31
|
+
})(function (_ref) {
|
|
32
|
+
var theme = _ref.theme;
|
|
33
|
+
return {
|
|
34
|
+
pointerEvents: 'none',
|
|
35
|
+
zIndex: theme.zIndex.modal
|
|
36
|
+
};
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Demos:
|
|
41
|
+
*
|
|
42
|
+
* - [ChartsTooltip](https://mui.com/x/react-charts/tooltip/)
|
|
43
|
+
*
|
|
44
|
+
* API:
|
|
45
|
+
*
|
|
46
|
+
* - [ChartsTooltip API](https://mui.com/x/api/charts/charts-tool-tip/)
|
|
47
|
+
*/
|
|
22
48
|
function ChartsTooltip(props) {
|
|
49
|
+
var _slots$popper, _slots$itemContent, _slots$axisContent;
|
|
23
50
|
var _props$trigger = props.trigger,
|
|
24
51
|
trigger = _props$trigger === void 0 ? 'axis' : _props$trigger,
|
|
25
52
|
itemContent = props.itemContent,
|
|
26
|
-
axisContent = props.axisContent
|
|
53
|
+
axisContent = props.axisContent,
|
|
54
|
+
slots = props.slots,
|
|
55
|
+
slotProps = props.slotProps;
|
|
27
56
|
var mousePosition = useMouseTracker();
|
|
28
57
|
var _React$useContext = React.useContext(InteractionContext),
|
|
29
58
|
item = _React$useContext.item,
|
|
@@ -34,33 +63,40 @@ function ChartsTooltip(props) {
|
|
|
34
63
|
var classes = useUtilityClasses({
|
|
35
64
|
classes: props.classes
|
|
36
65
|
});
|
|
66
|
+
var PopperComponent = (_slots$popper = slots == null ? void 0 : slots.popper) != null ? _slots$popper : ChartsTooltipRoot;
|
|
67
|
+
var popperProps = useSlotProps({
|
|
68
|
+
elementType: PopperComponent,
|
|
69
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.popper,
|
|
70
|
+
additionalProps: {
|
|
71
|
+
open: popperOpen,
|
|
72
|
+
placement: 'right-start',
|
|
73
|
+
anchorEl: generateVirtualElement(mousePosition)
|
|
74
|
+
},
|
|
75
|
+
ownerState: {}
|
|
76
|
+
});
|
|
37
77
|
if (trigger === 'none') {
|
|
38
78
|
return null;
|
|
39
79
|
}
|
|
40
80
|
return /*#__PURE__*/_jsx(NoSsr, {
|
|
41
|
-
children: popperOpen && /*#__PURE__*/_jsx(
|
|
42
|
-
open: popperOpen,
|
|
43
|
-
placement: "right-start",
|
|
44
|
-
anchorEl: generateVirtualElement(mousePosition),
|
|
45
|
-
style: {
|
|
46
|
-
pointerEvents: 'none'
|
|
47
|
-
},
|
|
81
|
+
children: popperOpen && /*#__PURE__*/_jsx(PopperComponent, _extends({}, popperProps, {
|
|
48
82
|
children: trigger === 'item' ? /*#__PURE__*/_jsx(ChartsItemTooltipContent, {
|
|
49
83
|
itemData: displayedData,
|
|
50
|
-
content: itemContent,
|
|
84
|
+
content: (_slots$itemContent = slots == null ? void 0 : slots.itemContent) != null ? _slots$itemContent : itemContent,
|
|
85
|
+
contentProps: slotProps == null ? void 0 : slotProps.itemContent,
|
|
51
86
|
sx: {
|
|
52
87
|
mx: 2
|
|
53
88
|
},
|
|
54
89
|
classes: classes
|
|
55
90
|
}) : /*#__PURE__*/_jsx(ChartsAxisTooltipContent, {
|
|
56
91
|
axisData: displayedData,
|
|
57
|
-
content: axisContent,
|
|
92
|
+
content: (_slots$axisContent = slots == null ? void 0 : slots.axisContent) != null ? _slots$axisContent : axisContent,
|
|
93
|
+
contentProps: slotProps == null ? void 0 : slotProps.axisContent,
|
|
58
94
|
sx: {
|
|
59
95
|
mx: 2
|
|
60
96
|
},
|
|
61
97
|
classes: classes
|
|
62
98
|
})
|
|
63
|
-
})
|
|
99
|
+
}))
|
|
64
100
|
});
|
|
65
101
|
}
|
|
66
102
|
process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
@@ -70,6 +106,7 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
70
106
|
// ----------------------------------------------------------------------
|
|
71
107
|
/**
|
|
72
108
|
* Component to override the tooltip content when triger is set to 'axis'.
|
|
109
|
+
* @deprecated Use slots.axisContent instead
|
|
73
110
|
*/
|
|
74
111
|
axisContent: PropTypes.elementType,
|
|
75
112
|
/**
|
|
@@ -78,8 +115,19 @@ process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
|
78
115
|
classes: PropTypes.object,
|
|
79
116
|
/**
|
|
80
117
|
* Component to override the tooltip content when triger is set to 'item'.
|
|
118
|
+
* @deprecated Use slots.itemContent instead
|
|
81
119
|
*/
|
|
82
120
|
itemContent: PropTypes.elementType,
|
|
121
|
+
/**
|
|
122
|
+
* The props used for each component slot.
|
|
123
|
+
* @default {}
|
|
124
|
+
*/
|
|
125
|
+
slotProps: PropTypes.object,
|
|
126
|
+
/**
|
|
127
|
+
* Overridable component slots.
|
|
128
|
+
* @default {}
|
|
129
|
+
*/
|
|
130
|
+
slots: PropTypes.object,
|
|
83
131
|
/**
|
|
84
132
|
* Select the kind of tooltip to display
|
|
85
133
|
* - 'item': Shows data about the item below the mouse.
|