@mui/x-charts 7.0.0-alpha.4 → 7.0.0-alpha.7
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/BarPlot.js +7 -6
- package/BarChart/formatter.js +15 -3
- package/CHANGELOG.md +524 -0
- package/ChartsAxis/ChartsAxis.js +4 -4
- package/ChartsLegend/ChartsLegend.d.ts +1 -1
- package/ChartsLegend/ChartsLegend.js +3 -2
- package/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/ChartsReferenceLine/common.d.ts +1 -1
- package/ChartsText/ChartsText.d.ts +17 -0
- package/{internals/components → ChartsText}/ChartsText.js +32 -17
- package/ChartsText/index.d.ts +3 -0
- package/ChartsText/index.js +12 -0
- package/ChartsText/package.json +6 -0
- package/ChartsXAxis/ChartsXAxis.js +3 -2
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/LineChart/AreaPlot.js +3 -2
- package/LineChart/LineHighlightPlot.js +2 -1
- package/LineChart/LinePlot.js +3 -2
- package/LineChart/MarkPlot.js +2 -1
- package/LineChart/formatter.js +14 -2
- package/PieChart/PieArcLabel.d.ts +1 -0
- package/PieChart/PieArcLabel.js +7 -8
- package/PieChart/PieArcLabelPlot.d.ts +2 -3
- package/PieChart/PieArcLabelPlot.js +14 -4
- package/PieChart/PieArcPlot.d.ts +2 -3
- package/PieChart/PieArcPlot.js +8 -2
- package/PieChart/PieChart.js +7 -4
- package/PieChart/PiePlot.js +23 -15
- package/PieChart/dataTransform/transition.js +9 -2
- package/PieChart/dataTransform/useTransformData.d.ts +3 -3
- package/PieChart/dataTransform/useTransformData.js +11 -8
- package/ResponsiveChartContainer/index.js +2 -2
- package/context/CartesianContextProvider.js +2 -2
- package/context/SeriesContextProvider.js +1 -1
- package/esm/BarChart/BarPlot.js +7 -5
- package/esm/BarChart/formatter.js +20 -4
- package/esm/ChartsAxis/ChartsAxis.js +4 -4
- package/esm/ChartsLegend/ChartsLegend.js +2 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/esm/{internals/components → ChartsText}/ChartsText.js +33 -16
- package/esm/ChartsText/index.js +1 -0
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/LineChart/AreaPlot.js +3 -2
- package/esm/LineChart/LineHighlightPlot.js +2 -1
- package/esm/LineChart/LinePlot.js +3 -2
- package/esm/LineChart/MarkPlot.js +2 -1
- package/esm/LineChart/formatter.js +16 -3
- package/esm/PieChart/PieArcLabel.js +7 -8
- package/esm/PieChart/PieArcLabelPlot.js +14 -4
- package/esm/PieChart/PieArcPlot.js +8 -2
- package/esm/PieChart/PieChart.js +7 -4
- package/esm/PieChart/PiePlot.js +23 -15
- package/esm/PieChart/dataTransform/transition.js +9 -2
- package/esm/PieChart/dataTransform/useTransformData.js +12 -9
- package/esm/ResponsiveChartContainer/index.js +2 -2
- package/esm/context/CartesianContextProvider.js +2 -2
- package/esm/context/SeriesContextProvider.js +1 -1
- package/esm/index.js +1 -0
- package/esm/internals/getWordsByLines.js +14 -0
- package/esm/internals/utils.js +29 -0
- package/index.d.ts +1 -0
- package/index.js +12 -1
- package/internals/defaultizeColor.d.ts +7 -4
- package/internals/{components/ChartsText.d.ts → getWordsByLines.d.ts} +2 -11
- package/internals/getWordsByLines.js +21 -0
- package/internals/utils.d.ts +7 -0
- package/internals/utils.js +30 -0
- package/legacy/BarChart/BarPlot.js +7 -5
- package/legacy/BarChart/formatter.js +23 -9
- package/legacy/ChartsAxis/ChartsAxis.js +4 -4
- package/legacy/ChartsLegend/ChartsLegend.js +2 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/legacy/{internals/components → ChartsText}/ChartsText.js +38 -22
- package/legacy/ChartsText/index.js +1 -0
- package/legacy/ChartsXAxis/ChartsXAxis.js +2 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +1 -1
- package/legacy/LineChart/AreaPlot.js +3 -2
- package/legacy/LineChart/LineHighlightPlot.js +2 -1
- package/legacy/LineChart/LinePlot.js +3 -2
- package/legacy/LineChart/MarkPlot.js +2 -1
- package/legacy/LineChart/formatter.js +19 -8
- package/legacy/PieChart/PieArcLabel.js +7 -8
- package/legacy/PieChart/PieArcLabelPlot.js +14 -5
- package/legacy/PieChart/PieArcPlot.js +9 -2
- package/legacy/PieChart/PieChart.js +7 -4
- package/legacy/PieChart/PiePlot.js +23 -15
- package/legacy/PieChart/dataTransform/transition.js +9 -2
- package/legacy/PieChart/dataTransform/useTransformData.js +12 -9
- package/legacy/ResponsiveChartContainer/index.js +2 -2
- package/legacy/context/CartesianContextProvider.js +2 -2
- package/legacy/context/SeriesContextProvider.js +1 -1
- package/legacy/index.js +2 -1
- package/legacy/internals/getWordsByLines.js +15 -0
- package/legacy/internals/utils.js +29 -0
- package/models/axis.d.ts +1 -1
- package/models/seriesType/config.d.ts +4 -3
- package/models/seriesType/pie.d.ts +43 -7
- package/modern/BarChart/BarPlot.js +7 -5
- package/modern/BarChart/formatter.js +15 -3
- package/modern/ChartsAxis/ChartsAxis.js +4 -4
- package/modern/ChartsLegend/ChartsLegend.js +2 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +2 -2
- package/modern/ChartsReferenceLine/ChartsXReferenceLine.js +1 -1
- package/modern/ChartsReferenceLine/ChartsYReferenceLine.js +1 -1
- package/modern/{internals/components → ChartsText}/ChartsText.js +33 -16
- package/modern/ChartsText/index.js +1 -0
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/LineChart/AreaPlot.js +3 -2
- package/modern/LineChart/LineHighlightPlot.js +2 -1
- package/modern/LineChart/LinePlot.js +3 -2
- package/modern/LineChart/MarkPlot.js +2 -1
- package/modern/LineChart/formatter.js +14 -2
- package/modern/PieChart/PieArcLabel.js +7 -8
- package/modern/PieChart/PieArcLabelPlot.js +14 -4
- package/modern/PieChart/PieArcPlot.js +8 -2
- package/modern/PieChart/PieChart.js +7 -4
- package/modern/PieChart/PiePlot.js +23 -15
- package/modern/PieChart/dataTransform/transition.js +9 -2
- package/modern/PieChart/dataTransform/useTransformData.js +11 -8
- package/modern/ResponsiveChartContainer/index.js +2 -2
- package/modern/context/CartesianContextProvider.js +2 -2
- package/modern/context/SeriesContextProvider.js +1 -1
- package/modern/index.js +2 -1
- package/modern/internals/getWordsByLines.js +14 -0
- package/modern/internals/utils.js +29 -0
- package/package.json +5 -5
package/internals/utils.js
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
+
exports.getPercentageValue = getPercentageValue;
|
|
6
7
|
exports.getSVGPoint = getSVGPoint;
|
|
7
8
|
exports.getSymbol = getSymbol;
|
|
8
9
|
// Returns the index of a defined shape
|
|
@@ -20,4 +21,33 @@ function getSVGPoint(svg, event) {
|
|
|
20
21
|
pt.x = event.clientX;
|
|
21
22
|
pt.y = event.clientY;
|
|
22
23
|
return pt.matrixTransform(svg.getScreenCTM().inverse());
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Helper that converts values and percentages into values.
|
|
28
|
+
* @param value The value provided by the developer. Can either be a number or a string with '%' or 'px'.
|
|
29
|
+
* @param refValue The numerical value associated to 100%.
|
|
30
|
+
* @returns The numerical value associated to the provided value.
|
|
31
|
+
*/
|
|
32
|
+
function getPercentageValue(value, refValue) {
|
|
33
|
+
if (typeof value === 'number') {
|
|
34
|
+
return value;
|
|
35
|
+
}
|
|
36
|
+
if (value === '100%') {
|
|
37
|
+
// Avoid potential rounding issues
|
|
38
|
+
return refValue;
|
|
39
|
+
}
|
|
40
|
+
if (value.endsWith('%')) {
|
|
41
|
+
const percentage = Number.parseFloat(value.slice(0, value.length - 1));
|
|
42
|
+
if (!Number.isNaN(percentage)) {
|
|
43
|
+
return percentage * refValue / 100;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
if (value.endsWith('px')) {
|
|
47
|
+
const val = Number.parseFloat(value.slice(0, value.length - 2));
|
|
48
|
+
if (!Number.isNaN(val)) {
|
|
49
|
+
return val;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
throw Error(`MUI-Charts: Received an unknown value "${value}". It should be a number, or a string with a percentage value.`);
|
|
23
53
|
}
|
|
@@ -9,7 +9,8 @@ import { SeriesContext } from '../context/SeriesContextProvider';
|
|
|
9
9
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
10
10
|
import { BarElement } from './BarElement';
|
|
11
11
|
import { isBandScaleConfig } from '../models/axis';
|
|
12
|
-
import {
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY, DEFAULT_Y_AXIS_KEY } from '../constants';
|
|
13
|
+
|
|
13
14
|
/**
|
|
14
15
|
* Solution of the equations
|
|
15
16
|
* W = barWidth * N + offset * (N-1)
|
|
@@ -19,6 +20,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
19
20
|
* @param gapRatio The ratio of the gap between bars over the bar width.
|
|
20
21
|
* @returns The bar width and the offset between bars.
|
|
21
22
|
*/
|
|
23
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
22
24
|
function getBandSize(_ref) {
|
|
23
25
|
var W = _ref.bandWidth,
|
|
24
26
|
N = _ref.numberOfGroups,
|
|
@@ -64,18 +66,18 @@ var useCompletedData = function useCompletedData() {
|
|
|
64
66
|
var baseScaleConfig;
|
|
65
67
|
if (verticalLayout) {
|
|
66
68
|
if (!isBandScaleConfig(xAxisConfig)) {
|
|
67
|
-
throw new Error("
|
|
69
|
+
throw new Error("MUI-X-Charts: ".concat(xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : "The x-axis with id \"".concat(xAxisKey, "\""), " shoud be of type \"band\" to display the bar series of id \"").concat(seriesId, "\""));
|
|
68
70
|
}
|
|
69
71
|
if (xAxis[xAxisKey].data === undefined) {
|
|
70
|
-
throw new Error("
|
|
72
|
+
throw new Error("MUI-X-Charts: ".concat(xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : "The x-axis with id \"".concat(xAxisKey, "\""), " shoud have data property"));
|
|
71
73
|
}
|
|
72
74
|
baseScaleConfig = xAxisConfig;
|
|
73
75
|
} else {
|
|
74
76
|
if (!isBandScaleConfig(yAxisConfig)) {
|
|
75
|
-
throw new Error("
|
|
77
|
+
throw new Error("MUI-X-Charts: ".concat(yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : "The y-axis with id \"".concat(yAxisKey, "\""), " shoud be of type \"band\" to display the bar series of id \"").concat(seriesId, "\""));
|
|
76
78
|
}
|
|
77
79
|
if (yAxis[yAxisKey].data === undefined) {
|
|
78
|
-
throw new Error("
|
|
80
|
+
throw new Error("MUI-X-Charts: ".concat(yAxisKey === DEFAULT_Y_AXIS_KEY ? 'The first `yAxis`' : "The y-axis with id \"".concat(yAxisKey, "\""), " shoud have data property"));
|
|
79
81
|
}
|
|
80
82
|
baseScaleConfig = yAxisConfig;
|
|
81
83
|
}
|
|
@@ -4,13 +4,15 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
4
4
|
import { stack as d3Stack } from 'd3-shape';
|
|
5
5
|
import { getStackingGroups } from '../internals/stackSeries';
|
|
6
6
|
import defaultizeValueFormatter from '../internals/defaultizeValueFormatter';
|
|
7
|
+
var warnOnce = false;
|
|
7
8
|
var formatter = function formatter(params, dataset) {
|
|
9
|
+
var _ref;
|
|
8
10
|
var seriesOrder = params.seriesOrder,
|
|
9
11
|
series = params.series;
|
|
10
12
|
var stackingGroups = getStackingGroups(params);
|
|
11
13
|
|
|
12
14
|
// Create a data set with format adapted to d3
|
|
13
|
-
var d3Dataset = dataset != null ?
|
|
15
|
+
var d3Dataset = (_ref = dataset) != null ? _ref : [];
|
|
14
16
|
seriesOrder.forEach(function (id) {
|
|
15
17
|
var data = series[id].data;
|
|
16
18
|
if (data !== undefined) {
|
|
@@ -22,7 +24,7 @@ var formatter = function formatter(params, dataset) {
|
|
|
22
24
|
}
|
|
23
25
|
});
|
|
24
26
|
} else if (dataset === undefined) {
|
|
25
|
-
throw new Error(["MUI: bar series with id='".concat(id, "' has no data."), 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
27
|
+
throw new Error(["MUI-X-Charts: bar series with id='".concat(id, "' has no data."), 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
26
28
|
}
|
|
27
29
|
});
|
|
28
30
|
var completedSeries = {};
|
|
@@ -35,19 +37,31 @@ var formatter = function formatter(params, dataset) {
|
|
|
35
37
|
// Use dataKey if needed and available
|
|
36
38
|
var dataKey = series[id].dataKey;
|
|
37
39
|
return series[id].data === undefined && dataKey !== undefined ? dataKey : id;
|
|
38
|
-
})).
|
|
40
|
+
})).value(function (d, key) {
|
|
41
|
+
var _d$key;
|
|
42
|
+
return (_d$key = d[key]) != null ? _d$key : 0;
|
|
43
|
+
}) // defaultize null value to 0
|
|
44
|
+
.order(stackingOrder).offset(stackingOffset)(d3Dataset);
|
|
39
45
|
ids.forEach(function (id, index) {
|
|
40
46
|
var dataKey = series[id].dataKey;
|
|
41
47
|
completedSeries[id] = _extends({
|
|
42
48
|
layout: 'vertical'
|
|
43
49
|
}, series[id], {
|
|
44
|
-
data: dataKey ? dataset.map(function (
|
|
45
|
-
|
|
50
|
+
data: dataKey ? dataset.map(function (data) {
|
|
51
|
+
var value = data[dataKey];
|
|
52
|
+
if (typeof value !== 'number') {
|
|
53
|
+
if (process.env.NODE_ENV !== 'production' && !warnOnce && value !== null) {
|
|
54
|
+
warnOnce = true;
|
|
55
|
+
console.error(["MUI-X charts: your dataset key \"".concat(dataKey, "\" is used for plotting bars, but contains nonnumerical elements."), 'Bar plots only support numbers and null values.']);
|
|
56
|
+
}
|
|
57
|
+
return 0;
|
|
58
|
+
}
|
|
59
|
+
return value;
|
|
46
60
|
}) : series[id].data,
|
|
47
|
-
stackedData: stackedSeries[index].map(function (
|
|
48
|
-
var
|
|
49
|
-
a =
|
|
50
|
-
b =
|
|
61
|
+
stackedData: stackedSeries[index].map(function (_ref2) {
|
|
62
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
63
|
+
a = _ref3[0],
|
|
64
|
+
b = _ref3[1];
|
|
51
65
|
return [a, b];
|
|
52
66
|
})
|
|
53
67
|
});
|
|
@@ -57,16 +57,16 @@ function ChartsAxis(props) {
|
|
|
57
57
|
var topId = getAxisId(topAxis);
|
|
58
58
|
var rightId = getAxisId(rightAxis);
|
|
59
59
|
if (topId !== null && !xAxis[topId]) {
|
|
60
|
-
throw Error("MUI: id used for top axis \"".concat(topId, "\" is not defined"));
|
|
60
|
+
throw Error(["MUI-X-Charts: id used for top axis \"".concat(topId, "\" is not defined."), "Available ids are: ".concat(xAxisIds.join(', '), ".")].join('\n'));
|
|
61
61
|
}
|
|
62
62
|
if (leftId !== null && !yAxis[leftId]) {
|
|
63
|
-
throw Error("MUI: id used for left axis \"".concat(leftId, "\" is not defined"));
|
|
63
|
+
throw Error(["MUI-X-Charts: id used for left axis \"".concat(leftId, "\" is not defined."), "Available ids are: ".concat(yAxisIds.join(', '), ".")].join('\n'));
|
|
64
64
|
}
|
|
65
65
|
if (rightId !== null && !yAxis[rightId]) {
|
|
66
|
-
throw Error("MUI: id used for right axis \"".concat(rightId, "\" is not defined"));
|
|
66
|
+
throw Error(["MUI-X-Charts: id used for right axis \"".concat(rightId, "\" is not defined."), "Available ids are: ".concat(yAxisIds.join(', '), ".")].join('\n'));
|
|
67
67
|
}
|
|
68
68
|
if (bottomId !== null && !xAxis[bottomId]) {
|
|
69
|
-
throw Error("MUI: id used for bottom axis \"".concat(bottomId, "\" is not defined"));
|
|
69
|
+
throw Error(["MUI-X-Charts: id used for bottom axis \"".concat(bottomId, "\" is not defined."), "Available ids are: ".concat(xAxisIds.join(', '), ".")].join('\n'));
|
|
70
70
|
}
|
|
71
71
|
var topAxisProps = mergeProps(topAxis, slots, slotProps);
|
|
72
72
|
var bottomAxisProps = mergeProps(bottomAxis, slots, slotProps);
|
|
@@ -13,7 +13,8 @@ import { DrawingContext } from '../context/DrawingProvider';
|
|
|
13
13
|
import { getSeriesToDisplay } from './utils';
|
|
14
14
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
15
15
|
import { getLegendUtilityClass } from './chartsLegendClasses';
|
|
16
|
-
import { ChartsText
|
|
16
|
+
import { ChartsText } from '../ChartsText';
|
|
17
|
+
import { getWordsByLines } from '../internals/getWordsByLines';
|
|
17
18
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
18
19
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
20
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -6,10 +6,10 @@ import { ChartsYReferenceLine } from './ChartsYReferenceLine';
|
|
|
6
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
7
|
function ChartsReferenceLine(props) {
|
|
8
8
|
if (props.x !== undefined && props.y !== undefined) {
|
|
9
|
-
throw new Error('MUI-X: The ChartsReferenceLine can not have both `x` and `y` props set.');
|
|
9
|
+
throw new Error('MUI-X-Charts: The ChartsReferenceLine can not have both `x` and `y` props set.');
|
|
10
10
|
}
|
|
11
11
|
if (props.x === undefined && props.y === undefined) {
|
|
12
|
-
throw new Error('MUI-X: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
12
|
+
throw new Error('MUI-X-Charts: The ChartsReferenceLine should have a value in `x` or `y` prop.');
|
|
13
13
|
}
|
|
14
14
|
if (props.x !== undefined) {
|
|
15
15
|
return /*#__PURE__*/_jsx(ChartsXReferenceLine, _extends({}, props));
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
5
5
|
import { useDrawingArea, useXScale } from '../hooks';
|
|
6
6
|
import { ReferenceLineRoot } from './common';
|
|
7
|
-
import { ChartsText } from '../
|
|
7
|
+
import { ChartsText } from '../ChartsText';
|
|
8
8
|
import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -4,7 +4,7 @@ import * as React from 'react';
|
|
|
4
4
|
import composeClasses from '@mui/utils/composeClasses';
|
|
5
5
|
import { useDrawingArea, useYScale } from '../hooks';
|
|
6
6
|
import { ReferenceLineRoot } from './common';
|
|
7
|
-
import { ChartsText } from '../
|
|
7
|
+
import { ChartsText } from '../ChartsText';
|
|
8
8
|
import { getReferenceLineUtilityClass } from './chartsReferenceLineClasses';
|
|
9
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
10
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -1,35 +1,26 @@
|
|
|
1
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
2
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["x", "y", "style", "text", "ownerState"],
|
|
4
4
|
_excluded2 = ["angle", "textAnchor", "dominantBaseline"];
|
|
5
5
|
import * as React from 'react';
|
|
6
|
-
import
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { getWordsByLines } from '../internals/getWordsByLines';
|
|
7
8
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return text.split('\n').map(function (subText) {
|
|
13
|
-
return _extends({
|
|
14
|
-
text: subText
|
|
15
|
-
}, needsComputation ? getStringSize(subText, style) : {
|
|
16
|
-
width: 0,
|
|
17
|
-
height: 0
|
|
18
|
-
});
|
|
19
|
-
});
|
|
20
|
-
}
|
|
21
|
-
export function ChartsText(props) {
|
|
9
|
+
/**
|
|
10
|
+
* Helper component to manage multiline text in SVG
|
|
11
|
+
*/
|
|
12
|
+
function ChartsText(props) {
|
|
22
13
|
var x = props.x,
|
|
23
14
|
y = props.y,
|
|
24
15
|
styleProps = props.style,
|
|
25
16
|
text = props.text,
|
|
26
17
|
ownerState = props.ownerState,
|
|
27
18
|
textProps = _objectWithoutProperties(props, _excluded);
|
|
28
|
-
var
|
|
29
|
-
angle =
|
|
30
|
-
textAnchor =
|
|
31
|
-
dominantBaseline =
|
|
32
|
-
style = _objectWithoutProperties(
|
|
19
|
+
var _ref = styleProps != null ? styleProps : {},
|
|
20
|
+
angle = _ref.angle,
|
|
21
|
+
textAnchor = _ref.textAnchor,
|
|
22
|
+
dominantBaseline = _ref.dominantBaseline,
|
|
23
|
+
style = _objectWithoutProperties(_ref, _excluded2);
|
|
33
24
|
var wordsByLines = React.useMemo(function () {
|
|
34
25
|
return getWordsByLines({
|
|
35
26
|
style: style,
|
|
@@ -76,4 +67,29 @@ export function ChartsText(props) {
|
|
|
76
67
|
}, index);
|
|
77
68
|
})
|
|
78
69
|
}));
|
|
79
|
-
}
|
|
70
|
+
}
|
|
71
|
+
process.env.NODE_ENV !== "production" ? ChartsText.propTypes = {
|
|
72
|
+
// ----------------------------- Warning --------------------------------
|
|
73
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
74
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
75
|
+
// ----------------------------------------------------------------------
|
|
76
|
+
/**
|
|
77
|
+
* Height of a text line (in `em`).
|
|
78
|
+
*/
|
|
79
|
+
lineHeight: PropTypes.number,
|
|
80
|
+
/**
|
|
81
|
+
* If `true`, the line width is computed.
|
|
82
|
+
* @default false
|
|
83
|
+
*/
|
|
84
|
+
needsComputation: PropTypes.bool,
|
|
85
|
+
ownerState: PropTypes.any,
|
|
86
|
+
/**
|
|
87
|
+
* Style applied to text elements.
|
|
88
|
+
*/
|
|
89
|
+
style: PropTypes.object,
|
|
90
|
+
/**
|
|
91
|
+
* Text displayed.
|
|
92
|
+
*/
|
|
93
|
+
text: PropTypes.string.isRequired
|
|
94
|
+
} : void 0;
|
|
95
|
+
export { ChartsText };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ChartsText } from './ChartsText';
|
|
@@ -12,9 +12,10 @@ import { DrawingContext } from '../context/DrawingProvider';
|
|
|
12
12
|
import useTicks from '../hooks/useTicks';
|
|
13
13
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
14
14
|
import { AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
15
|
-
import { ChartsText
|
|
15
|
+
import { ChartsText } from '../ChartsText';
|
|
16
16
|
import { getMinXTranslation } from '../internals/geometry';
|
|
17
17
|
import { useMounted } from '../hooks/useMounted';
|
|
18
|
+
import { getWordsByLines } from '../internals/getWordsByLines';
|
|
18
19
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
19
20
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
21
|
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
@@ -10,7 +10,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
10
10
|
import { DrawingContext } from '../context/DrawingProvider';
|
|
11
11
|
import useTicks from '../hooks/useTicks';
|
|
12
12
|
import { AxisRoot } from '../internals/components/AxisSharedComponents';
|
|
13
|
-
import { ChartsText } from '../
|
|
13
|
+
import { ChartsText } from '../ChartsText';
|
|
14
14
|
import { getAxisUtilityClass } from '../ChartsAxis/axisClasses';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
@@ -9,6 +9,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
9
9
|
import { AreaElement } from './AreaElement';
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
11
|
import getCurveFactory from '../internals/getCurve';
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
/**
|
|
14
15
|
* Demos:
|
|
@@ -56,10 +57,10 @@ function AreaPlot(props) {
|
|
|
56
57
|
var xData = xAxis[xAxisKey].data;
|
|
57
58
|
if (process.env.NODE_ENV !== 'production') {
|
|
58
59
|
if (xData === undefined) {
|
|
59
|
-
throw new Error("
|
|
60
|
+
throw new Error("MUI-X-Charts: ".concat(xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : "The x-axis with id \"".concat(xAxisKey, "\""), " should have data property to be able to display a line plot."));
|
|
60
61
|
}
|
|
61
62
|
if (xData.length < stackedData.length) {
|
|
62
|
-
throw new Error("MUI: data length of the x axis (".concat(xData.length, " items) is lower than the length of series (").concat(stackedData.length, " items)"));
|
|
63
|
+
throw new Error("MUI-X-Charts: The data length of the x axis (".concat(xData.length, " items) is lower than the length of series (").concat(stackedData.length, " items)"));
|
|
63
64
|
}
|
|
64
65
|
}
|
|
65
66
|
var areaPath = d3Area().x(function (d) {
|
|
@@ -8,6 +8,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
8
8
|
import { LineHighlightElement } from './LineHighlightElement';
|
|
9
9
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
10
10
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
11
|
+
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
/**
|
|
13
14
|
* Demos:
|
|
@@ -63,7 +64,7 @@ function LineHighlightPlot(props) {
|
|
|
63
64
|
var yScale = yAxis[yAxisKey].scale;
|
|
64
65
|
var xData = xAxis[xAxisKey].data;
|
|
65
66
|
if (xData === undefined) {
|
|
66
|
-
throw new Error("
|
|
67
|
+
throw new Error("MUI-X-Charts: ".concat(xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : "The x-axis with id \"".concat(xAxisKey, "\""), " should have data property to be able to display a line plot."));
|
|
67
68
|
}
|
|
68
69
|
var x = xScale(xData[highlightedIndex]);
|
|
69
70
|
var y = yScale(stackedData[highlightedIndex][1]); // This should not be undefined since y should not be a band scale
|
|
@@ -9,6 +9,7 @@ import { CartesianContext } from '../context/CartesianContextProvider';
|
|
|
9
9
|
import { LineElement } from './LineElement';
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
11
|
import getCurveFactory from '../internals/getCurve';
|
|
12
|
+
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
12
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
14
|
/**
|
|
14
15
|
* Demos:
|
|
@@ -55,10 +56,10 @@ function LinePlot(props) {
|
|
|
55
56
|
var xData = xAxis[xAxisKey].data;
|
|
56
57
|
if (process.env.NODE_ENV !== 'production') {
|
|
57
58
|
if (xData === undefined) {
|
|
58
|
-
throw new Error("
|
|
59
|
+
throw new Error("MUI-X-Charts: ".concat(xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : "The x-axis with id \"".concat(xAxisKey, "\""), " should have data property to be able to display a line plot"));
|
|
59
60
|
}
|
|
60
61
|
if (xData.length < stackedData.length) {
|
|
61
|
-
throw new Error("MUI: data length of the x axis (".concat(xData.length, " items) is lower than the length of series (").concat(stackedData.length, " items)"));
|
|
62
|
+
throw new Error("MUI-X-Charts: The data length of the x axis (".concat(xData.length, " items) is lower than the length of series (").concat(stackedData.length, " items)"));
|
|
62
63
|
}
|
|
63
64
|
}
|
|
64
65
|
var linePath = d3Line().x(function (d) {
|
|
@@ -8,6 +8,7 @@ import { SeriesContext } from '../context/SeriesContextProvider';
|
|
|
8
8
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
9
9
|
import { MarkElement } from './MarkElement';
|
|
10
10
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
11
|
+
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
/**
|
|
13
14
|
* Demos:
|
|
@@ -71,7 +72,7 @@ function MarkPlot(props) {
|
|
|
71
72
|
return true;
|
|
72
73
|
};
|
|
73
74
|
if (xData === undefined) {
|
|
74
|
-
throw new Error("
|
|
75
|
+
throw new Error("MUI-X-Charts: ".concat(xAxisKey === DEFAULT_X_AXIS_KEY ? 'The first `xAxis`' : "The x-axis with id \"".concat(xAxisKey, "\""), " should have data property to be able to display a line plot"));
|
|
75
76
|
}
|
|
76
77
|
return xData == null ? void 0 : xData.map(function (x, index) {
|
|
77
78
|
var value = data[index] == null ? null : stackedData[index][1];
|
|
@@ -4,14 +4,17 @@ import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
|
4
4
|
import { stack as d3Stack } from 'd3-shape';
|
|
5
5
|
import { getStackingGroups } from '../internals/stackSeries';
|
|
6
6
|
import defaultizeValueFormatter from '../internals/defaultizeValueFormatter';
|
|
7
|
+
var warnedOnce = false;
|
|
8
|
+
|
|
7
9
|
// For now it's a copy past of bar charts formatter, but maybe will diverge later
|
|
8
10
|
var formatter = function formatter(params, dataset) {
|
|
11
|
+
var _ref;
|
|
9
12
|
var seriesOrder = params.seriesOrder,
|
|
10
13
|
series = params.series;
|
|
11
14
|
var stackingGroups = getStackingGroups(params);
|
|
12
15
|
|
|
13
16
|
// Create a data set with format adapted to d3
|
|
14
|
-
var d3Dataset = dataset != null ?
|
|
17
|
+
var d3Dataset = (_ref = dataset) != null ? _ref : [];
|
|
15
18
|
seriesOrder.forEach(function (id) {
|
|
16
19
|
var data = series[id].data;
|
|
17
20
|
if (data !== undefined) {
|
|
@@ -23,7 +26,7 @@ var formatter = function formatter(params, dataset) {
|
|
|
23
26
|
}
|
|
24
27
|
});
|
|
25
28
|
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
26
|
-
throw new Error(["MUI: line series with id='".concat(id, "' has no data."), 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
29
|
+
throw new Error(["MUI-X-Charts: line series with id='".concat(id, "' has no data."), 'Either provide a data property to the series or use the dataset prop.'].join('\n'));
|
|
27
30
|
}
|
|
28
31
|
});
|
|
29
32
|
var completedSeries = {};
|
|
@@ -44,13 +47,21 @@ var formatter = function formatter(params, dataset) {
|
|
|
44
47
|
ids.forEach(function (id, index) {
|
|
45
48
|
var dataKey = series[id].dataKey;
|
|
46
49
|
completedSeries[id] = _extends({}, series[id], {
|
|
47
|
-
data: dataKey ? dataset.map(function (
|
|
48
|
-
|
|
50
|
+
data: dataKey ? dataset.map(function (data) {
|
|
51
|
+
var value = data[dataKey];
|
|
52
|
+
if (typeof value !== 'number') {
|
|
53
|
+
if (process.env.NODE_ENV !== 'production' && !warnedOnce && value !== null) {
|
|
54
|
+
warnedOnce = true;
|
|
55
|
+
console.error(["MUI-X charts: your dataset key \"".concat(dataKey, "\" is used for plotting line, but contains nonnumerical elements."), 'Line plots only support numbers and null values.']);
|
|
56
|
+
}
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
return value;
|
|
49
60
|
}) : series[id].data,
|
|
50
|
-
stackedData: stackedSeries[index].map(function (
|
|
51
|
-
var
|
|
52
|
-
a =
|
|
53
|
-
b =
|
|
61
|
+
stackedData: stackedSeries[index].map(function (_ref2) {
|
|
62
|
+
var _ref3 = _slicedToArray(_ref2, 2),
|
|
63
|
+
a = _ref3[0],
|
|
64
|
+
b = _ref3[1];
|
|
54
65
|
return [a, b];
|
|
55
66
|
})
|
|
56
67
|
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
var _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "
|
|
4
|
+
var _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { animated, to } from '@react-spring/web';
|
|
@@ -44,7 +44,7 @@ var PieArcLabelRoot = styled(animated.text, {
|
|
|
44
44
|
* It's not an inline function because we need it in inerpolation.
|
|
45
45
|
*/
|
|
46
46
|
var getLabelPosition = function getLabelPosition(formattedArcLabel, variable) {
|
|
47
|
-
return function (startAngle, endAngle, padAngle,
|
|
47
|
+
return function (startAngle, endAngle, padAngle, arcLabelRadius, cornerRadius) {
|
|
48
48
|
if (!formattedArcLabel) {
|
|
49
49
|
return 0;
|
|
50
50
|
}
|
|
@@ -52,8 +52,8 @@ var getLabelPosition = function getLabelPosition(formattedArcLabel, variable) {
|
|
|
52
52
|
padAngle: padAngle,
|
|
53
53
|
startAngle: startAngle,
|
|
54
54
|
endAngle: endAngle,
|
|
55
|
-
innerRadius:
|
|
56
|
-
outerRadius:
|
|
55
|
+
innerRadius: arcLabelRadius,
|
|
56
|
+
outerRadius: arcLabelRadius
|
|
57
57
|
}),
|
|
58
58
|
_ref3 = _slicedToArray(_ref2, 2),
|
|
59
59
|
x = _ref3[0],
|
|
@@ -71,8 +71,7 @@ function PieArcLabel(props) {
|
|
|
71
71
|
startAngle = props.startAngle,
|
|
72
72
|
endAngle = props.endAngle,
|
|
73
73
|
paddingAngle = props.paddingAngle,
|
|
74
|
-
|
|
75
|
-
outerRadius = props.outerRadius,
|
|
74
|
+
arcLabelRadius = props.arcLabelRadius,
|
|
76
75
|
cornerRadius = props.cornerRadius,
|
|
77
76
|
formattedArcLabel = props.formattedArcLabel,
|
|
78
77
|
isHighlighted = props.isHighlighted,
|
|
@@ -91,8 +90,8 @@ function PieArcLabel(props) {
|
|
|
91
90
|
className: classes.root
|
|
92
91
|
}, other, {
|
|
93
92
|
style: _extends({
|
|
94
|
-
x: to([startAngle, endAngle, paddingAngle,
|
|
95
|
-
y: to([startAngle, endAngle, paddingAngle,
|
|
93
|
+
x: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
|
|
94
|
+
y: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
|
|
96
95
|
}, style),
|
|
97
96
|
children: formattedArcLabel
|
|
98
97
|
}));
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
4
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
3
|
+
var _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
4
|
+
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useTransition } from '@react-spring/web';
|
|
@@ -28,9 +28,9 @@ function PieArcLabelPlot(props) {
|
|
|
28
28
|
var _slots$pieArcLabel;
|
|
29
29
|
var slots = props.slots,
|
|
30
30
|
slotProps = props.slotProps,
|
|
31
|
-
|
|
32
|
-
innerRadius = _props$innerRadius === void 0 ? 0 : _props$innerRadius,
|
|
31
|
+
innerRadius = props.innerRadius,
|
|
33
32
|
outerRadius = props.outerRadius,
|
|
33
|
+
arcLabelRadius = props.arcLabelRadius,
|
|
34
34
|
_props$cornerRadius = props.cornerRadius,
|
|
35
35
|
cornerRadius = _props$cornerRadius === void 0 ? 0 : _props$cornerRadius,
|
|
36
36
|
_props$paddingAngle = props.paddingAngle,
|
|
@@ -51,6 +51,7 @@ function PieArcLabelPlot(props) {
|
|
|
51
51
|
var transformedData = useTransformData({
|
|
52
52
|
innerRadius: innerRadius,
|
|
53
53
|
outerRadius: outerRadius,
|
|
54
|
+
arcLabelRadius: arcLabelRadius,
|
|
54
55
|
cornerRadius: cornerRadius,
|
|
55
56
|
paddingAngle: paddingAngle,
|
|
56
57
|
id: id,
|
|
@@ -73,6 +74,7 @@ function PieArcLabelPlot(props) {
|
|
|
73
74
|
pA = _ref.paddingAngle,
|
|
74
75
|
iR = _ref.innerRadius,
|
|
75
76
|
oR = _ref.outerRadius,
|
|
77
|
+
aLR = _ref.arcLabelRadius,
|
|
76
78
|
cR = _ref.cornerRadius,
|
|
77
79
|
style = _objectWithoutProperties(_ref, _excluded2);
|
|
78
80
|
return /*#__PURE__*/_jsx(ArcLabel, _extends({
|
|
@@ -81,6 +83,7 @@ function PieArcLabelPlot(props) {
|
|
|
81
83
|
paddingAngle: pA,
|
|
82
84
|
innerRadius: iR,
|
|
83
85
|
outerRadius: oR,
|
|
86
|
+
arcLabelRadius: aLR,
|
|
84
87
|
cornerRadius: cR,
|
|
85
88
|
style: style,
|
|
86
89
|
id: id,
|
|
@@ -105,6 +108,11 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
105
108
|
* The minimal angle required to display the arc label.
|
|
106
109
|
*/
|
|
107
110
|
arcLabelMinAngle: PropTypes.number,
|
|
111
|
+
/**
|
|
112
|
+
* The radius between circle center and the arc label in px.
|
|
113
|
+
* @default (innerRadius - outerRadius) / 2
|
|
114
|
+
*/
|
|
115
|
+
arcLabelRadius: PropTypes.number,
|
|
108
116
|
/**
|
|
109
117
|
* The radius applied to arc corners (similar to border radius).
|
|
110
118
|
* @default 0
|
|
@@ -126,6 +134,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
126
134
|
*/
|
|
127
135
|
faded: PropTypes.shape({
|
|
128
136
|
additionalRadius: PropTypes.number,
|
|
137
|
+
arcLabelRadius: PropTypes.number,
|
|
129
138
|
color: PropTypes.string,
|
|
130
139
|
cornerRadius: PropTypes.number,
|
|
131
140
|
innerRadius: PropTypes.number,
|
|
@@ -137,6 +146,7 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
137
146
|
*/
|
|
138
147
|
highlighted: PropTypes.shape({
|
|
139
148
|
additionalRadius: PropTypes.number,
|
|
149
|
+
arcLabelRadius: PropTypes.number,
|
|
140
150
|
color: PropTypes.string,
|
|
141
151
|
cornerRadius: PropTypes.number,
|
|
142
152
|
innerRadius: PropTypes.number,
|
|
@@ -155,7 +165,6 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
155
165
|
innerRadius: PropTypes.number,
|
|
156
166
|
/**
|
|
157
167
|
* The radius between circle center and the end of the arc.
|
|
158
|
-
* @default R_max The maximal radius that fit into the drawing area.
|
|
159
168
|
*/
|
|
160
169
|
outerRadius: PropTypes.number.isRequired,
|
|
161
170
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
3
|
var _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onClick", "skipAnimation"],
|
|
4
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
4
|
+
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
|
|
5
5
|
import * as React from 'react';
|
|
6
6
|
import PropTypes from 'prop-types';
|
|
7
7
|
import { useTransition } from '@react-spring/web';
|
|
@@ -55,6 +55,7 @@ function PieArcPlot(props) {
|
|
|
55
55
|
endAngle = _ref.endAngle,
|
|
56
56
|
pA = _ref.paddingAngle,
|
|
57
57
|
iR = _ref.innerRadius,
|
|
58
|
+
arcLabelRadius = _ref.arcLabelRadius,
|
|
58
59
|
oR = _ref.outerRadius,
|
|
59
60
|
cR = _ref.cornerRadius,
|
|
60
61
|
style = _objectWithoutProperties(_ref, _excluded2);
|
|
@@ -88,6 +89,11 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
88
89
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
89
90
|
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
90
91
|
// ----------------------------------------------------------------------
|
|
92
|
+
/**
|
|
93
|
+
* The radius between circle center and the arc label in px.
|
|
94
|
+
* @default (innerRadius - outerRadius) / 2
|
|
95
|
+
*/
|
|
96
|
+
arcLabelRadius: PropTypes.number,
|
|
91
97
|
/**
|
|
92
98
|
* The radius applied to arc corners (similar to border radius).
|
|
93
99
|
* @default 0
|
|
@@ -109,6 +115,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
109
115
|
*/
|
|
110
116
|
faded: PropTypes.shape({
|
|
111
117
|
additionalRadius: PropTypes.number,
|
|
118
|
+
arcLabelRadius: PropTypes.number,
|
|
112
119
|
color: PropTypes.string,
|
|
113
120
|
cornerRadius: PropTypes.number,
|
|
114
121
|
innerRadius: PropTypes.number,
|
|
@@ -120,6 +127,7 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
120
127
|
*/
|
|
121
128
|
highlighted: PropTypes.shape({
|
|
122
129
|
additionalRadius: PropTypes.number,
|
|
130
|
+
arcLabelRadius: PropTypes.number,
|
|
123
131
|
color: PropTypes.string,
|
|
124
132
|
cornerRadius: PropTypes.number,
|
|
125
133
|
innerRadius: PropTypes.number,
|
|
@@ -145,7 +153,6 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
145
153
|
onClick: PropTypes.func,
|
|
146
154
|
/**
|
|
147
155
|
* The radius between circle center and the end of the arc.
|
|
148
|
-
* @default R_max The maximal radius that fit into the drawing area.
|
|
149
156
|
*/
|
|
150
157
|
outerRadius: PropTypes.number.isRequired,
|
|
151
158
|
/**
|