@mui/x-charts 6.0.0-alpha.8 → 6.18.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChart/BarChart.d.ts +19 -5
- package/BarChart/BarChart.js +52 -13
- 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 +786 -48
- package/ChartContainer/index.js +7 -5
- package/ChartsAxis/ChartsAxis.d.ts +9 -0
- package/ChartsAxis/ChartsAxis.js +28 -2
- package/ChartsAxis/axisClasses.d.ts +1 -1
- 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 +44 -24
- package/ChartsLegend/ChartsLegend.js +192 -150
- package/ChartsLegend/chartsLegendClasses.js +1 -2
- package/ChartsLegend/utils.d.ts +1 -6
- package/ChartsSurface.d.ts +1 -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 +161 -40
- package/ChartsYAxis/ChartsYAxis.d.ts +9 -0
- package/ChartsYAxis/ChartsYAxis.js +86 -33
- package/LineChart/AreaElement.d.ts +12 -2
- package/LineChart/AreaElement.js +14 -6
- package/LineChart/AreaPlot.d.ts +11 -0
- package/LineChart/AreaPlot.js +27 -8
- package/LineChart/LineChart.d.ts +21 -3
- package/LineChart/LineChart.js +61 -14
- package/LineChart/LineElement.d.ts +12 -2
- package/LineChart/LineElement.js +14 -6
- package/LineChart/LineHighlightElement.d.ts +31 -0
- package/LineChart/LineHighlightElement.js +88 -0
- package/LineChart/LineHighlightPlot.d.ts +35 -0
- package/LineChart/LineHighlightPlot.js +110 -0
- package/LineChart/LinePlot.d.ts +10 -0
- package/LineChart/LinePlot.js +25 -12
- package/LineChart/MarkElement.d.ts +11 -1
- package/LineChart/MarkElement.js +15 -9
- package/LineChart/MarkPlot.d.ts +10 -0
- package/LineChart/MarkPlot.js +62 -15
- package/LineChart/formatter.js +5 -5
- package/LineChart/index.d.ts +2 -0
- package/LineChart/index.js +20 -0
- package/LineChart/legend.js +1 -2
- package/PieChart/PieArc.d.ts +12 -14
- package/PieChart/PieArc.js +28 -60
- package/PieChart/PieArcLabel.d.ts +9 -10
- 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 +61 -14
- 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.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 +43 -12
- 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 +13 -3
- package/SparkLineChart/SparkLineChart.js +34 -18
- package/colorPalettes/colorPalettes.js +6 -12
- package/constants.js +5 -8
- package/context/CartesianContextProvider.d.ts +5 -0
- package/context/CartesianContextProvider.js +31 -16
- package/context/DrawingProvider.d.ts +7 -0
- package/context/DrawingProvider.js +12 -6
- package/context/HighlightProvider.js +3 -4
- package/context/InteractionProvider.js +3 -4
- package/context/SeriesContextProvider.js +3 -4
- package/esm/BarChart/BarChart.js +49 -9
- 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 +26 -0
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
- package/esm/ChartsClipPath/ChartsClipPath.js +5 -0
- package/esm/ChartsLegend/ChartsLegend.js +188 -142
- 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 +158 -37
- package/esm/ChartsYAxis/ChartsYAxis.js +83 -30
- package/esm/LineChart/AreaElement.js +10 -0
- package/esm/LineChart/AreaPlot.js +26 -6
- package/esm/LineChart/LineChart.js +58 -10
- package/esm/LineChart/LineElement.js +10 -0
- package/esm/LineChart/LineHighlightElement.js +78 -0
- package/esm/LineChart/LineHighlightPlot.js +103 -0
- package/esm/LineChart/LinePlot.js +25 -14
- package/esm/LineChart/MarkElement.js +12 -5
- package/esm/LineChart/MarkPlot.js +60 -13
- package/esm/LineChart/formatter.js +7 -3
- package/esm/LineChart/index.js +3 -1
- 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 +59 -12
- 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 +40 -8
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +32 -15
- package/esm/constants.js +1 -1
- package/esm/context/CartesianContextProvider.js +30 -14
- package/esm/context/DrawingProvider.js +8 -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/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.js +1 -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 +8 -1
- 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/stackSeries.js +2 -4
- package/legacy/BarChart/BarChart.js +49 -9
- 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 +26 -0
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +60 -20
- package/legacy/ChartsClipPath/ChartsClipPath.js +5 -0
- package/legacy/ChartsLegend/ChartsLegend.js +203 -140
- 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 +162 -39
- package/legacy/ChartsYAxis/ChartsYAxis.js +83 -30
- package/legacy/LineChart/AreaElement.js +10 -0
- package/legacy/LineChart/AreaPlot.js +31 -7
- package/legacy/LineChart/LineChart.js +58 -10
- package/legacy/LineChart/LineElement.js +10 -0
- package/legacy/LineChart/LineHighlightElement.js +77 -0
- package/legacy/LineChart/LineHighlightPlot.js +96 -0
- package/legacy/LineChart/LinePlot.js +29 -12
- package/legacy/LineChart/MarkElement.js +12 -5
- package/legacy/LineChart/MarkPlot.js +50 -5
- package/legacy/LineChart/formatter.js +7 -3
- package/legacy/LineChart/index.js +3 -1
- 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 +59 -12
- 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 +40 -8
- package/legacy/ScatterChart/ScatterPlot.js +10 -0
- package/legacy/SparkLineChart/SparkLineChart.js +32 -13
- package/legacy/constants.js +1 -1
- package/legacy/context/CartesianContextProvider.js +30 -14
- package/legacy/context/DrawingProvider.js +8 -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 +1 -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 +27 -9
- package/models/layout.d.ts +7 -6
- package/models/seriesType/line.d.ts +39 -1
- package/models/seriesType/pie.d.ts +5 -1
- package/modern/BarChart/BarChart.js +49 -9
- 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 +26 -0
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +57 -20
- package/modern/ChartsClipPath/ChartsClipPath.js +5 -0
- package/modern/ChartsLegend/ChartsLegend.js +188 -142
- 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 +158 -37
- package/modern/ChartsYAxis/ChartsYAxis.js +83 -30
- package/modern/LineChart/AreaElement.js +10 -0
- package/modern/LineChart/AreaPlot.js +25 -6
- package/modern/LineChart/LineChart.js +58 -10
- package/modern/LineChart/LineElement.js +10 -0
- package/modern/LineChart/LineHighlightElement.js +78 -0
- package/modern/LineChart/LineHighlightPlot.js +102 -0
- package/modern/LineChart/LinePlot.js +23 -10
- package/modern/LineChart/MarkElement.js +12 -5
- package/modern/LineChart/MarkPlot.js +60 -13
- package/modern/LineChart/formatter.js +4 -3
- package/modern/LineChart/index.js +3 -1
- 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 +59 -12
- 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 +40 -8
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +32 -15
- package/modern/constants.js +1 -1
- package/modern/context/CartesianContextProvider.js +29 -13
- package/modern/context/DrawingProvider.js +8 -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 +1 -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
|
@@ -9,17 +9,21 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _utils = require("@mui/utils");
|
|
12
|
+
var _utils = require("@mui/base/utils");
|
|
13
|
+
var _utils2 = require("@mui/utils");
|
|
13
14
|
var _styles = require("@mui/material/styles");
|
|
14
15
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
15
16
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
16
17
|
var _useTicks = _interopRequireDefault(require("../hooks/useTicks"));
|
|
17
18
|
var _axisClasses = require("../ChartsAxis/axisClasses");
|
|
18
19
|
var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
|
|
20
|
+
var _ChartsText = require("../internals/components/ChartsText");
|
|
21
|
+
var _geometry = require("../internals/geometry");
|
|
22
|
+
var _useMounted = require("../hooks/useMounted");
|
|
19
23
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["scale", "
|
|
21
|
-
function _getRequireWildcardCache(
|
|
22
|
-
function _interopRequireWildcard(
|
|
24
|
+
const _excluded = ["scale", "tickNumber"];
|
|
25
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
26
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
27
|
const useUtilityClasses = ownerState => {
|
|
24
28
|
const {
|
|
25
29
|
classes,
|
|
@@ -33,16 +37,78 @@ const useUtilityClasses = ownerState => {
|
|
|
33
37
|
tickLabel: ['tickLabel'],
|
|
34
38
|
label: ['label']
|
|
35
39
|
};
|
|
36
|
-
return (0,
|
|
40
|
+
return (0, _utils2.unstable_composeClasses)(slots, _axisClasses.getAxisUtilityClass, classes);
|
|
37
41
|
};
|
|
42
|
+
function addLabelDimension(xTicks, {
|
|
43
|
+
tickLabelStyle: style,
|
|
44
|
+
tickLabelInterval,
|
|
45
|
+
isMounted
|
|
46
|
+
}) {
|
|
47
|
+
const withDimension = xTicks.map(tick => {
|
|
48
|
+
if (!isMounted || tick.formattedValue === undefined) {
|
|
49
|
+
return (0, _extends2.default)({}, tick, {
|
|
50
|
+
width: 0,
|
|
51
|
+
height: 0
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
const tickSizes = (0, _ChartsText.getWordsByLines)({
|
|
55
|
+
style,
|
|
56
|
+
needsComputation: true,
|
|
57
|
+
text: tick.formattedValue
|
|
58
|
+
});
|
|
59
|
+
return (0, _extends2.default)({}, tick, {
|
|
60
|
+
width: Math.max(...tickSizes.map(size => size.width)),
|
|
61
|
+
height: Math.max(tickSizes.length * tickSizes[0].height)
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
if (typeof tickLabelInterval === 'function') {
|
|
65
|
+
return withDimension.map((item, index) => (0, _extends2.default)({}, item, {
|
|
66
|
+
skipLabel: !tickLabelInterval(item.value, index)
|
|
67
|
+
}));
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Filter label to avoid overlap
|
|
71
|
+
let textStart = 0;
|
|
72
|
+
let textEnd = 0;
|
|
73
|
+
return withDimension.map((item, labelIndex) => {
|
|
74
|
+
const {
|
|
75
|
+
width,
|
|
76
|
+
offset,
|
|
77
|
+
labelOffset,
|
|
78
|
+
height
|
|
79
|
+
} = item;
|
|
80
|
+
const distance = (0, _geometry.getMinXTranslation)(width, height, style?.angle);
|
|
81
|
+
const textPosition = offset + labelOffset;
|
|
82
|
+
const gapRatio = 1.2; // Ratio applied to the minimal distance to add some margin.
|
|
83
|
+
|
|
84
|
+
textStart = textPosition - gapRatio * distance / 2;
|
|
85
|
+
if (labelIndex > 0 && textStart < textEnd) {
|
|
86
|
+
// Except for the first label, we skip all label that overlap with the last accepted.
|
|
87
|
+
// Notice that the early return prevents `textEnd` from being updated.
|
|
88
|
+
return (0, _extends2.default)({}, item, {
|
|
89
|
+
skipLabel: true
|
|
90
|
+
});
|
|
91
|
+
}
|
|
92
|
+
textEnd = textPosition + gapRatio * distance / 2;
|
|
93
|
+
return item;
|
|
94
|
+
});
|
|
95
|
+
}
|
|
38
96
|
const defaultProps = {
|
|
39
97
|
position: 'bottom',
|
|
40
98
|
disableLine: false,
|
|
41
99
|
disableTicks: false,
|
|
42
|
-
tickFontSize: 12,
|
|
43
|
-
labelFontSize: 14,
|
|
44
100
|
tickSize: 6
|
|
45
101
|
};
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* Demos:
|
|
105
|
+
*
|
|
106
|
+
* - [Axis](https://mui.com/x/react-charts/axis/)
|
|
107
|
+
*
|
|
108
|
+
* API:
|
|
109
|
+
*
|
|
110
|
+
* - [ChartsXAxis API](https://mui.com/x/api/charts/charts-x-axis/)
|
|
111
|
+
*/
|
|
46
112
|
function ChartsXAxis(inProps) {
|
|
47
113
|
const props = (0, _styles.useThemeProps)({
|
|
48
114
|
props: (0, _extends2.default)({}, defaultProps, inProps),
|
|
@@ -54,23 +120,28 @@ function ChartsXAxis(inProps) {
|
|
|
54
120
|
xAxis: {
|
|
55
121
|
[_props$axisId]: {
|
|
56
122
|
scale: xScale,
|
|
57
|
-
|
|
123
|
+
tickNumber
|
|
58
124
|
}
|
|
59
125
|
}
|
|
60
126
|
} = _React$useContext,
|
|
61
127
|
settings = (0, _objectWithoutPropertiesLoose2.default)(_React$useContext.xAxis[_props$axisId], _excluded);
|
|
128
|
+
const isMounted = (0, _useMounted.useMounted)();
|
|
62
129
|
const defaultizedProps = (0, _extends2.default)({}, defaultProps, settings, props);
|
|
63
130
|
const {
|
|
64
131
|
position,
|
|
65
132
|
disableLine,
|
|
66
133
|
disableTicks,
|
|
67
|
-
|
|
134
|
+
tickLabelStyle,
|
|
68
135
|
label,
|
|
136
|
+
labelStyle,
|
|
137
|
+
tickFontSize,
|
|
69
138
|
labelFontSize,
|
|
70
139
|
tickSize: tickSizeProp,
|
|
71
140
|
valueFormatter,
|
|
72
141
|
slots,
|
|
73
|
-
slotProps
|
|
142
|
+
slotProps,
|
|
143
|
+
tickInterval,
|
|
144
|
+
tickLabelInterval
|
|
74
145
|
} = defaultizedProps;
|
|
75
146
|
const theme = (0, _styles.useTheme)();
|
|
76
147
|
const classes = useUtilityClasses((0, _extends2.default)({}, defaultizedProps, {
|
|
@@ -83,20 +154,52 @@ function ChartsXAxis(inProps) {
|
|
|
83
154
|
height
|
|
84
155
|
} = React.useContext(_DrawingProvider.DrawingContext);
|
|
85
156
|
const tickSize = disableTicks ? 4 : tickSizeProp;
|
|
157
|
+
const positionSign = position === 'bottom' ? 1 : -1;
|
|
158
|
+
const Line = slots?.axisLine ?? 'line';
|
|
159
|
+
const Tick = slots?.axisTick ?? 'line';
|
|
160
|
+
const TickLabel = slots?.axisTickLabel ?? _ChartsText.ChartsText;
|
|
161
|
+
const Label = slots?.axisLabel ?? _ChartsText.ChartsText;
|
|
162
|
+
const axisTickLabelProps = (0, _utils.useSlotProps)({
|
|
163
|
+
elementType: TickLabel,
|
|
164
|
+
externalSlotProps: slotProps?.axisTickLabel,
|
|
165
|
+
additionalProps: {
|
|
166
|
+
style: (0, _extends2.default)({
|
|
167
|
+
textAnchor: 'middle',
|
|
168
|
+
dominantBaseline: position === 'bottom' ? 'hanging' : 'auto',
|
|
169
|
+
fontSize: tickFontSize ?? 12
|
|
170
|
+
}, tickLabelStyle),
|
|
171
|
+
className: classes.tickLabel
|
|
172
|
+
},
|
|
173
|
+
className: classes.tickLabel,
|
|
174
|
+
ownerState: {}
|
|
175
|
+
});
|
|
86
176
|
const xTicks = (0, _useTicks.default)({
|
|
87
177
|
scale: xScale,
|
|
88
|
-
|
|
89
|
-
valueFormatter
|
|
178
|
+
tickNumber,
|
|
179
|
+
valueFormatter,
|
|
180
|
+
tickInterval
|
|
181
|
+
});
|
|
182
|
+
const xTicksWithDimension = addLabelDimension(xTicks, {
|
|
183
|
+
tickLabelStyle: axisTickLabelProps.style,
|
|
184
|
+
tickLabelInterval,
|
|
185
|
+
isMounted
|
|
90
186
|
});
|
|
91
|
-
const positionSigne = position === 'bottom' ? 1 : -1;
|
|
92
187
|
const labelRefPoint = {
|
|
93
188
|
x: left + width / 2,
|
|
94
|
-
y:
|
|
189
|
+
y: positionSign * (tickSize + 22)
|
|
95
190
|
};
|
|
96
|
-
const
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
191
|
+
const axisLabelProps = (0, _utils.useSlotProps)({
|
|
192
|
+
elementType: Label,
|
|
193
|
+
externalSlotProps: slotProps?.axisLabel,
|
|
194
|
+
additionalProps: {
|
|
195
|
+
style: (0, _extends2.default)({
|
|
196
|
+
fontSize: labelFontSize ?? 14,
|
|
197
|
+
textAnchor: 'middle',
|
|
198
|
+
dominantBaseline: position === 'bottom' ? 'hanging' : 'auto'
|
|
199
|
+
}, labelStyle)
|
|
200
|
+
},
|
|
201
|
+
ownerState: {}
|
|
202
|
+
});
|
|
100
203
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AxisSharedComponents.AxisRoot, {
|
|
101
204
|
transform: `translate(0, ${position === 'bottom' ? top + height : top})`,
|
|
102
205
|
className: classes.root,
|
|
@@ -104,40 +207,33 @@ function ChartsXAxis(inProps) {
|
|
|
104
207
|
x1: xScale.range()[0],
|
|
105
208
|
x2: xScale.range()[1],
|
|
106
209
|
className: classes.line
|
|
107
|
-
}, slotProps?.axisLine)),
|
|
210
|
+
}, slotProps?.axisLine)), xTicksWithDimension.map(({
|
|
108
211
|
formattedValue,
|
|
109
212
|
offset,
|
|
110
|
-
labelOffset
|
|
213
|
+
labelOffset,
|
|
214
|
+
skipLabel
|
|
111
215
|
}, index) => {
|
|
112
216
|
const xTickLabel = labelOffset ?? 0;
|
|
113
|
-
const yTickLabel =
|
|
217
|
+
const yTickLabel = positionSign * (tickSize + 3);
|
|
114
218
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
115
219
|
transform: `translate(${offset}, 0)`,
|
|
116
220
|
className: classes.tickContainer,
|
|
117
221
|
children: [!disableTicks && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tick, (0, _extends2.default)({
|
|
118
|
-
y2:
|
|
222
|
+
y2: positionSign * tickSize,
|
|
119
223
|
className: classes.tick
|
|
120
|
-
}, slotProps?.axisTick)), formattedValue !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
|
|
224
|
+
}, slotProps?.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
|
|
121
225
|
x: xTickLabel,
|
|
122
|
-
y: yTickLabel
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
fontSize: tickFontSize
|
|
126
|
-
},
|
|
127
|
-
className: classes.tickLabel
|
|
128
|
-
}, slotProps?.axisTickLabel, {
|
|
129
|
-
children: formattedValue
|
|
226
|
+
y: yTickLabel
|
|
227
|
+
}, axisTickLabelProps, {
|
|
228
|
+
text: formattedValue.toString()
|
|
130
229
|
}))]
|
|
131
230
|
}, index);
|
|
132
|
-
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
}, slotProps?.axisLabel, {
|
|
139
|
-
children: label
|
|
140
|
-
}))]
|
|
231
|
+
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
232
|
+
className: classes.label,
|
|
233
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, (0, _extends2.default)({}, labelRefPoint, axisLabelProps, {
|
|
234
|
+
text: label
|
|
235
|
+
}))
|
|
236
|
+
})]
|
|
141
237
|
});
|
|
142
238
|
}
|
|
143
239
|
process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
@@ -175,8 +271,13 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
175
271
|
/**
|
|
176
272
|
* The font size of the axis label.
|
|
177
273
|
* @default 14
|
|
274
|
+
* @deprecated Consider using `labelStyle.fontSize` instead.
|
|
178
275
|
*/
|
|
179
276
|
labelFontSize: _propTypes.default.number,
|
|
277
|
+
/**
|
|
278
|
+
* The style applied to the axis label.
|
|
279
|
+
*/
|
|
280
|
+
labelStyle: _propTypes.default.object,
|
|
180
281
|
/**
|
|
181
282
|
* Position of the axis.
|
|
182
283
|
*/
|
|
@@ -199,8 +300,28 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
199
300
|
/**
|
|
200
301
|
* The font size of the axis ticks text.
|
|
201
302
|
* @default 12
|
|
303
|
+
* @deprecated Consider using `tickLabelStyle.fontSize` instead.
|
|
202
304
|
*/
|
|
203
305
|
tickFontSize: _propTypes.default.number,
|
|
306
|
+
/**
|
|
307
|
+
* Defines which ticks are displayed. Its value can be:
|
|
308
|
+
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
309
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
|
|
310
|
+
* - an array containing the values where ticks should be displayed.
|
|
311
|
+
* @default 'auto'
|
|
312
|
+
*/
|
|
313
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
314
|
+
/**
|
|
315
|
+
* Defines which ticks get its label displayed. Its value can be:
|
|
316
|
+
* - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
|
|
317
|
+
* - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
|
|
318
|
+
* @default 'auto'
|
|
319
|
+
*/
|
|
320
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
321
|
+
/**
|
|
322
|
+
* The style applied to ticks text.
|
|
323
|
+
*/
|
|
324
|
+
tickLabelStyle: _propTypes.default.object,
|
|
204
325
|
/**
|
|
205
326
|
* Maximal step between two ticks.
|
|
206
327
|
* When using time data, the value is assumed to be in ms.
|
|
@@ -1,5 +1,14 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { ChartsYAxisProps } from '../models/axis';
|
|
3
|
+
/**
|
|
4
|
+
* Demos:
|
|
5
|
+
*
|
|
6
|
+
* - [Axis](https://mui.com/x/react-charts/axis/)
|
|
7
|
+
*
|
|
8
|
+
* API:
|
|
9
|
+
*
|
|
10
|
+
* - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
|
|
11
|
+
*/
|
|
3
12
|
declare function ChartsYAxis(inProps: ChartsYAxisProps): React.JSX.Element;
|
|
4
13
|
declare namespace ChartsYAxis {
|
|
5
14
|
var propTypes: any;
|
|
@@ -9,17 +9,19 @@ var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runt
|
|
|
9
9
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
10
|
var React = _interopRequireWildcard(require("react"));
|
|
11
11
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
-
var _utils = require("@mui/utils");
|
|
12
|
+
var _utils = require("@mui/base/utils");
|
|
13
|
+
var _utils2 = require("@mui/utils");
|
|
13
14
|
var _styles = require("@mui/material/styles");
|
|
14
15
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
15
16
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
16
17
|
var _useTicks = _interopRequireDefault(require("../hooks/useTicks"));
|
|
17
18
|
var _AxisSharedComponents = require("../internals/components/AxisSharedComponents");
|
|
19
|
+
var _ChartsText = require("../internals/components/ChartsText");
|
|
18
20
|
var _axisClasses = require("../ChartsAxis/axisClasses");
|
|
19
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
|
-
const _excluded = ["scale", "
|
|
21
|
-
function _getRequireWildcardCache(
|
|
22
|
-
function _interopRequireWildcard(
|
|
22
|
+
const _excluded = ["scale", "tickNumber"];
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
23
25
|
const useUtilityClasses = ownerState => {
|
|
24
26
|
const {
|
|
25
27
|
classes,
|
|
@@ -33,7 +35,7 @@ const useUtilityClasses = ownerState => {
|
|
|
33
35
|
tickLabel: ['tickLabel'],
|
|
34
36
|
label: ['label']
|
|
35
37
|
};
|
|
36
|
-
return (0,
|
|
38
|
+
return (0, _utils2.unstable_composeClasses)(slots, _axisClasses.getAxisUtilityClass, classes);
|
|
37
39
|
};
|
|
38
40
|
const defaultProps = {
|
|
39
41
|
position: 'left',
|
|
@@ -43,6 +45,16 @@ const defaultProps = {
|
|
|
43
45
|
labelFontSize: 14,
|
|
44
46
|
tickSize: 6
|
|
45
47
|
};
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Demos:
|
|
51
|
+
*
|
|
52
|
+
* - [Axis](https://mui.com/x/react-charts/axis/)
|
|
53
|
+
*
|
|
54
|
+
* API:
|
|
55
|
+
*
|
|
56
|
+
* - [ChartsYAxis API](https://mui.com/x/api/charts/charts-y-axis/)
|
|
57
|
+
*/
|
|
46
58
|
function ChartsYAxis(inProps) {
|
|
47
59
|
const props = (0, _styles.useThemeProps)({
|
|
48
60
|
props: (0, _extends2.default)({}, defaultProps, inProps),
|
|
@@ -54,7 +66,7 @@ function ChartsYAxis(inProps) {
|
|
|
54
66
|
yAxis: {
|
|
55
67
|
[_props$axisId]: {
|
|
56
68
|
scale: yScale,
|
|
57
|
-
|
|
69
|
+
tickNumber
|
|
58
70
|
}
|
|
59
71
|
}
|
|
60
72
|
} = _React$useContext,
|
|
@@ -85,18 +97,44 @@ function ChartsYAxis(inProps) {
|
|
|
85
97
|
const tickSize = disableTicks ? 4 : tickSizeProp;
|
|
86
98
|
const yTicks = (0, _useTicks.default)({
|
|
87
99
|
scale: yScale,
|
|
88
|
-
|
|
100
|
+
tickNumber,
|
|
89
101
|
valueFormatter
|
|
90
102
|
});
|
|
91
|
-
const
|
|
103
|
+
const positionSign = position === 'right' ? 1 : -1;
|
|
92
104
|
const labelRefPoint = {
|
|
93
|
-
x:
|
|
105
|
+
x: positionSign * (tickFontSize + tickSize + 10),
|
|
94
106
|
y: top + height / 2
|
|
95
107
|
};
|
|
96
|
-
const Line = slots?.axisLine ??
|
|
97
|
-
const Tick = slots?.axisTick ??
|
|
98
|
-
const TickLabel = slots?.axisTickLabel ??
|
|
99
|
-
const Label = slots?.axisLabel ??
|
|
108
|
+
const Line = slots?.axisLine ?? 'line';
|
|
109
|
+
const Tick = slots?.axisTick ?? 'line';
|
|
110
|
+
const TickLabel = slots?.axisTickLabel ?? _ChartsText.ChartsText;
|
|
111
|
+
const Label = slots?.axisLabel ?? _ChartsText.ChartsText;
|
|
112
|
+
const axisTickLabelProps = (0, _utils.useSlotProps)({
|
|
113
|
+
elementType: TickLabel,
|
|
114
|
+
externalSlotProps: slotProps?.axisTickLabel,
|
|
115
|
+
additionalProps: {
|
|
116
|
+
style: {
|
|
117
|
+
fontSize: tickFontSize,
|
|
118
|
+
textAnchor: position === 'right' ? 'start' : 'end',
|
|
119
|
+
dominantBaseline: 'central'
|
|
120
|
+
},
|
|
121
|
+
className: classes.tickLabel
|
|
122
|
+
},
|
|
123
|
+
ownerState: {}
|
|
124
|
+
});
|
|
125
|
+
const axisLabelProps = (0, _utils.useSlotProps)({
|
|
126
|
+
elementType: Label,
|
|
127
|
+
externalSlotProps: slotProps?.axisLabel,
|
|
128
|
+
additionalProps: {
|
|
129
|
+
style: {
|
|
130
|
+
fontSize: labelFontSize,
|
|
131
|
+
angle: positionSign * 90,
|
|
132
|
+
textAnchor: 'middle',
|
|
133
|
+
dominantBaseline: 'auto'
|
|
134
|
+
}
|
|
135
|
+
},
|
|
136
|
+
ownerState: {}
|
|
137
|
+
});
|
|
100
138
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_AxisSharedComponents.AxisRoot, {
|
|
101
139
|
transform: `translate(${position === 'right' ? left + width : left}, 0)`,
|
|
102
140
|
className: classes.root,
|
|
@@ -109,36 +147,26 @@ function ChartsYAxis(inProps) {
|
|
|
109
147
|
offset,
|
|
110
148
|
labelOffset
|
|
111
149
|
}, index) => {
|
|
112
|
-
const xTickLabel =
|
|
150
|
+
const xTickLabel = positionSign * (tickSize + 2);
|
|
113
151
|
const yTickLabel = labelOffset;
|
|
114
152
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
115
153
|
transform: `translate(0, ${offset})`,
|
|
116
154
|
className: classes.tickContainer,
|
|
117
155
|
children: [!disableTicks && /*#__PURE__*/(0, _jsxRuntime.jsx)(Tick, (0, _extends2.default)({
|
|
118
|
-
x2:
|
|
156
|
+
x2: positionSign * tickSize,
|
|
119
157
|
className: classes.tick
|
|
120
158
|
}, slotProps?.axisTick)), formattedValue !== undefined && /*#__PURE__*/(0, _jsxRuntime.jsx)(TickLabel, (0, _extends2.default)({
|
|
121
159
|
x: xTickLabel,
|
|
122
160
|
y: yTickLabel,
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
fontSize: tickFontSize
|
|
126
|
-
},
|
|
127
|
-
className: classes.tickLabel
|
|
128
|
-
}, slotProps?.axisTickLabel, {
|
|
129
|
-
children: formattedValue.toLocaleString()
|
|
130
|
-
}))]
|
|
161
|
+
text: formattedValue.toString()
|
|
162
|
+
}, axisTickLabelProps))]
|
|
131
163
|
}, index);
|
|
132
|
-
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
className: classes.label
|
|
139
|
-
}, slotProps?.axisLabel, {
|
|
140
|
-
children: label
|
|
141
|
-
}))]
|
|
164
|
+
}), label && /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
165
|
+
className: classes.label,
|
|
166
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(Label, (0, _extends2.default)({}, labelRefPoint, axisLabelProps, {
|
|
167
|
+
text: label
|
|
168
|
+
}))
|
|
169
|
+
})]
|
|
142
170
|
});
|
|
143
171
|
}
|
|
144
172
|
process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
@@ -176,8 +204,13 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
176
204
|
/**
|
|
177
205
|
* The font size of the axis label.
|
|
178
206
|
* @default 14
|
|
207
|
+
* @deprecated Consider using `labelStyle.fontSize` instead.
|
|
179
208
|
*/
|
|
180
209
|
labelFontSize: _propTypes.default.number,
|
|
210
|
+
/**
|
|
211
|
+
* The style applied to the axis label.
|
|
212
|
+
*/
|
|
213
|
+
labelStyle: _propTypes.default.object,
|
|
181
214
|
/**
|
|
182
215
|
* Position of the axis.
|
|
183
216
|
*/
|
|
@@ -200,8 +233,28 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
200
233
|
/**
|
|
201
234
|
* The font size of the axis ticks text.
|
|
202
235
|
* @default 12
|
|
236
|
+
* @deprecated Consider using `tickLabelStyle.fontSize` instead.
|
|
203
237
|
*/
|
|
204
238
|
tickFontSize: _propTypes.default.number,
|
|
239
|
+
/**
|
|
240
|
+
* Defines which ticks are displayed. Its value can be:
|
|
241
|
+
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
242
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
|
|
243
|
+
* - an array containing the values where ticks should be displayed.
|
|
244
|
+
* @default 'auto'
|
|
245
|
+
*/
|
|
246
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
247
|
+
/**
|
|
248
|
+
* Defines which ticks get its label displayed. Its value can be:
|
|
249
|
+
* - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
|
|
250
|
+
* - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
|
|
251
|
+
* @default 'auto'
|
|
252
|
+
*/
|
|
253
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
254
|
+
/**
|
|
255
|
+
* The style applied to ticks text.
|
|
256
|
+
*/
|
|
257
|
+
tickLabelStyle: _propTypes.default.object,
|
|
205
258
|
/**
|
|
206
259
|
* Maximal step between two ticks.
|
|
207
260
|
* When using time data, the value is assumed to be in ms.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { SlotComponentProps } from '@mui/base';
|
|
2
|
+
import { SlotComponentProps } from '@mui/base/utils';
|
|
3
3
|
import { HighlightScope } from '../context/HighlightProvider';
|
|
4
4
|
export interface AreaElementClasses {
|
|
5
5
|
/** Styles applied to the root element. */
|
|
@@ -10,7 +10,7 @@ export interface AreaElementClasses {
|
|
|
10
10
|
faded: string;
|
|
11
11
|
}
|
|
12
12
|
export type AreaElementClassKey = keyof AreaElementClasses;
|
|
13
|
-
|
|
13
|
+
interface AreaElementOwnerState {
|
|
14
14
|
id: string;
|
|
15
15
|
color: string;
|
|
16
16
|
isFaded: boolean;
|
|
@@ -43,6 +43,16 @@ export type AreaElementProps = Omit<AreaElementOwnerState, 'isFaded' | 'isHighli
|
|
|
43
43
|
area?: React.ElementType;
|
|
44
44
|
};
|
|
45
45
|
};
|
|
46
|
+
/**
|
|
47
|
+
* Demos:
|
|
48
|
+
*
|
|
49
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
50
|
+
* - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
|
|
51
|
+
*
|
|
52
|
+
* API:
|
|
53
|
+
*
|
|
54
|
+
* - [AreaElement API](https://mui.com/x/api/charts/area-element/)
|
|
55
|
+
*/
|
|
46
56
|
declare function AreaElement(props: AreaElementProps): React.JSX.Element;
|
|
47
57
|
declare namespace AreaElement {
|
|
48
58
|
var propTypes: any;
|
package/LineChart/AreaElement.js
CHANGED
|
@@ -21,13 +21,12 @@ var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
|
21
21
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
22
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
23
|
const _excluded = ["id", "classes", "color", "highlightScope", "slots", "slotProps"];
|
|
24
|
-
function _getRequireWildcardCache(
|
|
25
|
-
function _interopRequireWildcard(
|
|
24
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
25
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
26
26
|
function getAreaElementUtilityClass(slot) {
|
|
27
27
|
return (0, _generateUtilityClass.default)('MuiAreaElement', slot);
|
|
28
28
|
}
|
|
29
|
-
const areaElementClasses = (0, _generateUtilityClasses.default)('MuiAreaElement', ['root', 'highlighted', 'faded']);
|
|
30
|
-
exports.areaElementClasses = areaElementClasses;
|
|
29
|
+
const areaElementClasses = exports.areaElementClasses = (0, _generateUtilityClasses.default)('MuiAreaElement', ['root', 'highlighted', 'faded']);
|
|
31
30
|
const useUtilityClasses = ownerState => {
|
|
32
31
|
const {
|
|
33
32
|
classes,
|
|
@@ -40,7 +39,7 @@ const useUtilityClasses = ownerState => {
|
|
|
40
39
|
};
|
|
41
40
|
return (0, _composeClasses.default)(slots, getAreaElementUtilityClass, classes);
|
|
42
41
|
};
|
|
43
|
-
const AreaElementPath = (0, _styles.styled)('path', {
|
|
42
|
+
const AreaElementPath = exports.AreaElementPath = (0, _styles.styled)('path', {
|
|
44
43
|
name: 'MuiAreaElement',
|
|
45
44
|
slot: 'Root',
|
|
46
45
|
overridesResolver: (_, styles) => styles.root
|
|
@@ -52,7 +51,6 @@ const AreaElementPath = (0, _styles.styled)('path', {
|
|
|
52
51
|
transition: 'opacity 0.2s ease-in, fill 0.2s ease-in',
|
|
53
52
|
opacity: ownerState.isFaded ? 0.3 : 1
|
|
54
53
|
}));
|
|
55
|
-
exports.AreaElementPath = AreaElementPath;
|
|
56
54
|
AreaElementPath.propTypes = {
|
|
57
55
|
// ----------------------------- Warning --------------------------------
|
|
58
56
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -68,6 +66,16 @@ AreaElementPath.propTypes = {
|
|
|
68
66
|
}).isRequired,
|
|
69
67
|
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
70
68
|
};
|
|
69
|
+
/**
|
|
70
|
+
* Demos:
|
|
71
|
+
*
|
|
72
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
73
|
+
* - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
|
|
74
|
+
*
|
|
75
|
+
* API:
|
|
76
|
+
*
|
|
77
|
+
* - [AreaElement API](https://mui.com/x/api/charts/area-element/)
|
|
78
|
+
*/
|
|
71
79
|
function AreaElement(props) {
|
|
72
80
|
const {
|
|
73
81
|
id,
|
package/LineChart/AreaPlot.d.ts
CHANGED
|
@@ -8,6 +8,17 @@ export interface AreaPlotSlotComponentProps {
|
|
|
8
8
|
}
|
|
9
9
|
export interface AreaPlotProps extends React.SVGAttributes<SVGSVGElement>, Pick<AreaElementProps, 'slots' | 'slotProps'> {
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Demos:
|
|
13
|
+
*
|
|
14
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
15
|
+
* - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
|
|
16
|
+
* - [Stacking](https://mui.com/x/react-charts/stacking/)
|
|
17
|
+
*
|
|
18
|
+
* API:
|
|
19
|
+
*
|
|
20
|
+
* - [AreaPlot API](https://mui.com/x/api/charts/area-plot/)
|
|
21
|
+
*/
|
|
11
22
|
declare function AreaPlot(props: AreaPlotProps): React.JSX.Element | null;
|
|
12
23
|
declare namespace AreaPlot {
|
|
13
24
|
var propTypes: any;
|