@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
|
@@ -1,29 +1,37 @@
|
|
|
1
1
|
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
2
|
-
import Box from '@mui/
|
|
3
|
-
import Paper from '@mui/material/Paper';
|
|
2
|
+
import Box from '@mui/system/Box';
|
|
4
3
|
import { styled } from '@mui/material/styles';
|
|
5
4
|
import { tooltipClasses } from './tooltipClasses';
|
|
6
|
-
export var ChartsTooltipPaper = styled(
|
|
5
|
+
export var ChartsTooltipPaper = styled('div', {
|
|
7
6
|
name: 'MuiChartsTooltip',
|
|
8
|
-
slot: '
|
|
9
|
-
})({
|
|
7
|
+
slot: 'Container'
|
|
8
|
+
})(function (_ref) {
|
|
9
|
+
var theme = _ref.theme;
|
|
10
|
+
return {
|
|
11
|
+
backgroundColor: (theme.vars || theme).palette.background.paper,
|
|
12
|
+
color: (theme.vars || theme).palette.text.primary,
|
|
13
|
+
transition: theme.transitions.create('box-shadow'),
|
|
14
|
+
border: "1px solid ".concat((theme.vars || theme).palette.divider),
|
|
15
|
+
borderRadius: theme.shape.borderRadius
|
|
16
|
+
};
|
|
17
|
+
});
|
|
10
18
|
export var ChartsTooltipTable = styled('table', {
|
|
11
19
|
name: 'MuiChartsTooltip',
|
|
12
20
|
slot: 'Table'
|
|
13
|
-
})(function (
|
|
14
|
-
var theme =
|
|
21
|
+
})(function (_ref2) {
|
|
22
|
+
var theme = _ref2.theme;
|
|
15
23
|
return {
|
|
16
24
|
borderSpacing: 0,
|
|
17
25
|
'& thead td': {
|
|
18
|
-
borderBottom: "solid ".concat(theme.palette.divider, " 1px")
|
|
26
|
+
borderBottom: "solid ".concat((theme.vars || theme).palette.divider, " 1px")
|
|
19
27
|
}
|
|
20
28
|
};
|
|
21
29
|
});
|
|
22
30
|
export var ChartsTooltipRow = styled('tr', {
|
|
23
31
|
name: 'MuiChartsTooltip',
|
|
24
32
|
slot: 'Row'
|
|
25
|
-
})(function (
|
|
26
|
-
var theme =
|
|
33
|
+
})(function (_ref3) {
|
|
34
|
+
var theme = _ref3.theme;
|
|
27
35
|
return {
|
|
28
36
|
'tr:first-of-type& td': {
|
|
29
37
|
paddingTop: theme.spacing(1)
|
|
@@ -36,36 +44,36 @@ export var ChartsTooltipRow = styled('tr', {
|
|
|
36
44
|
export var ChartsTooltipCell = styled('td', {
|
|
37
45
|
name: 'MuiChartsTooltip',
|
|
38
46
|
slot: 'Cell'
|
|
39
|
-
})(function (
|
|
40
|
-
var
|
|
41
|
-
var theme =
|
|
42
|
-
return
|
|
47
|
+
})(function (_ref4) {
|
|
48
|
+
var _ref5;
|
|
49
|
+
var theme = _ref4.theme;
|
|
50
|
+
return _ref5 = {
|
|
43
51
|
verticalAlign: 'middle',
|
|
44
|
-
color: theme.palette.text.secondary
|
|
45
|
-
}, _defineProperty(
|
|
52
|
+
color: (theme.vars || theme).palette.text.secondary
|
|
53
|
+
}, _defineProperty(_ref5, "&.".concat(tooltipClasses.labelCell), {
|
|
46
54
|
paddingLeft: theme.spacing(1)
|
|
47
|
-
}), _defineProperty(
|
|
55
|
+
}), _defineProperty(_ref5, "&.".concat(tooltipClasses.valueCell), {
|
|
48
56
|
paddingLeft: theme.spacing(4),
|
|
49
|
-
color: theme.palette.text.primary
|
|
50
|
-
}), _defineProperty(
|
|
57
|
+
color: (theme.vars || theme).palette.text.primary
|
|
58
|
+
}), _defineProperty(_ref5, 'td:first-of-type&', {
|
|
51
59
|
paddingLeft: theme.spacing(2)
|
|
52
|
-
}), _defineProperty(
|
|
60
|
+
}), _defineProperty(_ref5, 'td:last-of-type&', {
|
|
53
61
|
paddingRight: theme.spacing(2)
|
|
54
|
-
}),
|
|
62
|
+
}), _ref5;
|
|
55
63
|
});
|
|
56
64
|
export var ChartsTooltipMark = styled(Box, {
|
|
57
65
|
name: 'MuiChartsTooltip',
|
|
58
66
|
slot: 'Mark'
|
|
59
|
-
})(function (
|
|
60
|
-
var theme =
|
|
61
|
-
ownerState =
|
|
67
|
+
})(function (_ref6) {
|
|
68
|
+
var theme = _ref6.theme,
|
|
69
|
+
ownerState = _ref6.ownerState;
|
|
62
70
|
return {
|
|
63
71
|
width: theme.spacing(1),
|
|
64
72
|
height: theme.spacing(1),
|
|
65
73
|
borderRadius: '50%',
|
|
66
74
|
backgroundColor: ownerState.color,
|
|
67
|
-
borderColor: theme.palette.background.paper,
|
|
68
|
-
border: "solid ".concat(theme.palette.background.paper, " ").concat(theme.spacing(0.25)),
|
|
75
|
+
borderColor: (theme.vars || theme).palette.background.paper,
|
|
76
|
+
border: "solid ".concat((theme.vars || theme).palette.background.paper, " ").concat(theme.spacing(0.25)),
|
|
69
77
|
boxSizing: 'content-box'
|
|
70
78
|
};
|
|
71
79
|
});
|
|
@@ -1,15 +1,20 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
|
+
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
var _excluded = ["scale", "
|
|
4
|
+
var _excluded = ["scale", "tickNumber"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import PropTypes from 'prop-types';
|
|
7
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
6
8
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
9
|
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
8
10
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
11
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
10
12
|
import useTicks from '../hooks/useTicks';
|
|
11
13
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
12
|
-
import {
|
|
14
|
+
import { AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
15
|
+
import { ChartsText, getWordsByLines } from '../internals/components/ChartsText';
|
|
16
|
+
import { getMinXTranslation } from '../internals/geometry';
|
|
17
|
+
import { useMounted } from '../hooks/useMounted';
|
|
13
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
20
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -25,60 +30,162 @@ var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
|
25
30
|
};
|
|
26
31
|
return composeClasses(slots, getAxisUtilityClass, classes);
|
|
27
32
|
};
|
|
33
|
+
function addLabelDimension(xTicks, _ref) {
|
|
34
|
+
var style = _ref.tickLabelStyle,
|
|
35
|
+
tickLabelInterval = _ref.tickLabelInterval,
|
|
36
|
+
isMounted = _ref.isMounted;
|
|
37
|
+
var withDimension = xTicks.map(function (tick) {
|
|
38
|
+
if (!isMounted || tick.formattedValue === undefined) {
|
|
39
|
+
return _extends({}, tick, {
|
|
40
|
+
width: 0,
|
|
41
|
+
height: 0
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
var tickSizes = getWordsByLines({
|
|
45
|
+
style: style,
|
|
46
|
+
needsComputation: true,
|
|
47
|
+
text: tick.formattedValue
|
|
48
|
+
});
|
|
49
|
+
return _extends({}, tick, {
|
|
50
|
+
width: Math.max.apply(Math, _toConsumableArray(tickSizes.map(function (size) {
|
|
51
|
+
return size.width;
|
|
52
|
+
}))),
|
|
53
|
+
height: Math.max(tickSizes.length * tickSizes[0].height)
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
if (typeof tickLabelInterval === 'function') {
|
|
57
|
+
return withDimension.map(function (item, index) {
|
|
58
|
+
return _extends({}, item, {
|
|
59
|
+
skipLabel: !tickLabelInterval(item.value, index)
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
// Filter label to avoid overlap
|
|
65
|
+
var textStart = 0;
|
|
66
|
+
var textEnd = 0;
|
|
67
|
+
return withDimension.map(function (item, labelIndex) {
|
|
68
|
+
var width = item.width,
|
|
69
|
+
offset = item.offset,
|
|
70
|
+
labelOffset = item.labelOffset,
|
|
71
|
+
height = item.height;
|
|
72
|
+
var distance = getMinXTranslation(width, height, style == null ? void 0 : style.angle);
|
|
73
|
+
var textPosition = offset + labelOffset;
|
|
74
|
+
var gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
|
|
75
|
+
|
|
76
|
+
textStart = textPosition - gapRatio * distance / 2;
|
|
77
|
+
if (labelIndex > 0 && textStart < textEnd) {
|
|
78
|
+
// Except for the first label, we skip all label that overlap with the last accepted.
|
|
79
|
+
// Notice that the early return prevents `textEnd` from being updated.
|
|
80
|
+
return _extends({}, item, {
|
|
81
|
+
skipLabel: true
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
textEnd = textPosition + gapRatio * distance / 2;
|
|
85
|
+
return item;
|
|
86
|
+
});
|
|
87
|
+
}
|
|
28
88
|
var defaultProps = {
|
|
29
89
|
position: 'bottom',
|
|
30
90
|
disableLine: false,
|
|
31
91
|
disableTicks: false,
|
|
32
|
-
tickFontSize: 12,
|
|
33
|
-
labelFontSize: 14,
|
|
34
92
|
tickSize: 6
|
|
35
93
|
};
|
|
94
|
+
|
|
95
|
+
/**
|
|
96
|
+
* Demos:
|
|
97
|
+
*
|
|
98
|
+
* - [Axis](https://mui.com/x/react-charts/axis/)
|
|
99
|
+
*
|
|
100
|
+
* API:
|
|
101
|
+
*
|
|
102
|
+
* - [ChartsXAxis API](https://mui.com/x/api/charts/charts-x-axis/)
|
|
103
|
+
*/
|
|
36
104
|
function ChartsXAxis(inProps) {
|
|
37
|
-
var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
|
|
105
|
+
var _props$axisId, _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
|
|
38
106
|
var props = useThemeProps({
|
|
39
107
|
props: _extends({}, defaultProps, inProps),
|
|
40
108
|
name: 'MuiChartsXAxis'
|
|
41
109
|
});
|
|
42
110
|
var _React$useContext = React.useContext(CartesianContext),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
111
|
+
xAxisIds = _React$useContext.xAxisIds;
|
|
112
|
+
var _React$useContext2 = React.useContext(CartesianContext),
|
|
113
|
+
_React$useContext2$xA = _React$useContext2.xAxis[(_props$axisId = props.axisId) != null ? _props$axisId : xAxisIds[0]],
|
|
114
|
+
xScale = _React$useContext2$xA.scale,
|
|
115
|
+
tickNumber = _React$useContext2$xA.tickNumber,
|
|
116
|
+
settings = _objectWithoutProperties(_React$useContext2$xA, _excluded);
|
|
117
|
+
var isMounted = useMounted();
|
|
47
118
|
var defaultizedProps = _extends({}, defaultProps, settings, props);
|
|
48
119
|
var position = defaultizedProps.position,
|
|
49
120
|
disableLine = defaultizedProps.disableLine,
|
|
50
121
|
disableTicks = defaultizedProps.disableTicks,
|
|
51
|
-
|
|
122
|
+
tickLabelStyle = defaultizedProps.tickLabelStyle,
|
|
52
123
|
label = defaultizedProps.label,
|
|
124
|
+
labelStyle = defaultizedProps.labelStyle,
|
|
125
|
+
tickFontSize = defaultizedProps.tickFontSize,
|
|
53
126
|
labelFontSize = defaultizedProps.labelFontSize,
|
|
54
127
|
tickSizeProp = defaultizedProps.tickSize,
|
|
55
128
|
valueFormatter = defaultizedProps.valueFormatter,
|
|
56
129
|
slots = defaultizedProps.slots,
|
|
57
|
-
slotProps = defaultizedProps.slotProps
|
|
130
|
+
slotProps = defaultizedProps.slotProps,
|
|
131
|
+
tickInterval = defaultizedProps.tickInterval,
|
|
132
|
+
tickLabelInterval = defaultizedProps.tickLabelInterval;
|
|
58
133
|
var theme = useTheme();
|
|
59
134
|
var classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
60
135
|
theme: theme
|
|
61
136
|
}));
|
|
62
|
-
var _React$
|
|
63
|
-
left = _React$
|
|
64
|
-
top = _React$
|
|
65
|
-
width = _React$
|
|
66
|
-
height = _React$
|
|
137
|
+
var _React$useContext3 = React.useContext(DrawingContext),
|
|
138
|
+
left = _React$useContext3.left,
|
|
139
|
+
top = _React$useContext3.top,
|
|
140
|
+
width = _React$useContext3.width,
|
|
141
|
+
height = _React$useContext3.height;
|
|
67
142
|
var tickSize = disableTicks ? 4 : tickSizeProp;
|
|
143
|
+
var positionSign = position === 'bottom' ? 1 : -1;
|
|
144
|
+
var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : 'line';
|
|
145
|
+
var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : 'line';
|
|
146
|
+
var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsText;
|
|
147
|
+
var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsText;
|
|
148
|
+
var axisTickLabelProps = useSlotProps({
|
|
149
|
+
elementType: TickLabel,
|
|
150
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
|
|
151
|
+
additionalProps: {
|
|
152
|
+
style: _extends({
|
|
153
|
+
textAnchor: 'middle',
|
|
154
|
+
dominantBaseline: position === 'bottom' ? 'hanging' : 'auto',
|
|
155
|
+
fontSize: tickFontSize != null ? tickFontSize : 12
|
|
156
|
+
}, tickLabelStyle),
|
|
157
|
+
className: classes.tickLabel
|
|
158
|
+
},
|
|
159
|
+
className: classes.tickLabel,
|
|
160
|
+
ownerState: {}
|
|
161
|
+
});
|
|
68
162
|
var xTicks = useTicks({
|
|
69
163
|
scale: xScale,
|
|
70
|
-
|
|
71
|
-
valueFormatter: valueFormatter
|
|
164
|
+
tickNumber: tickNumber,
|
|
165
|
+
valueFormatter: valueFormatter,
|
|
166
|
+
tickInterval: tickInterval
|
|
167
|
+
});
|
|
168
|
+
var xTicksWithDimension = addLabelDimension(xTicks, {
|
|
169
|
+
tickLabelStyle: axisTickLabelProps.style,
|
|
170
|
+
tickLabelInterval: tickLabelInterval,
|
|
171
|
+
isMounted: isMounted
|
|
72
172
|
});
|
|
73
|
-
var positionSigne = position === 'bottom' ? 1 : -1;
|
|
74
173
|
var labelRefPoint = {
|
|
75
174
|
x: left + width / 2,
|
|
76
|
-
y:
|
|
175
|
+
y: positionSign * (tickSize + 22)
|
|
77
176
|
};
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
177
|
+
var axisLabelProps = useSlotProps({
|
|
178
|
+
elementType: Label,
|
|
179
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
|
|
180
|
+
additionalProps: {
|
|
181
|
+
style: _extends({
|
|
182
|
+
fontSize: labelFontSize != null ? labelFontSize : 14,
|
|
183
|
+
textAnchor: 'middle',
|
|
184
|
+
dominantBaseline: position === 'bottom' ? 'hanging' : 'auto'
|
|
185
|
+
}, labelStyle)
|
|
186
|
+
},
|
|
187
|
+
ownerState: {}
|
|
188
|
+
});
|
|
82
189
|
return /*#__PURE__*/_jsxs(AxisRoot, {
|
|
83
190
|
transform: "translate(0, ".concat(position === 'bottom' ? top + height : top, ")"),
|
|
84
191
|
className: classes.root,
|
|
@@ -86,39 +193,32 @@ function ChartsXAxis(inProps) {
|
|
|
86
193
|
x1: xScale.range()[0],
|
|
87
194
|
x2: xScale.range()[1],
|
|
88
195
|
className: classes.line
|
|
89
|
-
}, slotProps == null ? void 0 : slotProps.axisLine)),
|
|
90
|
-
var formattedValue =
|
|
91
|
-
offset =
|
|
92
|
-
labelOffset =
|
|
196
|
+
}, slotProps == null ? void 0 : slotProps.axisLine)), xTicksWithDimension.map(function (_ref2, index) {
|
|
197
|
+
var formattedValue = _ref2.formattedValue,
|
|
198
|
+
offset = _ref2.offset,
|
|
199
|
+
labelOffset = _ref2.labelOffset,
|
|
200
|
+
skipLabel = _ref2.skipLabel;
|
|
93
201
|
var xTickLabel = labelOffset != null ? labelOffset : 0;
|
|
94
|
-
var yTickLabel =
|
|
202
|
+
var yTickLabel = positionSign * (tickSize + 3);
|
|
95
203
|
return /*#__PURE__*/_jsxs("g", {
|
|
96
204
|
transform: "translate(".concat(offset, ", 0)"),
|
|
97
205
|
className: classes.tickContainer,
|
|
98
206
|
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
99
|
-
y2:
|
|
207
|
+
y2: positionSign * tickSize,
|
|
100
208
|
className: classes.tick
|
|
101
|
-
}, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
209
|
+
}, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
102
210
|
x: xTickLabel,
|
|
103
|
-
y: yTickLabel
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
fontSize: tickFontSize
|
|
107
|
-
},
|
|
108
|
-
className: classes.tickLabel
|
|
109
|
-
}, slotProps == null ? void 0 : slotProps.axisTickLabel, {
|
|
110
|
-
children: formattedValue
|
|
211
|
+
y: yTickLabel
|
|
212
|
+
}, axisTickLabelProps, {
|
|
213
|
+
text: formattedValue.toString()
|
|
111
214
|
}))]
|
|
112
215
|
}, index);
|
|
113
|
-
}), label && /*#__PURE__*/_jsx(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
}, slotProps == null ? void 0 : slotProps.axisLabel, {
|
|
120
|
-
children: label
|
|
121
|
-
}))]
|
|
216
|
+
}), label && /*#__PURE__*/_jsx("g", {
|
|
217
|
+
className: classes.label,
|
|
218
|
+
children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
|
|
219
|
+
text: label
|
|
220
|
+
}))
|
|
221
|
+
})]
|
|
122
222
|
});
|
|
123
223
|
}
|
|
124
224
|
process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
@@ -127,9 +227,10 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
127
227
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
128
228
|
// ----------------------------------------------------------------------
|
|
129
229
|
/**
|
|
130
|
-
*
|
|
230
|
+
* The id of the axis to render.
|
|
231
|
+
* If undefined, it will be the first defined axis.
|
|
131
232
|
*/
|
|
132
|
-
axisId: PropTypes.string
|
|
233
|
+
axisId: PropTypes.string,
|
|
133
234
|
/**
|
|
134
235
|
* Override or extend the styles applied to the component.
|
|
135
236
|
*/
|
|
@@ -156,8 +257,13 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
156
257
|
/**
|
|
157
258
|
* The font size of the axis label.
|
|
158
259
|
* @default 14
|
|
260
|
+
* @deprecated Consider using `labelStyle.fontSize` instead.
|
|
159
261
|
*/
|
|
160
262
|
labelFontSize: PropTypes.number,
|
|
263
|
+
/**
|
|
264
|
+
* The style applied to the axis label.
|
|
265
|
+
*/
|
|
266
|
+
labelStyle: PropTypes.object,
|
|
161
267
|
/**
|
|
162
268
|
* Position of the axis.
|
|
163
269
|
*/
|
|
@@ -180,8 +286,28 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
180
286
|
/**
|
|
181
287
|
* The font size of the axis ticks text.
|
|
182
288
|
* @default 12
|
|
289
|
+
* @deprecated Consider using `tickLabelStyle.fontSize` instead.
|
|
183
290
|
*/
|
|
184
291
|
tickFontSize: PropTypes.number,
|
|
292
|
+
/**
|
|
293
|
+
* Defines which ticks are displayed. Its value can be:
|
|
294
|
+
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
295
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
|
|
296
|
+
* - an array containing the values where ticks should be displayed.
|
|
297
|
+
* @default 'auto'
|
|
298
|
+
*/
|
|
299
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
300
|
+
/**
|
|
301
|
+
* Defines which ticks get its label displayed. Its value can be:
|
|
302
|
+
* - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
|
|
303
|
+
* - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
|
|
304
|
+
* @default 'auto'
|
|
305
|
+
*/
|
|
306
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
307
|
+
/**
|
|
308
|
+
* The style applied to ticks text.
|
|
309
|
+
*/
|
|
310
|
+
tickLabelStyle: PropTypes.object,
|
|
185
311
|
/**
|
|
186
312
|
* Maximal step between two ticks.
|
|
187
313
|
* When using time data, the value is assumed to be in ms.
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
var _excluded = ["scale", "
|
|
3
|
+
var _excluded = ["scale", "tickNumber"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
+
import { useSlotProps } from '@mui/base/utils';
|
|
6
7
|
import { unstable_composeClasses as composeClasses } from '@mui/utils';
|
|
7
8
|
import { useThemeProps, useTheme } from '@mui/material/styles';
|
|
8
9
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
10
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
10
11
|
import useTicks from '../hooks/useTicks';
|
|
11
|
-
import {
|
|
12
|
+
import { AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
13
|
+
import { ChartsText } from '../internals/components/ChartsText';
|
|
12
14
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
13
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -33,17 +35,29 @@ var defaultProps = {
|
|
|
33
35
|
labelFontSize: 14,
|
|
34
36
|
tickSize: 6
|
|
35
37
|
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Demos:
|
|
41
|
+
*
|
|
42
|
+
* - [Axis](https://mui.com/x/react-charts/axis/)
|
|
43
|
+
*
|
|
44
|
+
* API:
|
|
45
|
+
*
|
|
46
|
+
* - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
|
|
47
|
+
*/
|
|
36
48
|
function ChartsYAxis(inProps) {
|
|
37
|
-
var _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
|
|
49
|
+
var _props$axisId, _slots$axisLine, _slots$axisTick, _slots$axisTickLabel, _slots$axisLabel;
|
|
38
50
|
var props = useThemeProps({
|
|
39
51
|
props: _extends({}, defaultProps, inProps),
|
|
40
52
|
name: 'MuiChartsYAxis'
|
|
41
53
|
});
|
|
42
54
|
var _React$useContext = React.useContext(CartesianContext),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
55
|
+
yAxisIds = _React$useContext.yAxisIds;
|
|
56
|
+
var _React$useContext2 = React.useContext(CartesianContext),
|
|
57
|
+
_React$useContext2$yA = _React$useContext2.yAxis[(_props$axisId = props.axisId) != null ? _props$axisId : yAxisIds[0]],
|
|
58
|
+
yScale = _React$useContext2$yA.scale,
|
|
59
|
+
tickNumber = _React$useContext2$yA.tickNumber,
|
|
60
|
+
settings = _objectWithoutProperties(_React$useContext2$yA, _excluded);
|
|
47
61
|
var defaultizedProps = _extends({}, defaultProps, settings, props);
|
|
48
62
|
var position = defaultizedProps.position,
|
|
49
63
|
disableLine = defaultizedProps.disableLine,
|
|
@@ -59,26 +73,52 @@ function ChartsYAxis(inProps) {
|
|
|
59
73
|
var classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
60
74
|
theme: theme
|
|
61
75
|
}));
|
|
62
|
-
var _React$
|
|
63
|
-
left = _React$
|
|
64
|
-
top = _React$
|
|
65
|
-
width = _React$
|
|
66
|
-
height = _React$
|
|
76
|
+
var _React$useContext3 = React.useContext(DrawingContext),
|
|
77
|
+
left = _React$useContext3.left,
|
|
78
|
+
top = _React$useContext3.top,
|
|
79
|
+
width = _React$useContext3.width,
|
|
80
|
+
height = _React$useContext3.height;
|
|
67
81
|
var tickSize = disableTicks ? 4 : tickSizeProp;
|
|
68
82
|
var yTicks = useTicks({
|
|
69
83
|
scale: yScale,
|
|
70
|
-
|
|
84
|
+
tickNumber: tickNumber,
|
|
71
85
|
valueFormatter: valueFormatter
|
|
72
86
|
});
|
|
73
|
-
var
|
|
87
|
+
var positionSign = position === 'right' ? 1 : -1;
|
|
74
88
|
var labelRefPoint = {
|
|
75
|
-
x:
|
|
89
|
+
x: positionSign * (tickFontSize + tickSize + 10),
|
|
76
90
|
y: top + height / 2
|
|
77
91
|
};
|
|
78
|
-
var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine :
|
|
79
|
-
var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick :
|
|
80
|
-
var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel :
|
|
81
|
-
var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel :
|
|
92
|
+
var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : 'line';
|
|
93
|
+
var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : 'line';
|
|
94
|
+
var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsText;
|
|
95
|
+
var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsText;
|
|
96
|
+
var axisTickLabelProps = useSlotProps({
|
|
97
|
+
elementType: TickLabel,
|
|
98
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
|
|
99
|
+
additionalProps: {
|
|
100
|
+
style: {
|
|
101
|
+
fontSize: tickFontSize,
|
|
102
|
+
textAnchor: position === 'right' ? 'start' : 'end',
|
|
103
|
+
dominantBaseline: 'central'
|
|
104
|
+
},
|
|
105
|
+
className: classes.tickLabel
|
|
106
|
+
},
|
|
107
|
+
ownerState: {}
|
|
108
|
+
});
|
|
109
|
+
var axisLabelProps = useSlotProps({
|
|
110
|
+
elementType: Label,
|
|
111
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
|
|
112
|
+
additionalProps: {
|
|
113
|
+
style: {
|
|
114
|
+
fontSize: labelFontSize,
|
|
115
|
+
angle: positionSign * 90,
|
|
116
|
+
textAnchor: 'middle',
|
|
117
|
+
dominantBaseline: 'auto'
|
|
118
|
+
}
|
|
119
|
+
},
|
|
120
|
+
ownerState: {}
|
|
121
|
+
});
|
|
82
122
|
return /*#__PURE__*/_jsxs(AxisRoot, {
|
|
83
123
|
transform: "translate(".concat(position === 'right' ? left + width : left, ", 0)"),
|
|
84
124
|
className: classes.root,
|
|
@@ -90,36 +130,26 @@ function ChartsYAxis(inProps) {
|
|
|
90
130
|
var formattedValue = _ref.formattedValue,
|
|
91
131
|
offset = _ref.offset,
|
|
92
132
|
labelOffset = _ref.labelOffset;
|
|
93
|
-
var xTickLabel =
|
|
133
|
+
var xTickLabel = positionSign * (tickSize + 2);
|
|
94
134
|
var yTickLabel = labelOffset;
|
|
95
135
|
return /*#__PURE__*/_jsxs("g", {
|
|
96
136
|
transform: "translate(0, ".concat(offset, ")"),
|
|
97
137
|
className: classes.tickContainer,
|
|
98
138
|
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
99
|
-
x2:
|
|
139
|
+
x2: positionSign * tickSize,
|
|
100
140
|
className: classes.tick
|
|
101
141
|
}, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
102
142
|
x: xTickLabel,
|
|
103
143
|
y: yTickLabel,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
fontSize: tickFontSize
|
|
107
|
-
},
|
|
108
|
-
className: classes.tickLabel
|
|
109
|
-
}, slotProps == null ? void 0 : slotProps.axisTickLabel, {
|
|
110
|
-
children: formattedValue.toLocaleString()
|
|
111
|
-
}))]
|
|
144
|
+
text: formattedValue.toString()
|
|
145
|
+
}, axisTickLabelProps))]
|
|
112
146
|
}, index);
|
|
113
|
-
}), label && /*#__PURE__*/_jsx(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
className: classes.label
|
|
120
|
-
}, slotProps == null ? void 0 : slotProps.axisLabel, {
|
|
121
|
-
children: label
|
|
122
|
-
}))]
|
|
147
|
+
}), label && /*#__PURE__*/_jsx("g", {
|
|
148
|
+
className: classes.label,
|
|
149
|
+
children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
|
|
150
|
+
text: label
|
|
151
|
+
}))
|
|
152
|
+
})]
|
|
123
153
|
});
|
|
124
154
|
}
|
|
125
155
|
process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
@@ -128,9 +158,10 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
128
158
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
129
159
|
// ----------------------------------------------------------------------
|
|
130
160
|
/**
|
|
131
|
-
*
|
|
161
|
+
* The id of the axis to render.
|
|
162
|
+
* If undefined, it will be the first defined axis.
|
|
132
163
|
*/
|
|
133
|
-
axisId: PropTypes.string
|
|
164
|
+
axisId: PropTypes.string,
|
|
134
165
|
/**
|
|
135
166
|
* Override or extend the styles applied to the component.
|
|
136
167
|
*/
|
|
@@ -157,8 +188,13 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
157
188
|
/**
|
|
158
189
|
* The font size of the axis label.
|
|
159
190
|
* @default 14
|
|
191
|
+
* @deprecated Consider using `labelStyle.fontSize` instead.
|
|
160
192
|
*/
|
|
161
193
|
labelFontSize: PropTypes.number,
|
|
194
|
+
/**
|
|
195
|
+
* The style applied to the axis label.
|
|
196
|
+
*/
|
|
197
|
+
labelStyle: PropTypes.object,
|
|
162
198
|
/**
|
|
163
199
|
* Position of the axis.
|
|
164
200
|
*/
|
|
@@ -181,8 +217,28 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
181
217
|
/**
|
|
182
218
|
* The font size of the axis ticks text.
|
|
183
219
|
* @default 12
|
|
220
|
+
* @deprecated Consider using `tickLabelStyle.fontSize` instead.
|
|
184
221
|
*/
|
|
185
222
|
tickFontSize: PropTypes.number,
|
|
223
|
+
/**
|
|
224
|
+
* Defines which ticks are displayed. Its value can be:
|
|
225
|
+
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
226
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
|
|
227
|
+
* - an array containing the values where ticks should be displayed.
|
|
228
|
+
* @default 'auto'
|
|
229
|
+
*/
|
|
230
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
231
|
+
/**
|
|
232
|
+
* Defines which ticks get its label displayed. Its value can be:
|
|
233
|
+
* - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
|
|
234
|
+
* - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
|
|
235
|
+
* @default 'auto'
|
|
236
|
+
*/
|
|
237
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
238
|
+
/**
|
|
239
|
+
* The style applied to ticks text.
|
|
240
|
+
*/
|
|
241
|
+
tickLabelStyle: PropTypes.object,
|
|
186
242
|
/**
|
|
187
243
|
* Maximal step between two ticks.
|
|
188
244
|
* When using time data, the value is assumed to be in ms.
|
|
@@ -56,6 +56,16 @@ AreaElementPath.propTypes = {
|
|
|
56
56
|
}).isRequired,
|
|
57
57
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
58
58
|
};
|
|
59
|
+
/**
|
|
60
|
+
* Demos:
|
|
61
|
+
*
|
|
62
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
63
|
+
* - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
|
|
64
|
+
*
|
|
65
|
+
* API:
|
|
66
|
+
*
|
|
67
|
+
* - [AreaElement API](https://mui.com/x/api/charts/area-element/)
|
|
68
|
+
*/
|
|
59
69
|
function AreaElement(props) {
|
|
60
70
|
var _slots$area;
|
|
61
71
|
var id = props.id,
|