@mui/x-charts 6.0.0-alpha.14 → 6.0.0-alpha.16
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 +16 -2
- package/BarChart/BarChart.js +49 -11
- package/BarChart/BarElement.d.ts +1318 -3
- package/BarChart/BarElement.js +10 -8
- package/BarChart/BarPlot.d.ts +17 -1
- package/BarChart/BarPlot.js +152 -66
- package/CHANGELOG.md +169 -0
- package/ChartContainer/index.js +5 -2
- package/ChartsAxis/ChartsAxis.js +18 -2
- package/ChartsAxis/axisClasses.d.ts +1 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +2 -2
- package/ChartsClipPath/ChartsClipPath.js +2 -2
- package/ChartsLegend/ChartsLegend.d.ts +44 -24
- package/ChartsLegend/ChartsLegend.js +191 -145
- package/ChartsLegend/utils.d.ts +1 -6
- package/ChartsSurface.js +5 -13
- package/ChartsTooltip/ChartsAxisTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsTooltip.js +2 -2
- package/ChartsTooltip/utils.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +151 -40
- package/ChartsYAxis/ChartsYAxis.js +76 -33
- package/LineChart/AreaElement.d.ts +10 -0
- package/LineChart/AreaElement.js +12 -2
- package/LineChart/AreaPlot.d.ts +11 -0
- package/LineChart/AreaPlot.js +13 -2
- package/LineChart/LineChart.d.ts +13 -0
- package/LineChart/LineChart.js +40 -10
- package/LineChart/LineElement.d.ts +10 -0
- package/LineChart/LineElement.js +12 -2
- package/LineChart/LineHighlightElement.d.ts +10 -0
- package/LineChart/LineHighlightElement.js +12 -2
- package/LineChart/LineHighlightPlot.d.ts +10 -0
- package/LineChart/LineHighlightPlot.js +12 -2
- package/LineChart/LinePlot.d.ts +10 -0
- package/LineChart/LinePlot.js +12 -2
- package/LineChart/MarkElement.d.ts +10 -0
- package/LineChart/MarkElement.js +12 -2
- package/LineChart/MarkPlot.d.ts +10 -0
- package/LineChart/MarkPlot.js +12 -2
- package/PieChart/PieArc.js +2 -2
- package/PieChart/PieArcLabel.js +2 -2
- package/PieChart/PieChart.d.ts +13 -0
- package/PieChart/PieChart.js +41 -10
- package/PieChart/PiePlot.d.ts +10 -0
- package/PieChart/PiePlot.js +12 -2
- package/ResponsiveChartContainer/index.js +4 -4
- package/ScatterChart/Scatter.d.ts +10 -0
- package/ScatterChart/Scatter.js +12 -2
- package/ScatterChart/ScatterChart.d.ts +13 -0
- package/ScatterChart/ScatterChart.js +40 -10
- package/ScatterChart/ScatterPlot.d.ts +10 -0
- package/ScatterChart/ScatterPlot.js +12 -2
- package/SparkLineChart/SparkLineChart.d.ts +9 -0
- package/SparkLineChart/SparkLineChart.js +16 -2
- package/constants.js +1 -1
- package/context/CartesianContextProvider.js +20 -12
- package/context/DrawingProvider.d.ts +2 -0
- package/context/DrawingProvider.js +4 -2
- package/context/HighlightProvider.js +2 -2
- package/context/InteractionProvider.js +2 -2
- package/context/SeriesContextProvider.js +2 -2
- package/esm/BarChart/BarChart.js +47 -9
- package/esm/BarChart/BarElement.js +7 -4
- package/esm/BarChart/BarPlot.js +152 -67
- package/esm/ChartContainer/index.js +3 -0
- package/esm/ChartsAxis/ChartsAxis.js +16 -0
- package/esm/ChartsLegend/ChartsLegend.js +188 -142
- package/esm/ChartsSurface.js +3 -11
- package/esm/ChartsXAxis/ChartsXAxis.js +148 -37
- package/esm/ChartsYAxis/ChartsYAxis.js +73 -30
- package/esm/LineChart/AreaElement.js +10 -0
- package/esm/LineChart/AreaPlot.js +11 -0
- package/esm/LineChart/LineChart.js +38 -8
- package/esm/LineChart/LineElement.js +10 -0
- package/esm/LineChart/LineHighlightElement.js +10 -0
- package/esm/LineChart/LineHighlightPlot.js +10 -0
- package/esm/LineChart/LinePlot.js +10 -0
- package/esm/LineChart/MarkElement.js +10 -0
- package/esm/LineChart/MarkPlot.js +10 -0
- package/esm/PieChart/PieChart.js +39 -8
- package/esm/PieChart/PiePlot.js +10 -0
- package/esm/ResponsiveChartContainer/index.js +2 -2
- package/esm/ScatterChart/Scatter.js +10 -0
- package/esm/ScatterChart/ScatterChart.js +38 -8
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +14 -0
- package/esm/constants.js +1 -1
- package/esm/context/CartesianContextProvider.js +19 -11
- package/esm/context/DrawingProvider.js +2 -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 +75 -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 +4 -2
- 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 +18 -12
- package/index.js +1 -1
- package/internals/components/AxisSharedComponents.d.ts +0 -4
- package/internals/components/AxisSharedComponents.js +16 -71
- package/internals/components/ChartsText.d.ts +35 -0
- package/internals/components/ChartsText.js +85 -0
- package/internals/defaultizeColor.d.ts +1 -1
- 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/legacy/BarChart/BarChart.js +47 -9
- package/legacy/BarChart/BarElement.js +6 -3
- package/legacy/BarChart/BarPlot.js +151 -63
- package/legacy/ChartContainer/index.js +3 -0
- package/legacy/ChartsAxis/ChartsAxis.js +16 -0
- package/legacy/ChartsLegend/ChartsLegend.js +203 -140
- package/legacy/ChartsSurface.js +2 -11
- package/legacy/ChartsXAxis/ChartsXAxis.js +152 -39
- package/legacy/ChartsYAxis/ChartsYAxis.js +73 -30
- package/legacy/LineChart/AreaElement.js +10 -0
- package/legacy/LineChart/AreaPlot.js +11 -0
- package/legacy/LineChart/LineChart.js +38 -8
- package/legacy/LineChart/LineElement.js +10 -0
- package/legacy/LineChart/LineHighlightElement.js +10 -0
- package/legacy/LineChart/LineHighlightPlot.js +10 -0
- package/legacy/LineChart/LinePlot.js +10 -0
- package/legacy/LineChart/MarkElement.js +10 -0
- package/legacy/LineChart/MarkPlot.js +10 -0
- package/legacy/PieChart/PieChart.js +39 -8
- package/legacy/PieChart/PiePlot.js +10 -0
- package/legacy/ResponsiveChartContainer/index.js +2 -2
- package/legacy/ScatterChart/Scatter.js +10 -0
- package/legacy/ScatterChart/ScatterChart.js +38 -8
- package/legacy/ScatterChart/ScatterPlot.js +10 -0
- package/legacy/SparkLineChart/SparkLineChart.js +14 -0
- package/legacy/constants.js +1 -1
- package/legacy/context/CartesianContextProvider.js +19 -11
- package/legacy/context/DrawingProvider.js +2 -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 +9 -63
- package/legacy/internals/components/ChartsText.js +77 -0
- package/legacy/internals/domUtils.js +121 -0
- package/legacy/internals/geometry.js +37 -0
- package/models/axis.d.ts +25 -7
- package/models/layout.d.ts +7 -6
- package/models/seriesType/line.d.ts +2 -2
- package/modern/BarChart/BarChart.js +47 -9
- package/modern/BarChart/BarElement.js +7 -4
- package/modern/BarChart/BarPlot.js +149 -65
- package/modern/ChartContainer/index.js +3 -0
- package/modern/ChartsAxis/ChartsAxis.js +16 -0
- package/modern/ChartsLegend/ChartsLegend.js +188 -142
- package/modern/ChartsSurface.js +3 -11
- package/modern/ChartsXAxis/ChartsXAxis.js +148 -37
- package/modern/ChartsYAxis/ChartsYAxis.js +73 -30
- package/modern/LineChart/AreaElement.js +10 -0
- package/modern/LineChart/AreaPlot.js +11 -0
- package/modern/LineChart/LineChart.js +38 -8
- package/modern/LineChart/LineElement.js +10 -0
- package/modern/LineChart/LineHighlightElement.js +10 -0
- package/modern/LineChart/LineHighlightPlot.js +10 -0
- package/modern/LineChart/LinePlot.js +10 -0
- package/modern/LineChart/MarkElement.js +10 -0
- package/modern/LineChart/MarkPlot.js +10 -0
- package/modern/PieChart/PieChart.js +39 -8
- package/modern/PieChart/PiePlot.js +10 -0
- package/modern/ResponsiveChartContainer/index.js +2 -2
- package/modern/ScatterChart/Scatter.js +10 -0
- package/modern/ScatterChart/ScatterChart.js +38 -8
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +14 -0
- package/modern/constants.js +1 -1
- package/modern/context/CartesianContextProvider.js +19 -11
- package/modern/context/DrawingProvider.js +2 -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 +75 -0
- package/modern/internals/domUtils.js +113 -0
- package/modern/internals/geometry.js +36 -0
- package/package.json +5 -3
|
@@ -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,12 +30,65 @@ 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
|
};
|
|
36
94
|
function ChartsXAxis(inProps) {
|
|
@@ -42,19 +100,24 @@ function ChartsXAxis(inProps) {
|
|
|
42
100
|
var _React$useContext = React.useContext(CartesianContext),
|
|
43
101
|
_React$useContext$xAx = _React$useContext.xAxis[props.axisId],
|
|
44
102
|
xScale = _React$useContext$xAx.scale,
|
|
45
|
-
|
|
103
|
+
tickNumber = _React$useContext$xAx.tickNumber,
|
|
46
104
|
settings = _objectWithoutProperties(_React$useContext$xAx, _excluded);
|
|
105
|
+
var isMounted = useMounted();
|
|
47
106
|
var defaultizedProps = _extends({}, defaultProps, settings, props);
|
|
48
107
|
var position = defaultizedProps.position,
|
|
49
108
|
disableLine = defaultizedProps.disableLine,
|
|
50
109
|
disableTicks = defaultizedProps.disableTicks,
|
|
51
|
-
|
|
110
|
+
tickLabelStyle = defaultizedProps.tickLabelStyle,
|
|
52
111
|
label = defaultizedProps.label,
|
|
112
|
+
labelStyle = defaultizedProps.labelStyle,
|
|
113
|
+
tickFontSize = defaultizedProps.tickFontSize,
|
|
53
114
|
labelFontSize = defaultizedProps.labelFontSize,
|
|
54
115
|
tickSizeProp = defaultizedProps.tickSize,
|
|
55
116
|
valueFormatter = defaultizedProps.valueFormatter,
|
|
56
117
|
slots = defaultizedProps.slots,
|
|
57
|
-
slotProps = defaultizedProps.slotProps
|
|
118
|
+
slotProps = defaultizedProps.slotProps,
|
|
119
|
+
tickInterval = defaultizedProps.tickInterval,
|
|
120
|
+
tickLabelInterval = defaultizedProps.tickLabelInterval;
|
|
58
121
|
var theme = useTheme();
|
|
59
122
|
var classes = useUtilityClasses(_extends({}, defaultizedProps, {
|
|
60
123
|
theme: theme
|
|
@@ -65,20 +128,52 @@ function ChartsXAxis(inProps) {
|
|
|
65
128
|
width = _React$useContext2.width,
|
|
66
129
|
height = _React$useContext2.height;
|
|
67
130
|
var tickSize = disableTicks ? 4 : tickSizeProp;
|
|
131
|
+
var positionSign = position === 'bottom' ? 1 : -1;
|
|
132
|
+
var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : 'line';
|
|
133
|
+
var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : 'line';
|
|
134
|
+
var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsText;
|
|
135
|
+
var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsText;
|
|
136
|
+
var axisTickLabelProps = useSlotProps({
|
|
137
|
+
elementType: TickLabel,
|
|
138
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
|
|
139
|
+
additionalProps: {
|
|
140
|
+
style: _extends({
|
|
141
|
+
textAnchor: 'middle',
|
|
142
|
+
dominantBaseline: position === 'bottom' ? 'hanging' : 'auto',
|
|
143
|
+
fontSize: tickFontSize != null ? tickFontSize : 12
|
|
144
|
+
}, tickLabelStyle),
|
|
145
|
+
className: classes.tickLabel
|
|
146
|
+
},
|
|
147
|
+
className: classes.tickLabel,
|
|
148
|
+
ownerState: {}
|
|
149
|
+
});
|
|
68
150
|
var xTicks = useTicks({
|
|
69
151
|
scale: xScale,
|
|
70
|
-
|
|
71
|
-
valueFormatter: valueFormatter
|
|
152
|
+
tickNumber: tickNumber,
|
|
153
|
+
valueFormatter: valueFormatter,
|
|
154
|
+
tickInterval: tickInterval
|
|
155
|
+
});
|
|
156
|
+
var xTicksWithDimension = addLabelDimension(xTicks, {
|
|
157
|
+
tickLabelStyle: axisTickLabelProps.style,
|
|
158
|
+
tickLabelInterval: tickLabelInterval,
|
|
159
|
+
isMounted: isMounted
|
|
72
160
|
});
|
|
73
|
-
var positionSigne = position === 'bottom' ? 1 : -1;
|
|
74
161
|
var labelRefPoint = {
|
|
75
162
|
x: left + width / 2,
|
|
76
|
-
y:
|
|
163
|
+
y: positionSign * (tickSize + 22)
|
|
77
164
|
};
|
|
78
|
-
var
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
165
|
+
var axisLabelProps = useSlotProps({
|
|
166
|
+
elementType: Label,
|
|
167
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
|
|
168
|
+
additionalProps: {
|
|
169
|
+
style: _extends({
|
|
170
|
+
fontSize: labelFontSize != null ? labelFontSize : 14,
|
|
171
|
+
textAnchor: 'middle',
|
|
172
|
+
dominantBaseline: position === 'bottom' ? 'hanging' : 'auto'
|
|
173
|
+
}, labelStyle)
|
|
174
|
+
},
|
|
175
|
+
ownerState: {}
|
|
176
|
+
});
|
|
82
177
|
return /*#__PURE__*/_jsxs(AxisRoot, {
|
|
83
178
|
transform: "translate(0, ".concat(position === 'bottom' ? top + height : top, ")"),
|
|
84
179
|
className: classes.root,
|
|
@@ -86,39 +181,32 @@ function ChartsXAxis(inProps) {
|
|
|
86
181
|
x1: xScale.range()[0],
|
|
87
182
|
x2: xScale.range()[1],
|
|
88
183
|
className: classes.line
|
|
89
|
-
}, slotProps == null ? void 0 : slotProps.axisLine)),
|
|
90
|
-
var formattedValue =
|
|
91
|
-
offset =
|
|
92
|
-
labelOffset =
|
|
184
|
+
}, slotProps == null ? void 0 : slotProps.axisLine)), xTicksWithDimension.map(function (_ref2, index) {
|
|
185
|
+
var formattedValue = _ref2.formattedValue,
|
|
186
|
+
offset = _ref2.offset,
|
|
187
|
+
labelOffset = _ref2.labelOffset,
|
|
188
|
+
skipLabel = _ref2.skipLabel;
|
|
93
189
|
var xTickLabel = labelOffset != null ? labelOffset : 0;
|
|
94
|
-
var yTickLabel =
|
|
190
|
+
var yTickLabel = positionSign * (tickSize + 3);
|
|
95
191
|
return /*#__PURE__*/_jsxs("g", {
|
|
96
192
|
transform: "translate(".concat(offset, ", 0)"),
|
|
97
193
|
className: classes.tickContainer,
|
|
98
194
|
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
99
|
-
y2:
|
|
195
|
+
y2: positionSign * tickSize,
|
|
100
196
|
className: classes.tick
|
|
101
|
-
}, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
197
|
+
}, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && !skipLabel && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
102
198
|
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
|
|
199
|
+
y: yTickLabel
|
|
200
|
+
}, axisTickLabelProps, {
|
|
201
|
+
text: formattedValue.toString()
|
|
111
202
|
}))]
|
|
112
203
|
}, index);
|
|
113
|
-
}), label && /*#__PURE__*/_jsx(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
}
|
|
118
|
-
|
|
119
|
-
}, slotProps == null ? void 0 : slotProps.axisLabel, {
|
|
120
|
-
children: label
|
|
121
|
-
}))]
|
|
204
|
+
}), label && /*#__PURE__*/_jsx("g", {
|
|
205
|
+
className: classes.label,
|
|
206
|
+
children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
|
|
207
|
+
text: label
|
|
208
|
+
}))
|
|
209
|
+
})]
|
|
122
210
|
});
|
|
123
211
|
}
|
|
124
212
|
process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
@@ -156,8 +244,13 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
156
244
|
/**
|
|
157
245
|
* The font size of the axis label.
|
|
158
246
|
* @default 14
|
|
247
|
+
* @deprecated Consider using `labelStyle.fontSize` instead.
|
|
159
248
|
*/
|
|
160
249
|
labelFontSize: PropTypes.number,
|
|
250
|
+
/**
|
|
251
|
+
* The style applied to the axis label.
|
|
252
|
+
*/
|
|
253
|
+
labelStyle: PropTypes.object,
|
|
161
254
|
/**
|
|
162
255
|
* Position of the axis.
|
|
163
256
|
*/
|
|
@@ -180,8 +273,28 @@ process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
|
180
273
|
/**
|
|
181
274
|
* The font size of the axis ticks text.
|
|
182
275
|
* @default 12
|
|
276
|
+
* @deprecated Consider using `tickLabelStyle.fontSize` instead.
|
|
183
277
|
*/
|
|
184
278
|
tickFontSize: PropTypes.number,
|
|
279
|
+
/**
|
|
280
|
+
* Defines which ticks are displayed. Its value can be:
|
|
281
|
+
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
282
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
|
|
283
|
+
* - an array containing the values where ticks should be displayed.
|
|
284
|
+
* @default 'auto'
|
|
285
|
+
*/
|
|
286
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
287
|
+
/**
|
|
288
|
+
* Defines which ticks get its label displayed. Its value can be:
|
|
289
|
+
* - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
|
|
290
|
+
* - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
|
|
291
|
+
* @default 'auto'
|
|
292
|
+
*/
|
|
293
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
294
|
+
/**
|
|
295
|
+
* The style applied to ticks text.
|
|
296
|
+
*/
|
|
297
|
+
tickLabelStyle: PropTypes.object,
|
|
185
298
|
/**
|
|
186
299
|
* Maximal step between two ticks.
|
|
187
300
|
* 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";
|
|
@@ -42,7 +44,7 @@ function ChartsYAxis(inProps) {
|
|
|
42
44
|
var _React$useContext = React.useContext(CartesianContext),
|
|
43
45
|
_React$useContext$yAx = _React$useContext.yAxis[props.axisId],
|
|
44
46
|
yScale = _React$useContext$yAx.scale,
|
|
45
|
-
|
|
47
|
+
tickNumber = _React$useContext$yAx.tickNumber,
|
|
46
48
|
settings = _objectWithoutProperties(_React$useContext$yAx, _excluded);
|
|
47
49
|
var defaultizedProps = _extends({}, defaultProps, settings, props);
|
|
48
50
|
var position = defaultizedProps.position,
|
|
@@ -67,18 +69,44 @@ function ChartsYAxis(inProps) {
|
|
|
67
69
|
var tickSize = disableTicks ? 4 : tickSizeProp;
|
|
68
70
|
var yTicks = useTicks({
|
|
69
71
|
scale: yScale,
|
|
70
|
-
|
|
72
|
+
tickNumber: tickNumber,
|
|
71
73
|
valueFormatter: valueFormatter
|
|
72
74
|
});
|
|
73
|
-
var
|
|
75
|
+
var positionSign = position === 'right' ? 1 : -1;
|
|
74
76
|
var labelRefPoint = {
|
|
75
|
-
x:
|
|
77
|
+
x: positionSign * (tickFontSize + tickSize + 10),
|
|
76
78
|
y: top + height / 2
|
|
77
79
|
};
|
|
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 :
|
|
80
|
+
var Line = (_slots$axisLine = slots == null ? void 0 : slots.axisLine) != null ? _slots$axisLine : 'line';
|
|
81
|
+
var Tick = (_slots$axisTick = slots == null ? void 0 : slots.axisTick) != null ? _slots$axisTick : 'line';
|
|
82
|
+
var TickLabel = (_slots$axisTickLabel = slots == null ? void 0 : slots.axisTickLabel) != null ? _slots$axisTickLabel : ChartsText;
|
|
83
|
+
var Label = (_slots$axisLabel = slots == null ? void 0 : slots.axisLabel) != null ? _slots$axisLabel : ChartsText;
|
|
84
|
+
var axisTickLabelProps = useSlotProps({
|
|
85
|
+
elementType: TickLabel,
|
|
86
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.axisTickLabel,
|
|
87
|
+
additionalProps: {
|
|
88
|
+
style: {
|
|
89
|
+
fontSize: tickFontSize,
|
|
90
|
+
textAnchor: position === 'right' ? 'start' : 'end',
|
|
91
|
+
dominantBaseline: 'central'
|
|
92
|
+
},
|
|
93
|
+
className: classes.tickLabel
|
|
94
|
+
},
|
|
95
|
+
ownerState: {}
|
|
96
|
+
});
|
|
97
|
+
var axisLabelProps = useSlotProps({
|
|
98
|
+
elementType: Label,
|
|
99
|
+
externalSlotProps: slotProps == null ? void 0 : slotProps.axisLabel,
|
|
100
|
+
additionalProps: {
|
|
101
|
+
style: {
|
|
102
|
+
fontSize: labelFontSize,
|
|
103
|
+
angle: positionSign * 90,
|
|
104
|
+
textAnchor: 'middle',
|
|
105
|
+
dominantBaseline: 'auto'
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
ownerState: {}
|
|
109
|
+
});
|
|
82
110
|
return /*#__PURE__*/_jsxs(AxisRoot, {
|
|
83
111
|
transform: "translate(".concat(position === 'right' ? left + width : left, ", 0)"),
|
|
84
112
|
className: classes.root,
|
|
@@ -90,36 +118,26 @@ function ChartsYAxis(inProps) {
|
|
|
90
118
|
var formattedValue = _ref.formattedValue,
|
|
91
119
|
offset = _ref.offset,
|
|
92
120
|
labelOffset = _ref.labelOffset;
|
|
93
|
-
var xTickLabel =
|
|
121
|
+
var xTickLabel = positionSign * (tickSize + 2);
|
|
94
122
|
var yTickLabel = labelOffset;
|
|
95
123
|
return /*#__PURE__*/_jsxs("g", {
|
|
96
124
|
transform: "translate(0, ".concat(offset, ")"),
|
|
97
125
|
className: classes.tickContainer,
|
|
98
126
|
children: [!disableTicks && /*#__PURE__*/_jsx(Tick, _extends({
|
|
99
|
-
x2:
|
|
127
|
+
x2: positionSign * tickSize,
|
|
100
128
|
className: classes.tick
|
|
101
129
|
}, slotProps == null ? void 0 : slotProps.axisTick)), formattedValue !== undefined && /*#__PURE__*/_jsx(TickLabel, _extends({
|
|
102
130
|
x: xTickLabel,
|
|
103
131
|
y: yTickLabel,
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
fontSize: tickFontSize
|
|
107
|
-
},
|
|
108
|
-
className: classes.tickLabel
|
|
109
|
-
}, slotProps == null ? void 0 : slotProps.axisTickLabel, {
|
|
110
|
-
children: formattedValue.toLocaleString()
|
|
111
|
-
}))]
|
|
132
|
+
text: formattedValue.toString()
|
|
133
|
+
}, axisTickLabelProps))]
|
|
112
134
|
}, 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
|
-
}))]
|
|
135
|
+
}), label && /*#__PURE__*/_jsx("g", {
|
|
136
|
+
className: classes.label,
|
|
137
|
+
children: /*#__PURE__*/_jsx(Label, _extends({}, labelRefPoint, axisLabelProps, {
|
|
138
|
+
text: label
|
|
139
|
+
}))
|
|
140
|
+
})]
|
|
123
141
|
});
|
|
124
142
|
}
|
|
125
143
|
process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
@@ -157,8 +175,13 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
157
175
|
/**
|
|
158
176
|
* The font size of the axis label.
|
|
159
177
|
* @default 14
|
|
178
|
+
* @deprecated Consider using `labelStyle.fontSize` instead.
|
|
160
179
|
*/
|
|
161
180
|
labelFontSize: PropTypes.number,
|
|
181
|
+
/**
|
|
182
|
+
* The style applied to the axis label.
|
|
183
|
+
*/
|
|
184
|
+
labelStyle: PropTypes.object,
|
|
162
185
|
/**
|
|
163
186
|
* Position of the axis.
|
|
164
187
|
*/
|
|
@@ -181,8 +204,28 @@ process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
|
181
204
|
/**
|
|
182
205
|
* The font size of the axis ticks text.
|
|
183
206
|
* @default 12
|
|
207
|
+
* @deprecated Consider using `tickLabelStyle.fontSize` instead.
|
|
184
208
|
*/
|
|
185
209
|
tickFontSize: PropTypes.number,
|
|
210
|
+
/**
|
|
211
|
+
* Defines which ticks are displayed. Its value can be:
|
|
212
|
+
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
213
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
|
|
214
|
+
* - an array containing the values where ticks should be displayed.
|
|
215
|
+
* @default 'auto'
|
|
216
|
+
*/
|
|
217
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
218
|
+
/**
|
|
219
|
+
* Defines which ticks get its label displayed. Its value can be:
|
|
220
|
+
* - 'auto' In such case, labels are displayed if they do not overlap with the previous one.
|
|
221
|
+
* - a filtering function of the form (value, index) => boolean. Warning: the index is tick index, not data ones.
|
|
222
|
+
* @default 'auto'
|
|
223
|
+
*/
|
|
224
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
225
|
+
/**
|
|
226
|
+
* The style applied to ticks text.
|
|
227
|
+
*/
|
|
228
|
+
tickLabelStyle: PropTypes.object,
|
|
186
229
|
/**
|
|
187
230
|
* Maximal step between two ticks.
|
|
188
231
|
* 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,
|
|
@@ -10,6 +10,17 @@ import { AreaElement } from './AreaElement';
|
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
11
|
import getCurveFactory from '../internals/getCurve';
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
/**
|
|
14
|
+
* Demos:
|
|
15
|
+
*
|
|
16
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
17
|
+
* - [Areas demonstration](https://mui.com/x/react-charts/areas-demo/)
|
|
18
|
+
* - [Stacking](https://mui.com/x/react-charts/stacking/)
|
|
19
|
+
*
|
|
20
|
+
* API:
|
|
21
|
+
*
|
|
22
|
+
* - [AreaPlot API](https://mui.com/x/api/charts/area-plot/)
|
|
23
|
+
*/
|
|
13
24
|
function AreaPlot(props) {
|
|
14
25
|
var slots = props.slots,
|
|
15
26
|
slotProps = props.slotProps,
|
|
@@ -16,6 +16,16 @@ import { ChartsClipPath } from '../ChartsClipPath';
|
|
|
16
16
|
import { LineHighlightPlot } from './LineHighlightPlot';
|
|
17
17
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
18
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
|
+
/**
|
|
20
|
+
* Demos:
|
|
21
|
+
*
|
|
22
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
23
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
24
|
+
*
|
|
25
|
+
* API:
|
|
26
|
+
*
|
|
27
|
+
* - [LineChart API](https://mui.com/x/api/charts/line-chart/)
|
|
28
|
+
*/
|
|
19
29
|
var LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
20
30
|
var xAxis = props.xAxis,
|
|
21
31
|
yAxis = props.yAxis,
|
|
@@ -125,11 +135,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
125
135
|
fill: PropTypes.string,
|
|
126
136
|
label: PropTypes.string,
|
|
127
137
|
labelFontSize: PropTypes.number,
|
|
138
|
+
labelStyle: PropTypes.object,
|
|
128
139
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
129
140
|
slotProps: PropTypes.object,
|
|
130
141
|
slots: PropTypes.object,
|
|
131
142
|
stroke: PropTypes.string,
|
|
132
143
|
tickFontSize: PropTypes.number,
|
|
144
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
145
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
146
|
+
tickLabelStyle: PropTypes.object,
|
|
133
147
|
tickMaxStep: PropTypes.number,
|
|
134
148
|
tickMinStep: PropTypes.number,
|
|
135
149
|
tickNumber: PropTypes.number,
|
|
@@ -162,33 +176,33 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
162
176
|
fill: PropTypes.string,
|
|
163
177
|
label: PropTypes.string,
|
|
164
178
|
labelFontSize: PropTypes.number,
|
|
179
|
+
labelStyle: PropTypes.object,
|
|
165
180
|
position: PropTypes.oneOf(['left', 'right']),
|
|
166
181
|
slotProps: PropTypes.object,
|
|
167
182
|
slots: PropTypes.object,
|
|
168
183
|
stroke: PropTypes.string,
|
|
169
184
|
tickFontSize: PropTypes.number,
|
|
185
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
186
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
187
|
+
tickLabelStyle: PropTypes.object,
|
|
170
188
|
tickMaxStep: PropTypes.number,
|
|
171
189
|
tickMinStep: PropTypes.number,
|
|
172
190
|
tickNumber: PropTypes.number,
|
|
173
191
|
tickSize: PropTypes.number
|
|
174
192
|
}), PropTypes.string]),
|
|
193
|
+
/**
|
|
194
|
+
* @deprecated Consider using `slotProps.legend` instead.
|
|
195
|
+
*/
|
|
175
196
|
legend: PropTypes.shape({
|
|
176
197
|
classes: PropTypes.object,
|
|
177
198
|
direction: PropTypes.oneOf(['column', 'row']),
|
|
178
199
|
hidden: PropTypes.bool,
|
|
179
|
-
itemWidth: PropTypes.number,
|
|
180
|
-
markSize: PropTypes.number,
|
|
181
|
-
offset: PropTypes.shape({
|
|
182
|
-
x: PropTypes.number,
|
|
183
|
-
y: PropTypes.number
|
|
184
|
-
}),
|
|
185
200
|
position: PropTypes.shape({
|
|
186
201
|
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
187
202
|
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
188
203
|
}),
|
|
189
204
|
slotProps: PropTypes.object,
|
|
190
|
-
slots: PropTypes.object
|
|
191
|
-
spacing: PropTypes.number
|
|
205
|
+
slots: PropTypes.object
|
|
192
206
|
}),
|
|
193
207
|
margin: PropTypes.shape({
|
|
194
208
|
bottom: PropTypes.number,
|
|
@@ -209,11 +223,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
209
223
|
fill: PropTypes.string,
|
|
210
224
|
label: PropTypes.string,
|
|
211
225
|
labelFontSize: PropTypes.number,
|
|
226
|
+
labelStyle: PropTypes.object,
|
|
212
227
|
position: PropTypes.oneOf(['left', 'right']),
|
|
213
228
|
slotProps: PropTypes.object,
|
|
214
229
|
slots: PropTypes.object,
|
|
215
230
|
stroke: PropTypes.string,
|
|
216
231
|
tickFontSize: PropTypes.number,
|
|
232
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
233
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
234
|
+
tickLabelStyle: PropTypes.object,
|
|
217
235
|
tickMaxStep: PropTypes.number,
|
|
218
236
|
tickMinStep: PropTypes.number,
|
|
219
237
|
tickNumber: PropTypes.number,
|
|
@@ -274,11 +292,15 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
274
292
|
fill: PropTypes.string,
|
|
275
293
|
label: PropTypes.string,
|
|
276
294
|
labelFontSize: PropTypes.number,
|
|
295
|
+
labelStyle: PropTypes.object,
|
|
277
296
|
position: PropTypes.oneOf(['bottom', 'top']),
|
|
278
297
|
slotProps: PropTypes.object,
|
|
279
298
|
slots: PropTypes.object,
|
|
280
299
|
stroke: PropTypes.string,
|
|
281
300
|
tickFontSize: PropTypes.number,
|
|
301
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
302
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
303
|
+
tickLabelStyle: PropTypes.object,
|
|
282
304
|
tickMaxStep: PropTypes.number,
|
|
283
305
|
tickMinStep: PropTypes.number,
|
|
284
306
|
tickNumber: PropTypes.number,
|
|
@@ -303,6 +325,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
303
325
|
id: PropTypes.string,
|
|
304
326
|
label: PropTypes.string,
|
|
305
327
|
labelFontSize: PropTypes.number,
|
|
328
|
+
labelStyle: PropTypes.object,
|
|
306
329
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
307
330
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
308
331
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -311,6 +334,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
311
334
|
slots: PropTypes.object,
|
|
312
335
|
stroke: PropTypes.string,
|
|
313
336
|
tickFontSize: PropTypes.number,
|
|
337
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
338
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
339
|
+
tickLabelStyle: PropTypes.object,
|
|
314
340
|
tickMaxStep: PropTypes.number,
|
|
315
341
|
tickMinStep: PropTypes.number,
|
|
316
342
|
tickNumber: PropTypes.number,
|
|
@@ -329,6 +355,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
329
355
|
id: PropTypes.string,
|
|
330
356
|
label: PropTypes.string,
|
|
331
357
|
labelFontSize: PropTypes.number,
|
|
358
|
+
labelStyle: PropTypes.object,
|
|
332
359
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
333
360
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
334
361
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -337,6 +364,9 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
337
364
|
slots: PropTypes.object,
|
|
338
365
|
stroke: PropTypes.string,
|
|
339
366
|
tickFontSize: PropTypes.number,
|
|
367
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
368
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
369
|
+
tickLabelStyle: PropTypes.object,
|
|
340
370
|
tickMaxStep: PropTypes.number,
|
|
341
371
|
tickMinStep: PropTypes.number,
|
|
342
372
|
tickNumber: PropTypes.number,
|
|
@@ -58,6 +58,16 @@ LineElementPath.propTypes = {
|
|
|
58
58
|
}).isRequired,
|
|
59
59
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
60
60
|
};
|
|
61
|
+
/**
|
|
62
|
+
* Demos:
|
|
63
|
+
*
|
|
64
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
65
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
66
|
+
*
|
|
67
|
+
* API:
|
|
68
|
+
*
|
|
69
|
+
* - [LineElement API](https://mui.com/x/api/charts/line-element/)
|
|
70
|
+
*/
|
|
61
71
|
function LineElement(props) {
|
|
62
72
|
var _slots$line;
|
|
63
73
|
var id = props.id,
|
|
@@ -34,6 +34,16 @@ var HighlightElement = styled('circle', {
|
|
|
34
34
|
fill: ownerState.color
|
|
35
35
|
};
|
|
36
36
|
});
|
|
37
|
+
/**
|
|
38
|
+
* Demos:
|
|
39
|
+
*
|
|
40
|
+
* - [Lines](https://mui.com/x/react-charts/lines/)
|
|
41
|
+
* - [Line demonstration](https://mui.com/x/react-charts/line-demo/)
|
|
42
|
+
*
|
|
43
|
+
* API:
|
|
44
|
+
*
|
|
45
|
+
* - [LineHighlightElement API](https://mui.com/x/api/charts/line-highlight-element/)
|
|
46
|
+
*/
|
|
37
47
|
function LineHighlightElement(props) {
|
|
38
48
|
var x = props.x,
|
|
39
49
|
y = props.y,
|