@mui/x-charts 6.0.0-alpha.15 → 6.0.0-alpha.17
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 +13 -2
- package/BarChart/BarChart.js +45 -3
- 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/BarChart/formatter.js +1 -1
- package/CHANGELOG.md +131 -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 +2 -1
- package/ChartsLegend/ChartsLegend.js +12 -8
- package/ChartsSurface.js +2 -2
- package/ChartsTooltip/ChartsAxisTooltipContent.js +29 -23
- package/ChartsTooltip/ChartsItemTooltipContent.js +2 -2
- package/ChartsTooltip/ChartsTooltip.js +2 -2
- package/ChartsTooltip/utils.js +2 -2
- package/ChartsXAxis/ChartsXAxis.js +123 -35
- package/ChartsYAxis/ChartsYAxis.js +38 -16
- package/LineChart/AreaElement.d.ts +10 -0
- package/LineChart/AreaElement.js +12 -2
- package/LineChart/AreaPlot.d.ts +11 -0
- package/LineChart/AreaPlot.js +24 -7
- package/LineChart/LineChart.d.ts +10 -0
- package/LineChart/LineChart.js +36 -2
- 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 +14 -3
- package/LineChart/LinePlot.d.ts +10 -0
- package/LineChart/LinePlot.js +22 -11
- package/LineChart/MarkElement.d.ts +10 -0
- package/LineChart/MarkElement.js +12 -2
- package/LineChart/MarkPlot.d.ts +10 -0
- package/LineChart/MarkPlot.js +40 -9
- package/LineChart/formatter.js +4 -3
- package/PieChart/PieArc.js +2 -2
- package/PieChart/PieArcLabel.js +2 -2
- package/PieChart/PieChart.d.ts +10 -0
- package/PieChart/PieChart.js +37 -2
- 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 +10 -0
- package/ScatterChart/ScatterChart.js +36 -2
- 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/context/CartesianContextProvider.js +10 -2
- package/context/DrawingProvider.js +2 -2
- package/context/HighlightProvider.js +2 -2
- package/context/InteractionProvider.js +2 -2
- package/context/SeriesContextProvider.js +2 -2
- package/esm/BarChart/BarChart.js +43 -1
- 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 +16 -0
- package/esm/ChartsLegend/ChartsLegend.js +10 -6
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +27 -21
- package/esm/ChartsXAxis/ChartsXAxis.js +122 -34
- package/esm/ChartsYAxis/ChartsYAxis.js +36 -14
- package/esm/LineChart/AreaElement.js +10 -0
- package/esm/LineChart/AreaPlot.js +24 -6
- package/esm/LineChart/LineChart.js +34 -0
- package/esm/LineChart/LineElement.js +10 -0
- package/esm/LineChart/LineHighlightElement.js +10 -0
- package/esm/LineChart/LineHighlightPlot.js +12 -1
- package/esm/LineChart/LinePlot.js +23 -14
- package/esm/LineChart/MarkElement.js +10 -0
- package/esm/LineChart/MarkPlot.js +38 -7
- package/esm/LineChart/formatter.js +7 -3
- package/esm/PieChart/PieChart.js +35 -0
- 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 +34 -0
- package/esm/ScatterChart/ScatterPlot.js +10 -0
- package/esm/SparkLineChart/SparkLineChart.js +14 -0
- package/esm/context/CartesianContextProvider.js +8 -0
- package/esm/hooks/useMounted.js +16 -0
- package/esm/hooks/useReducedMotion.js +27 -0
- package/esm/hooks/useTicks.js +12 -6
- package/esm/internals/components/ChartsText.js +19 -13
- package/esm/internals/geometry.js +36 -0
- package/hooks/useAxisEvents.js +2 -2
- package/hooks/useChartDimensions.js +2 -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 +18 -9
- package/hooks/useTicks.js +14 -8
- package/index.js +1 -1
- package/internals/components/ChartsText.d.ts +11 -8
- package/internals/components/ChartsText.js +21 -15
- package/internals/defaultizeColor.d.ts +2 -2
- package/internals/domUtils.d.ts +0 -1
- package/internals/geometry.d.ts +9 -0
- package/internals/geometry.js +42 -0
- package/legacy/BarChart/BarChart.js +43 -1
- 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 +16 -0
- package/legacy/ChartsLegend/ChartsLegend.js +14 -7
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +5 -1
- package/legacy/ChartsXAxis/ChartsXAxis.js +126 -36
- package/legacy/ChartsYAxis/ChartsYAxis.js +36 -14
- package/legacy/LineChart/AreaElement.js +10 -0
- package/legacy/LineChart/AreaPlot.js +27 -7
- package/legacy/LineChart/LineChart.js +34 -0
- package/legacy/LineChart/LineElement.js +10 -0
- package/legacy/LineChart/LineHighlightElement.js +10 -0
- package/legacy/LineChart/LineHighlightPlot.js +12 -1
- package/legacy/LineChart/LinePlot.js +25 -12
- package/legacy/LineChart/MarkElement.js +10 -0
- package/legacy/LineChart/MarkPlot.js +37 -7
- package/legacy/LineChart/formatter.js +7 -3
- package/legacy/PieChart/PieChart.js +35 -0
- 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 +34 -0
- package/legacy/ScatterChart/ScatterPlot.js +10 -0
- package/legacy/SparkLineChart/SparkLineChart.js +14 -0
- package/legacy/context/CartesianContextProvider.js +8 -0
- package/legacy/hooks/useMounted.js +21 -0
- package/legacy/hooks/useReducedMotion.js +27 -0
- package/legacy/hooks/useTicks.js +13 -6
- package/legacy/index.js +1 -1
- package/legacy/internals/components/ChartsText.js +17 -15
- package/legacy/internals/geometry.js +37 -0
- package/models/axis.d.ts +19 -2
- package/models/seriesType/line.d.ts +3 -3
- package/modern/BarChart/BarChart.js +43 -1
- 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 +16 -0
- package/modern/ChartsLegend/ChartsLegend.js +10 -6
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +27 -21
- package/modern/ChartsXAxis/ChartsXAxis.js +122 -34
- package/modern/ChartsYAxis/ChartsYAxis.js +36 -14
- package/modern/LineChart/AreaElement.js +10 -0
- package/modern/LineChart/AreaPlot.js +22 -5
- package/modern/LineChart/LineChart.js +34 -0
- package/modern/LineChart/LineElement.js +10 -0
- package/modern/LineChart/LineHighlightElement.js +10 -0
- package/modern/LineChart/LineHighlightPlot.js +12 -1
- package/modern/LineChart/LinePlot.js +20 -9
- package/modern/LineChart/MarkElement.js +10 -0
- package/modern/LineChart/MarkPlot.js +38 -7
- package/modern/LineChart/formatter.js +4 -3
- package/modern/PieChart/PieChart.js +35 -0
- 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 +34 -0
- package/modern/ScatterChart/ScatterPlot.js +10 -0
- package/modern/SparkLineChart/SparkLineChart.js +14 -0
- package/modern/context/CartesianContextProvider.js +8 -0
- package/modern/hooks/useMounted.js +16 -0
- package/modern/hooks/useReducedMotion.js +27 -0
- package/modern/hooks/useTicks.js +12 -6
- package/modern/index.js +1 -1
- package/modern/internals/components/ChartsText.js +19 -13
- package/modern/internals/geometry.js +36 -0
- package/package.json +5 -3
|
@@ -15,6 +15,16 @@ const SPARKLINE_DEFAULT_MARGIN = {
|
|
|
15
15
|
left: 5,
|
|
16
16
|
right: 5
|
|
17
17
|
};
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Demos:
|
|
21
|
+
*
|
|
22
|
+
* - [SparkLine](https://mui.com/x/react-charts/sparkline/)
|
|
23
|
+
*
|
|
24
|
+
* API:
|
|
25
|
+
*
|
|
26
|
+
* - [SparkLineChart API](https://mui.com/x/api/charts/spark-line-chart/)
|
|
27
|
+
*/
|
|
18
28
|
const SparkLineChart = /*#__PURE__*/React.forwardRef(function SparkLineChart(props, ref) {
|
|
19
29
|
const {
|
|
20
30
|
xAxis,
|
|
@@ -195,6 +205,7 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
195
205
|
id: PropTypes.string,
|
|
196
206
|
label: PropTypes.string,
|
|
197
207
|
labelFontSize: PropTypes.number,
|
|
208
|
+
labelStyle: PropTypes.object,
|
|
198
209
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
199
210
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
200
211
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -203,6 +214,9 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
203
214
|
slots: PropTypes.object,
|
|
204
215
|
stroke: PropTypes.string,
|
|
205
216
|
tickFontSize: PropTypes.number,
|
|
217
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
218
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
219
|
+
tickLabelStyle: PropTypes.object,
|
|
206
220
|
tickMaxStep: PropTypes.number,
|
|
207
221
|
tickMinStep: PropTypes.number,
|
|
208
222
|
tickNumber: PropTypes.number,
|
|
@@ -228,6 +228,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
228
228
|
id: PropTypes.string,
|
|
229
229
|
label: PropTypes.string,
|
|
230
230
|
labelFontSize: PropTypes.number,
|
|
231
|
+
labelStyle: PropTypes.object,
|
|
231
232
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
232
233
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
233
234
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -236,6 +237,9 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
236
237
|
slots: PropTypes.object,
|
|
237
238
|
stroke: PropTypes.string,
|
|
238
239
|
tickFontSize: PropTypes.number,
|
|
240
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
241
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
242
|
+
tickLabelStyle: PropTypes.object,
|
|
239
243
|
tickMaxStep: PropTypes.number,
|
|
240
244
|
tickMinStep: PropTypes.number,
|
|
241
245
|
tickNumber: PropTypes.number,
|
|
@@ -254,6 +258,7 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
254
258
|
id: PropTypes.string,
|
|
255
259
|
label: PropTypes.string,
|
|
256
260
|
labelFontSize: PropTypes.number,
|
|
261
|
+
labelStyle: PropTypes.object,
|
|
257
262
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
258
263
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
259
264
|
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
@@ -262,6 +267,9 @@ process.env.NODE_ENV !== "production" ? CartesianContextProvider.propTypes = {
|
|
|
262
267
|
slots: PropTypes.object,
|
|
263
268
|
stroke: PropTypes.string,
|
|
264
269
|
tickFontSize: PropTypes.number,
|
|
270
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
271
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
272
|
+
tickLabelStyle: PropTypes.object,
|
|
265
273
|
tickMaxStep: PropTypes.number,
|
|
266
274
|
tickMinStep: PropTypes.number,
|
|
267
275
|
tickNumber: PropTypes.number,
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import useEnhancedEffect from '@mui/utils/useEnhancedEffect';
|
|
3
|
+
export function useMounted(defer = false) {
|
|
4
|
+
const [mountedState, setMountedState] = React.useState(false);
|
|
5
|
+
useEnhancedEffect(() => {
|
|
6
|
+
if (!defer) {
|
|
7
|
+
setMountedState(true);
|
|
8
|
+
}
|
|
9
|
+
}, [defer]);
|
|
10
|
+
React.useEffect(() => {
|
|
11
|
+
if (defer) {
|
|
12
|
+
setMountedState(true);
|
|
13
|
+
}
|
|
14
|
+
}, [defer]);
|
|
15
|
+
return mountedState;
|
|
16
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useIsomorphicLayoutEffect, Globals } from '@react-spring/web';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Returns `boolean` or `null`, used to automatically
|
|
5
|
+
* set skipAnimations to the value of the user's
|
|
6
|
+
* `prefers-reduced-motion` query.
|
|
7
|
+
*
|
|
8
|
+
* The return value, post-effect, is the value of their prefered setting
|
|
9
|
+
*/
|
|
10
|
+
export const useReducedMotion = () => {
|
|
11
|
+
// Taken from: https://github.com/pmndrs/react-spring/blob/02ec877bbfab0df46da0e4a47d5f68d3e731206a/packages/shared/src/hooks/useReducedMotion.ts#L13
|
|
12
|
+
|
|
13
|
+
useIsomorphicLayoutEffect(() => {
|
|
14
|
+
const mql = window.matchMedia('(prefers-reduced-motion)');
|
|
15
|
+
const handleMediaChange = e => {
|
|
16
|
+
Globals.assign({
|
|
17
|
+
// Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
|
|
18
|
+
skipAnimation: e.matches || undefined
|
|
19
|
+
});
|
|
20
|
+
};
|
|
21
|
+
handleMediaChange(mql);
|
|
22
|
+
mql.addEventListener('change', handleMediaChange);
|
|
23
|
+
return () => {
|
|
24
|
+
mql.removeEventListener('change', handleMediaChange);
|
|
25
|
+
};
|
|
26
|
+
}, []);
|
|
27
|
+
};
|
package/esm/hooks/useTicks.js
CHANGED
|
@@ -17,7 +17,8 @@ function useTicks(options) {
|
|
|
17
17
|
const {
|
|
18
18
|
scale,
|
|
19
19
|
tickNumber,
|
|
20
|
-
valueFormatter
|
|
20
|
+
valueFormatter,
|
|
21
|
+
tickInterval
|
|
21
22
|
} = options;
|
|
22
23
|
return React.useMemo(() => {
|
|
23
24
|
// band scale
|
|
@@ -28,7 +29,8 @@ function useTicks(options) {
|
|
|
28
29
|
return [...domain.map(value => {
|
|
29
30
|
var _valueFormatter;
|
|
30
31
|
return {
|
|
31
|
-
|
|
32
|
+
value,
|
|
33
|
+
formattedValue: (_valueFormatter = valueFormatter == null ? void 0 : valueFormatter(value)) != null ? _valueFormatter : `${value}`,
|
|
32
34
|
offset: scale(value) - (scale.step() - scale.bandwidth()) / 2,
|
|
33
35
|
labelOffset: scale.step() / 2
|
|
34
36
|
};
|
|
@@ -40,23 +42,27 @@ function useTicks(options) {
|
|
|
40
42
|
}
|
|
41
43
|
|
|
42
44
|
// scale type = 'point'
|
|
43
|
-
|
|
45
|
+
const filteredDomain = typeof tickInterval === 'function' && domain.filter(tickInterval) || typeof tickInterval === 'object' && tickInterval || domain;
|
|
46
|
+
return filteredDomain.map(value => {
|
|
44
47
|
var _valueFormatter2;
|
|
45
48
|
return {
|
|
46
|
-
|
|
49
|
+
value,
|
|
50
|
+
formattedValue: (_valueFormatter2 = valueFormatter == null ? void 0 : valueFormatter(value)) != null ? _valueFormatter2 : `${value}`,
|
|
47
51
|
offset: scale(value),
|
|
48
52
|
labelOffset: 0
|
|
49
53
|
};
|
|
50
54
|
});
|
|
51
55
|
}
|
|
52
|
-
|
|
56
|
+
const ticks = typeof tickInterval === 'object' ? tickInterval : scale.ticks(tickNumber);
|
|
57
|
+
return ticks.map(value => {
|
|
53
58
|
var _valueFormatter3;
|
|
54
59
|
return {
|
|
60
|
+
value,
|
|
55
61
|
formattedValue: (_valueFormatter3 = valueFormatter == null ? void 0 : valueFormatter(value)) != null ? _valueFormatter3 : scale.tickFormat(tickNumber)(value),
|
|
56
62
|
offset: scale(value),
|
|
57
63
|
labelOffset: 0
|
|
58
64
|
};
|
|
59
65
|
});
|
|
60
|
-
}, [tickNumber, scale, valueFormatter]);
|
|
66
|
+
}, [tickNumber, scale, valueFormatter, tickInterval]);
|
|
61
67
|
}
|
|
62
68
|
export default useTicks;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
2
2
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
const _excluded = ["x", "y", "
|
|
3
|
+
const _excluded = ["x", "y", "style", "text", "ownerState"],
|
|
4
|
+
_excluded2 = ["angle", "textAnchor", "dominantBaseline"];
|
|
4
5
|
import * as React from 'react';
|
|
5
6
|
import { getStringSize } from '../domUtils';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -20,12 +21,17 @@ export function ChartsText(props) {
|
|
|
20
21
|
const {
|
|
21
22
|
x,
|
|
22
23
|
y,
|
|
23
|
-
|
|
24
|
-
dominantBaseline = 'central',
|
|
25
|
-
style,
|
|
24
|
+
style: styleProps,
|
|
26
25
|
text
|
|
27
26
|
} = props,
|
|
28
27
|
textProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
28
|
+
const _ref = styleProps != null ? styleProps : {},
|
|
29
|
+
{
|
|
30
|
+
angle,
|
|
31
|
+
textAnchor,
|
|
32
|
+
dominantBaseline
|
|
33
|
+
} = _ref,
|
|
34
|
+
style = _objectWithoutPropertiesLoose(_ref, _excluded2);
|
|
29
35
|
const wordsByLines = React.useMemo(() => getWordsByLines({
|
|
30
36
|
style,
|
|
31
37
|
needsComputation: text.includes('\n'),
|
|
@@ -43,19 +49,17 @@ export function ChartsText(props) {
|
|
|
43
49
|
startDy = (wordsByLines.length - 1) * -wordsByLines[0].height;
|
|
44
50
|
break;
|
|
45
51
|
}
|
|
46
|
-
|
|
47
|
-
// const transforms = [];
|
|
52
|
+
const transforms = [];
|
|
48
53
|
// if (scaleToFit) {
|
|
49
54
|
// const lineWidth = wordsByLines[0].width;
|
|
50
55
|
// transforms.push(`scale(${(isNumber(width as number) ? (width as number) / lineWidth : 1) / lineWidth})`);
|
|
51
56
|
// }
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
if (angle) {
|
|
58
|
+
transforms.push(`rotate(${angle}, ${x}, ${y})`);
|
|
59
|
+
}
|
|
60
|
+
if (transforms.length) {
|
|
61
|
+
textProps.transform = transforms.join(' ');
|
|
62
|
+
}
|
|
59
63
|
return /*#__PURE__*/_jsx("text", _extends({}, textProps, {
|
|
60
64
|
x: x,
|
|
61
65
|
y: y,
|
|
@@ -65,6 +69,8 @@ export function ChartsText(props) {
|
|
|
65
69
|
children: wordsByLines.map((line, index) => /*#__PURE__*/_jsx("tspan", {
|
|
66
70
|
x: x,
|
|
67
71
|
dy: `${index === 0 ? startDy : wordsByLines[0].height}px`,
|
|
72
|
+
dominantBaseline: dominantBaseline // Propagated to fix Safari issue: https://github.com/mui/mui-x/issues/10808
|
|
73
|
+
,
|
|
68
74
|
children: line.text
|
|
69
75
|
}, index))
|
|
70
76
|
}));
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
const ANGLE_APPROX = 5; // Angle (in deg) for which we approximate the rectangle as perfectly horizontal/vertical
|
|
2
|
+
|
|
3
|
+
let warnedOnce = false;
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Return the minimal translation along the x-axis to avoid overflow of a rectangle of a given width, height, and rotation.
|
|
7
|
+
* This assumes that all rectangles have the same height and angle between -90 and 90.
|
|
8
|
+
* Otherwise it would be problematic because you need the height/width of the next rectangle to do the correct computation.
|
|
9
|
+
* @param width the side along the x axis.
|
|
10
|
+
* @param height the side along the y axis.
|
|
11
|
+
* @param angle the rotation in degrees.
|
|
12
|
+
*/
|
|
13
|
+
export function getMinXTranslation(width, height, angle = 0) {
|
|
14
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
15
|
+
if (!warnedOnce && angle > 90 && angle < -90) {
|
|
16
|
+
warnedOnce = true;
|
|
17
|
+
console.warn([`MUI X: It seems you applied an angle larger than 90° or smaller than -90° to an axis text.`, `This could cause some text overlapping.`, `If you encounter a use case where it's needed, please open an issue.`].join('\n'));
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
const standardAngle = Math.min(Math.abs(angle) % 180, Math.abs(Math.abs(angle) % 180 - 180) % 180); // Map from R to [0, 90]
|
|
21
|
+
|
|
22
|
+
if (standardAngle < ANGLE_APPROX) {
|
|
23
|
+
// It's nearly horizontal
|
|
24
|
+
return width;
|
|
25
|
+
}
|
|
26
|
+
if (standardAngle > 90 - ANGLE_APPROX) {
|
|
27
|
+
// It's nearly vertical
|
|
28
|
+
return height;
|
|
29
|
+
}
|
|
30
|
+
const radAngle = standardAngle * Math.PI / 180;
|
|
31
|
+
const angleSwich = Math.atan2(height, width);
|
|
32
|
+
if (radAngle < angleSwich) {
|
|
33
|
+
return width / Math.cos(radAngle);
|
|
34
|
+
}
|
|
35
|
+
return height / Math.sin(radAngle);
|
|
36
|
+
}
|
package/hooks/useAxisEvents.js
CHANGED
|
@@ -9,8 +9,8 @@ var _InteractionProvider = require("../context/InteractionProvider");
|
|
|
9
9
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
10
10
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
11
11
|
var _isBandScale = require("../internals/isBandScale");
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
14
|
const useAxisEvents = disableAxisListener => {
|
|
15
15
|
const svgRef = React.useContext(_DrawingProvider.SVGContext);
|
|
16
16
|
const {
|
|
@@ -8,8 +8,8 @@ exports.default = void 0;
|
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _constants = require("../constants");
|
|
11
|
-
function _getRequireWildcardCache(
|
|
12
|
-
function _interopRequireWildcard(
|
|
11
|
+
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); }
|
|
12
|
+
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; }
|
|
13
13
|
const useChartDimensions = (width, height, margin) => {
|
|
14
14
|
const defaultizedMargin = (0, _extends2.default)({}, _constants.DEFAULT_MARGINS, margin);
|
|
15
15
|
const drawingArea = React.useMemo(() => ({
|
package/hooks/useDrawingArea.js
CHANGED
|
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
exports.useDrawingArea = useDrawingArea;
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _DrawingProvider = require("../context/DrawingProvider");
|
|
9
|
-
function _getRequireWildcardCache(
|
|
10
|
-
function _interopRequireWildcard(
|
|
9
|
+
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); }
|
|
10
|
+
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; }
|
|
11
11
|
function useDrawingArea() {
|
|
12
12
|
const {
|
|
13
13
|
left,
|
|
@@ -7,8 +7,8 @@ exports.useInteractionItemProps = exports.getIsHighlighted = exports.getIsFaded
|
|
|
7
7
|
var React = _interopRequireWildcard(require("react"));
|
|
8
8
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
9
9
|
var _HighlightProvider = require("../context/HighlightProvider");
|
|
10
|
-
function _getRequireWildcardCache(
|
|
11
|
-
function _interopRequireWildcard(
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
12
|
const useInteractionItemProps = scope => {
|
|
13
13
|
const {
|
|
14
14
|
dispatch: dispatchInteraction
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useMounted(defer?: boolean): boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.useMounted = useMounted;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _useEnhancedEffect = _interopRequireDefault(require("@mui/utils/useEnhancedEffect"));
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
|
+
function useMounted(defer = false) {
|
|
13
|
+
const [mountedState, setMountedState] = React.useState(false);
|
|
14
|
+
(0, _useEnhancedEffect.default)(() => {
|
|
15
|
+
if (!defer) {
|
|
16
|
+
setMountedState(true);
|
|
17
|
+
}
|
|
18
|
+
}, [defer]);
|
|
19
|
+
React.useEffect(() => {
|
|
20
|
+
if (defer) {
|
|
21
|
+
setMountedState(true);
|
|
22
|
+
}
|
|
23
|
+
}, [defer]);
|
|
24
|
+
return mountedState;
|
|
25
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Returns `boolean` or `null`, used to automatically
|
|
3
|
+
* set skipAnimations to the value of the user's
|
|
4
|
+
* `prefers-reduced-motion` query.
|
|
5
|
+
*
|
|
6
|
+
* The return value, post-effect, is the value of their prefered setting
|
|
7
|
+
*/
|
|
8
|
+
export declare const useReducedMotion: () => void;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.useReducedMotion = void 0;
|
|
7
|
+
var _web = require("@react-spring/web");
|
|
8
|
+
/**
|
|
9
|
+
* Returns `boolean` or `null`, used to automatically
|
|
10
|
+
* set skipAnimations to the value of the user's
|
|
11
|
+
* `prefers-reduced-motion` query.
|
|
12
|
+
*
|
|
13
|
+
* The return value, post-effect, is the value of their prefered setting
|
|
14
|
+
*/
|
|
15
|
+
const useReducedMotion = () => {
|
|
16
|
+
// Taken from: https://github.com/pmndrs/react-spring/blob/02ec877bbfab0df46da0e4a47d5f68d3e731206a/packages/shared/src/hooks/useReducedMotion.ts#L13
|
|
17
|
+
|
|
18
|
+
(0, _web.useIsomorphicLayoutEffect)(() => {
|
|
19
|
+
const mql = window.matchMedia('(prefers-reduced-motion)');
|
|
20
|
+
const handleMediaChange = e => {
|
|
21
|
+
_web.Globals.assign({
|
|
22
|
+
// Modification such the react-spring implementation such that this hook can remove animation but never activate animation.
|
|
23
|
+
skipAnimation: e.matches || undefined
|
|
24
|
+
});
|
|
25
|
+
};
|
|
26
|
+
handleMediaChange(mql);
|
|
27
|
+
mql.addEventListener('change', handleMediaChange);
|
|
28
|
+
return () => {
|
|
29
|
+
mql.removeEventListener('change', handleMediaChange);
|
|
30
|
+
};
|
|
31
|
+
}, []);
|
|
32
|
+
};
|
|
33
|
+
exports.useReducedMotion = useReducedMotion;
|
package/hooks/useScale.d.ts
CHANGED
|
@@ -6,5 +6,5 @@ import { D3Scale } from '../models/axis';
|
|
|
6
6
|
* @returns (value: any) => number
|
|
7
7
|
*/
|
|
8
8
|
export declare function getValueToPositionMapper(scale: D3Scale): (value: any) => number;
|
|
9
|
-
export declare function useXScale(identifier?: number | string): import("d3-scale").ScaleBand<any> | import("d3-scale").ScalePoint<any> | import("d3-scale").
|
|
10
|
-
export declare function useYScale(identifier?: number | string): import("d3-scale").ScaleBand<any> | import("d3-scale").ScalePoint<any> | import("d3-scale").
|
|
9
|
+
export declare function useXScale(identifier?: number | string): import("d3-scale").ScaleBand<any> | import("d3-scale").ScalePoint<any> | import("d3-scale").ScaleLinear<any, any, never> | import("d3-scale").ScaleTime<any, any, never> | import("d3-scale").ScaleLogarithmic<any, any, never> | import("d3-scale").ScalePower<any, any, never>;
|
|
10
|
+
export declare function useYScale(identifier?: number | string): import("d3-scale").ScaleBand<any> | import("d3-scale").ScalePoint<any> | import("d3-scale").ScaleLinear<any, any, never> | import("d3-scale").ScaleTime<any, any, never> | import("d3-scale").ScaleLogarithmic<any, any, never> | import("d3-scale").ScalePower<any, any, never>;
|
package/hooks/useScale.js
CHANGED
|
@@ -9,8 +9,8 @@ exports.useYScale = useYScale;
|
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _CartesianContextProvider = require("../context/CartesianContextProvider");
|
|
11
11
|
var _isBandScale = require("../internals/isBandScale");
|
|
12
|
-
function _getRequireWildcardCache(
|
|
13
|
-
function _interopRequireWildcard(
|
|
12
|
+
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); }
|
|
13
|
+
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; }
|
|
14
14
|
/**
|
|
15
15
|
* For a given scale return a function that map value to their position.
|
|
16
16
|
* Usefull when dealing with specific scale such as band.
|
package/hooks/useTicks.d.ts
CHANGED
|
@@ -17,21 +17,30 @@ export interface TickParams {
|
|
|
17
17
|
* Not supported by categorical axis (band, points).
|
|
18
18
|
*/
|
|
19
19
|
tickNumber?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Defines which ticks are displayed. Its value can be:
|
|
22
|
+
* - 'auto' In such case the ticks are computed based on axis scale and other parameters.
|
|
23
|
+
* - a filtering function of the form `(value, index) => boolean` which is available only if the axis has a data property.
|
|
24
|
+
* - an array containing the values where ticks should be displayed.
|
|
25
|
+
* @default 'auto'
|
|
26
|
+
*/
|
|
27
|
+
tickInterval?: 'auto' | ((value: any, index: number) => boolean) | any[];
|
|
20
28
|
}
|
|
21
29
|
export declare function getTickNumber(params: TickParams & {
|
|
22
30
|
range: any[];
|
|
23
31
|
domain: any[];
|
|
24
32
|
}): number;
|
|
33
|
+
export type TickItemType = {
|
|
34
|
+
/**
|
|
35
|
+
* This property is undefined only if it's the tick closing the last band
|
|
36
|
+
*/
|
|
37
|
+
value?: any;
|
|
38
|
+
formattedValue?: string;
|
|
39
|
+
offset: number;
|
|
40
|
+
labelOffset: number;
|
|
41
|
+
};
|
|
25
42
|
declare function useTicks(options: {
|
|
26
43
|
scale: D3Scale;
|
|
27
44
|
valueFormatter?: (value: any) => string;
|
|
28
|
-
} & Pick<TickParams, 'tickNumber'>):
|
|
29
|
-
formattedValue: any;
|
|
30
|
-
offset: number;
|
|
31
|
-
labelOffset: number;
|
|
32
|
-
}[] | {
|
|
33
|
-
formattedValue: string;
|
|
34
|
-
offset: any;
|
|
35
|
-
labelOffset: number;
|
|
36
|
-
}[];
|
|
45
|
+
} & Pick<TickParams, 'tickNumber' | 'tickInterval'>): TickItemType[];
|
|
37
46
|
export default useTicks;
|
package/hooks/useTicks.js
CHANGED
|
@@ -7,8 +7,8 @@ exports.default = void 0;
|
|
|
7
7
|
exports.getTickNumber = getTickNumber;
|
|
8
8
|
var React = _interopRequireWildcard(require("react"));
|
|
9
9
|
var _isBandScale = require("../internals/isBandScale");
|
|
10
|
-
function _getRequireWildcardCache(
|
|
11
|
-
function _interopRequireWildcard(
|
|
10
|
+
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); }
|
|
11
|
+
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; }
|
|
12
12
|
function getTickNumber(params) {
|
|
13
13
|
const {
|
|
14
14
|
tickMaxStep,
|
|
@@ -26,7 +26,8 @@ function useTicks(options) {
|
|
|
26
26
|
const {
|
|
27
27
|
scale,
|
|
28
28
|
tickNumber,
|
|
29
|
-
valueFormatter
|
|
29
|
+
valueFormatter,
|
|
30
|
+
tickInterval
|
|
30
31
|
} = options;
|
|
31
32
|
return React.useMemo(() => {
|
|
32
33
|
// band scale
|
|
@@ -35,7 +36,8 @@ function useTicks(options) {
|
|
|
35
36
|
if (scale.bandwidth() > 0) {
|
|
36
37
|
// scale type = 'band'
|
|
37
38
|
return [...domain.map(value => ({
|
|
38
|
-
|
|
39
|
+
value,
|
|
40
|
+
formattedValue: valueFormatter?.(value) ?? `${value}`,
|
|
39
41
|
offset: scale(value) - (scale.step() - scale.bandwidth()) / 2,
|
|
40
42
|
labelOffset: scale.step() / 2
|
|
41
43
|
})), {
|
|
@@ -46,17 +48,21 @@ function useTicks(options) {
|
|
|
46
48
|
}
|
|
47
49
|
|
|
48
50
|
// scale type = 'point'
|
|
49
|
-
|
|
50
|
-
|
|
51
|
+
const filteredDomain = typeof tickInterval === 'function' && domain.filter(tickInterval) || typeof tickInterval === 'object' && tickInterval || domain;
|
|
52
|
+
return filteredDomain.map(value => ({
|
|
53
|
+
value,
|
|
54
|
+
formattedValue: valueFormatter?.(value) ?? `${value}`,
|
|
51
55
|
offset: scale(value),
|
|
52
56
|
labelOffset: 0
|
|
53
57
|
}));
|
|
54
58
|
}
|
|
55
|
-
|
|
59
|
+
const ticks = typeof tickInterval === 'object' ? tickInterval : scale.ticks(tickNumber);
|
|
60
|
+
return ticks.map(value => ({
|
|
61
|
+
value,
|
|
56
62
|
formattedValue: valueFormatter?.(value) ?? scale.tickFormat(tickNumber)(value),
|
|
57
63
|
offset: scale(value),
|
|
58
64
|
labelOffset: 0
|
|
59
65
|
}));
|
|
60
|
-
}, [tickNumber, scale, valueFormatter]);
|
|
66
|
+
}, [tickNumber, scale, valueFormatter, tickInterval]);
|
|
61
67
|
}
|
|
62
68
|
var _default = exports.default = useTicks;
|
package/index.js
CHANGED
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
export type ChartsTextBaseline = 'hanging' | 'central' | 'auto';
|
|
3
|
+
export interface ChartsTextStyle extends React.CSSProperties {
|
|
4
|
+
angle?: number;
|
|
5
|
+
/**
|
|
6
|
+
* The text baseline
|
|
7
|
+
* @default 'central'
|
|
8
|
+
*/
|
|
9
|
+
dominantBaseline?: ChartsTextBaseline;
|
|
10
|
+
}
|
|
2
11
|
interface GetWordsByLinesParams {
|
|
3
12
|
/**
|
|
4
13
|
* Text displayed.
|
|
@@ -7,24 +16,18 @@ interface GetWordsByLinesParams {
|
|
|
7
16
|
/**
|
|
8
17
|
* Style applied to text elements.
|
|
9
18
|
*/
|
|
10
|
-
style?:
|
|
19
|
+
style?: ChartsTextStyle;
|
|
11
20
|
/**
|
|
12
21
|
* If true, the line width is computed.
|
|
13
22
|
* @default false
|
|
14
23
|
*/
|
|
15
24
|
needsComputation?: boolean;
|
|
16
25
|
}
|
|
17
|
-
export
|
|
18
|
-
export interface ChartsTextProps extends Omit<React.SVGTextElementAttributes<SVGTextElement>, 'width' | 'ref'>, GetWordsByLinesParams {
|
|
26
|
+
export interface ChartsTextProps extends Omit<React.SVGTextElementAttributes<SVGTextElement>, 'width' | 'ref' | 'style' | 'dominantBaseline'>, GetWordsByLinesParams {
|
|
19
27
|
/**
|
|
20
28
|
* Height of a text line (in `em`).
|
|
21
29
|
*/
|
|
22
30
|
lineHeight?: number;
|
|
23
|
-
/**
|
|
24
|
-
* The text baseline
|
|
25
|
-
* @default 'central'
|
|
26
|
-
*/
|
|
27
|
-
dominantBaseline?: ChartsTextBaseline;
|
|
28
31
|
ownerState?: any;
|
|
29
32
|
}
|
|
30
33
|
export declare function getWordsByLines({ style, needsComputation, text }: GetWordsByLinesParams): any[];
|