@mui/x-charts 6.0.0-alpha.1 → 6.0.0-alpha.3
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 +1 -4
- package/BarChart/BarChart.js +6 -3
- package/BarChart/BarPlot.js +42 -8
- package/BarChart/legend.d.ts +3 -0
- package/BarChart/legend.js +20 -0
- package/CHANGELOG.md +287 -107
- package/ChartContainer/index.d.ts +3 -1
- package/ChartContainer/index.js +10 -6
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -2
- package/ChartsLegend/ChartsLegend.d.ts +5 -1
- package/ChartsLegend/ChartsLegend.js +5 -1
- package/ChartsLegend/utils.d.ts +1 -1
- package/ChartsLegend/utils.js +12 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/ChartsTooltip/ChartsItemTooltipContent.js +11 -2
- package/LineChart/LineChart.d.ts +1 -4
- package/LineChart/LineChart.js +6 -3
- package/LineChart/legend.d.ts +3 -0
- package/LineChart/legend.js +20 -0
- package/PieChart/PieArc.d.ts +36 -0
- package/PieChart/PieArc.js +128 -0
- package/PieChart/PieArcLabel.d.ts +36 -0
- package/PieChart/PieArcLabel.js +113 -0
- package/PieChart/PieChart.d.ts +20 -0
- package/PieChart/PieChart.js +292 -0
- package/PieChart/PiePlot.d.ts +2 -0
- package/PieChart/PiePlot.js +98 -0
- package/PieChart/formatter.d.ts +3 -0
- package/PieChart/formatter.js +49 -0
- package/PieChart/index.d.ts +4 -0
- package/PieChart/index.js +47 -0
- package/PieChart/legend.d.ts +3 -0
- package/PieChart/legend.js +19 -0
- package/PieChart/package.json +6 -0
- package/README.md +2 -2
- package/ResponsiveChartContainer/index.d.ts +1 -1
- package/ResponsiveChartContainer/index.js +22 -9
- package/ScatterChart/Scatter.d.ts +1 -1
- package/ScatterChart/Scatter.js +1 -1
- package/ScatterChart/ScatterChart.d.ts +1 -4
- package/ScatterChart/ScatterChart.js +6 -3
- package/ScatterChart/legend.d.ts +3 -0
- package/ScatterChart/legend.js +20 -0
- package/context/CartesianContextProvider.js +31 -20
- package/context/SeriesContextProvider.js +11 -1
- package/esm/BarChart/BarChart.js +4 -2
- package/esm/BarChart/BarPlot.js +44 -8
- package/esm/BarChart/legend.js +13 -0
- package/esm/ChartContainer/index.js +7 -5
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -2
- package/esm/ChartsLegend/ChartsLegend.js +5 -1
- package/esm/ChartsLegend/utils.js +11 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +11 -3
- package/esm/LineChart/LineChart.js +4 -2
- package/esm/LineChart/legend.js +13 -0
- package/esm/PieChart/PieArc.js +117 -0
- package/esm/PieChart/PieArcLabel.js +101 -0
- package/esm/PieChart/PieChart.js +285 -0
- package/esm/PieChart/PiePlot.js +92 -0
- package/esm/PieChart/formatter.js +48 -0
- package/esm/PieChart/index.js +4 -0
- package/esm/PieChart/legend.js +12 -0
- package/esm/ResponsiveChartContainer/index.js +20 -8
- package/esm/ScatterChart/Scatter.js +1 -1
- package/esm/ScatterChart/ScatterChart.js +4 -2
- package/esm/ScatterChart/legend.js +13 -0
- package/esm/context/CartesianContextProvider.js +31 -18
- package/esm/context/SeriesContextProvider.js +11 -1
- package/esm/hooks/index.js +2 -0
- package/esm/hooks/useAxisEvents.js +12 -7
- package/esm/hooks/useDrawingArea.js +16 -0
- package/esm/hooks/useScale.js +19 -21
- package/esm/hooks/useTicks.js +26 -13
- package/esm/index.js +2 -0
- package/esm/internals/defaultizeColor.js +7 -0
- package/esm/internals/getScale.js +17 -0
- package/esm/internals/isBandScale.js +3 -0
- package/esm/models/axis.js +6 -1
- package/esm/models/seriesType/index.js +1 -8
- package/hooks/index.d.ts +2 -0
- package/hooks/index.js +27 -0
- package/hooks/package.json +6 -0
- package/hooks/useAxisEvents.js +14 -9
- package/hooks/useDrawingArea.d.ts +6 -0
- package/hooks/useDrawingArea.js +24 -0
- package/hooks/useScale.d.ts +3 -6
- package/hooks/useScale.js +24 -24
- package/hooks/useTicks.d.ts +1 -1
- package/hooks/useTicks.js +19 -9
- package/index.d.ts +2 -0
- package/index.js +23 -1
- package/internals/defaultizeColor.d.ts +35 -0
- package/internals/defaultizeColor.js +7 -0
- package/internals/getScale.d.ts +2 -0
- package/internals/getScale.js +23 -0
- package/internals/isBandScale.d.ts +3 -0
- package/internals/isBandScale.js +9 -0
- package/legacy/BarChart/BarChart.js +4 -2
- package/legacy/BarChart/BarPlot.js +44 -10
- package/legacy/BarChart/legend.js +15 -0
- package/legacy/ChartContainer/index.js +7 -5
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -2
- package/legacy/ChartsLegend/ChartsLegend.js +5 -1
- package/legacy/ChartsLegend/utils.js +12 -6
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +3 -1
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +10 -3
- package/legacy/LineChart/LineChart.js +4 -2
- package/legacy/LineChart/legend.js +15 -0
- package/legacy/PieChart/PieArc.js +118 -0
- package/legacy/PieChart/PieArcLabel.js +101 -0
- package/legacy/PieChart/PieChart.js +297 -0
- package/legacy/PieChart/PiePlot.js +89 -0
- package/legacy/PieChart/formatter.js +55 -0
- package/legacy/PieChart/index.js +4 -0
- package/legacy/PieChart/legend.js +16 -0
- package/legacy/ResponsiveChartContainer/index.js +18 -8
- package/legacy/ScatterChart/Scatter.js +1 -1
- package/legacy/ScatterChart/ScatterChart.js +4 -2
- package/legacy/ScatterChart/legend.js +15 -0
- package/legacy/context/CartesianContextProvider.js +31 -18
- package/legacy/context/SeriesContextProvider.js +11 -1
- package/legacy/hooks/index.js +2 -0
- package/legacy/hooks/useAxisEvents.js +12 -7
- package/legacy/hooks/useDrawingArea.js +17 -0
- package/legacy/hooks/useScale.js +17 -21
- package/legacy/hooks/useTicks.js +26 -13
- package/legacy/index.js +3 -1
- package/legacy/internals/defaultizeColor.js +9 -0
- package/legacy/internals/getScale.js +17 -0
- package/legacy/internals/isBandScale.js +3 -0
- package/legacy/models/axis.js +6 -1
- package/legacy/models/seriesType/index.js +1 -8
- package/models/axis.d.ts +25 -12
- package/models/axis.js +9 -1
- package/models/seriesType/bar.d.ts +1 -1
- package/models/seriesType/common.d.ts +1 -1
- package/models/seriesType/config.d.ts +29 -2
- package/models/seriesType/index.d.ts +7 -3
- package/models/seriesType/index.js +11 -0
- package/models/seriesType/line.d.ts +1 -1
- package/models/seriesType/pie.d.ts +103 -3
- package/models/seriesType/scatter.d.ts +1 -1
- package/modern/BarChart/BarChart.js +4 -2
- package/modern/BarChart/BarPlot.js +44 -8
- package/modern/BarChart/legend.js +13 -0
- package/modern/ChartContainer/index.js +7 -5
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +3 -2
- package/modern/ChartsLegend/ChartsLegend.js +5 -1
- package/modern/ChartsLegend/utils.js +11 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +11 -2
- package/modern/LineChart/LineChart.js +4 -2
- package/modern/LineChart/legend.js +13 -0
- package/modern/PieChart/PieArc.js +116 -0
- package/modern/PieChart/PieArcLabel.js +101 -0
- package/modern/PieChart/PieChart.js +285 -0
- package/modern/PieChart/PiePlot.js +91 -0
- package/modern/PieChart/formatter.js +41 -0
- package/modern/PieChart/index.js +4 -0
- package/modern/PieChart/legend.js +12 -0
- package/modern/ResponsiveChartContainer/index.js +20 -8
- package/modern/ScatterChart/Scatter.js +1 -1
- package/modern/ScatterChart/ScatterChart.js +4 -2
- package/modern/ScatterChart/legend.js +13 -0
- package/modern/context/CartesianContextProvider.js +29 -18
- package/modern/context/SeriesContextProvider.js +11 -1
- package/modern/hooks/index.js +2 -0
- package/modern/hooks/useAxisEvents.js +12 -7
- package/modern/hooks/useDrawingArea.js +16 -0
- package/modern/hooks/useScale.js +19 -21
- package/modern/hooks/useTicks.js +18 -8
- package/modern/index.js +3 -1
- package/modern/internals/defaultizeColor.js +7 -0
- package/modern/internals/getScale.js +17 -0
- package/modern/internals/isBandScale.js +3 -0
- package/modern/models/axis.js +6 -1
- package/modern/models/seriesType/index.js +1 -8
- package/package.json +1 -1
|
@@ -4,7 +4,7 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.ScatterChart =
|
|
7
|
+
exports.ScatterChart = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
10
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
@@ -17,7 +17,7 @@ var _ChartsAxisHighlight = require("../ChartsAxisHighlight");
|
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
19
19
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
20
|
-
function ScatterChart(props) {
|
|
20
|
+
const ScatterChart = /*#__PURE__*/React.forwardRef(function ScatterChart(props, ref) {
|
|
21
21
|
const {
|
|
22
22
|
xAxis,
|
|
23
23
|
yAxis,
|
|
@@ -37,6 +37,7 @@ function ScatterChart(props) {
|
|
|
37
37
|
children
|
|
38
38
|
} = props;
|
|
39
39
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainer.ResponsiveChartContainer, {
|
|
40
|
+
ref: ref,
|
|
40
41
|
series: series.map(s => (0, _extends2.default)({
|
|
41
42
|
type: 'scatter'
|
|
42
43
|
}, s)),
|
|
@@ -59,7 +60,8 @@ function ScatterChart(props) {
|
|
|
59
60
|
trigger: "item"
|
|
60
61
|
}, tooltip)), children]
|
|
61
62
|
});
|
|
62
|
-
}
|
|
63
|
+
});
|
|
64
|
+
exports.ScatterChart = ScatterChart;
|
|
63
65
|
process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
64
66
|
// ----------------------------- Warning --------------------------------
|
|
65
67
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -117,6 +119,7 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
117
119
|
legend: _propTypes.default.shape({
|
|
118
120
|
classes: _propTypes.default.object,
|
|
119
121
|
direction: _propTypes.default.oneOf(['column', 'row']),
|
|
122
|
+
hidden: _propTypes.default.bool,
|
|
120
123
|
itemWidth: _propTypes.default.number,
|
|
121
124
|
markSize: _propTypes.default.number,
|
|
122
125
|
offset: _propTypes.default.shape({
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const legendGetter = params => {
|
|
8
|
+
const {
|
|
9
|
+
seriesOrder,
|
|
10
|
+
series
|
|
11
|
+
} = params;
|
|
12
|
+
const data = seriesOrder.map(seriesId => ({
|
|
13
|
+
color: series[seriesId].color,
|
|
14
|
+
label: series[seriesId].label,
|
|
15
|
+
id: seriesId
|
|
16
|
+
}));
|
|
17
|
+
return data.filter(item => item.label !== undefined);
|
|
18
|
+
};
|
|
19
|
+
var _default = legendGetter;
|
|
20
|
+
exports.default = _default;
|
|
@@ -13,7 +13,8 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
13
13
|
var _extremums = require("../BarChart/extremums");
|
|
14
14
|
var _extremums2 = require("../ScatterChart/extremums");
|
|
15
15
|
var _extremums3 = require("../LineChart/extremums");
|
|
16
|
-
var
|
|
16
|
+
var _axis = require("../models/axis");
|
|
17
|
+
var _getScale = require("../internals/getScale");
|
|
17
18
|
var _DrawingProvider = require("./DrawingProvider");
|
|
18
19
|
var _SeriesContextProvider = require("./SeriesContextProvider");
|
|
19
20
|
var _constants = require("../constants");
|
|
@@ -21,6 +22,8 @@ var _useTicks = require("../hooks/useTicks");
|
|
|
21
22
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
23
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
23
24
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
25
|
+
const DEFAULT_CATEGORY_GAP_RATIO = 0.1;
|
|
26
|
+
|
|
24
27
|
// TODO: those might be better placed in a distinct file
|
|
25
28
|
const xExtremumGetters = {
|
|
26
29
|
bar: _extremums.getExtremumX,
|
|
@@ -82,29 +85,33 @@ function CartesianContextProvider({
|
|
|
82
85
|
allXAxis.forEach((axis, axisIndex) => {
|
|
83
86
|
const isDefaultAxis = axisIndex === 0;
|
|
84
87
|
const [minData, maxData] = getAxisExtremum(axis, xExtremumGetters, isDefaultAxis);
|
|
85
|
-
const scaleType = axis.scaleType ?? 'linear';
|
|
86
88
|
const range = [drawingArea.left, drawingArea.left + drawingArea.width];
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
89
|
+
if ((0, _axis.isBandScaleConfig)(axis)) {
|
|
90
|
+
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
91
|
+
completedXAxis[axis.id] = (0, _extends2.default)({
|
|
92
|
+
categoryGapRatio,
|
|
93
|
+
barGapRatio: 0
|
|
94
|
+
}, axis, {
|
|
95
|
+
scale: (0, _d3Scale.scaleBand)(axis.data, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
91
96
|
ticksNumber: axis.data.length
|
|
92
97
|
});
|
|
93
|
-
return;
|
|
94
98
|
}
|
|
95
|
-
if (
|
|
99
|
+
if ((0, _axis.isPointScaleConfig)(axis)) {
|
|
96
100
|
completedXAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
97
|
-
scaleType,
|
|
98
101
|
scale: (0, _d3Scale.scalePoint)(axis.data, range),
|
|
99
102
|
ticksNumber: axis.data.length
|
|
100
103
|
});
|
|
104
|
+
}
|
|
105
|
+
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
106
|
+
// Could be merged with the two previous "if conditions" but then TS does not get that `axis.scaleType` can't be `band` or `point`.
|
|
101
107
|
return;
|
|
102
108
|
}
|
|
109
|
+
const scaleType = axis.scaleType ?? 'linear';
|
|
103
110
|
const extremums = [axis.min ?? minData, axis.max ?? maxData];
|
|
104
111
|
const ticksNumber = (0, _useTicks.getTicksNumber)((0, _extends2.default)({}, axis, {
|
|
105
112
|
range
|
|
106
113
|
}));
|
|
107
|
-
const niceScale = (0,
|
|
114
|
+
const niceScale = (0, _getScale.getScale)(scaleType, extremums, range).nice(ticksNumber);
|
|
108
115
|
const niceDomain = niceScale.domain();
|
|
109
116
|
const domain = [axis.min ?? niceDomain[0], axis.max ?? niceDomain[1]];
|
|
110
117
|
completedXAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
@@ -126,28 +133,32 @@ function CartesianContextProvider({
|
|
|
126
133
|
const isDefaultAxis = axisIndex === 0;
|
|
127
134
|
const [minData, maxData] = getAxisExtremum(axis, yExtremumGetters, isDefaultAxis);
|
|
128
135
|
const range = [drawingArea.top + drawingArea.height, drawingArea.top];
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
136
|
+
if ((0, _axis.isBandScaleConfig)(axis)) {
|
|
137
|
+
const categoryGapRatio = axis.categoryGapRatio ?? DEFAULT_CATEGORY_GAP_RATIO;
|
|
138
|
+
completedXAxis[axis.id] = (0, _extends2.default)({
|
|
139
|
+
categoryGapRatio,
|
|
140
|
+
barGapRatio: 0
|
|
141
|
+
}, axis, {
|
|
142
|
+
scale: (0, _d3Scale.scaleBand)(axis.data, range).paddingInner(categoryGapRatio).paddingOuter(categoryGapRatio / 2),
|
|
134
143
|
ticksNumber: axis.data.length
|
|
135
144
|
});
|
|
136
|
-
return;
|
|
137
145
|
}
|
|
138
|
-
if (
|
|
139
|
-
|
|
140
|
-
scaleType,
|
|
146
|
+
if ((0, _axis.isPointScaleConfig)(axis)) {
|
|
147
|
+
completedXAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
141
148
|
scale: (0, _d3Scale.scalePoint)(axis.data, range),
|
|
142
149
|
ticksNumber: axis.data.length
|
|
143
150
|
});
|
|
151
|
+
}
|
|
152
|
+
if (axis.scaleType === 'band' || axis.scaleType === 'point') {
|
|
153
|
+
// Could be merged with the two previous "if conditions" but then TS does not get that `axis.scaleType` can't be `band` or `point`.
|
|
144
154
|
return;
|
|
145
155
|
}
|
|
156
|
+
const scaleType = axis.scaleType ?? 'linear';
|
|
146
157
|
const extremums = [axis.min ?? minData, axis.max ?? maxData];
|
|
147
158
|
const ticksNumber = (0, _useTicks.getTicksNumber)((0, _extends2.default)({}, axis, {
|
|
148
159
|
range
|
|
149
160
|
}));
|
|
150
|
-
const niceScale = (0,
|
|
161
|
+
const niceScale = (0, _getScale.getScale)(scaleType, extremums, range).nice(ticksNumber);
|
|
151
162
|
const niceDomain = niceScale.domain();
|
|
152
163
|
const domain = [axis.min ?? niceDomain[0], axis.max ?? niceDomain[1]];
|
|
153
164
|
completedYAxis[axis.id] = (0, _extends2.default)({}, axis, {
|
|
@@ -12,6 +12,7 @@ var _styles = require("@mui/material/styles");
|
|
|
12
12
|
var _formatter = _interopRequireDefault(require("../BarChart/formatter"));
|
|
13
13
|
var _formatter2 = _interopRequireDefault(require("../ScatterChart/formatter"));
|
|
14
14
|
var _formatter3 = _interopRequireDefault(require("../LineChart/formatter"));
|
|
15
|
+
var _formatter4 = _interopRequireDefault(require("../PieChart/formatter"));
|
|
15
16
|
var _defaultizeColor = require("../internals/defaultizeColor");
|
|
16
17
|
var _colorPalettes = require("../colorPalettes");
|
|
17
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
@@ -22,8 +23,17 @@ exports.SeriesContext = SeriesContext;
|
|
|
22
23
|
const seriesTypeFormatter = {
|
|
23
24
|
bar: _formatter.default,
|
|
24
25
|
scatter: _formatter2.default,
|
|
25
|
-
line: _formatter3.default
|
|
26
|
+
line: _formatter3.default,
|
|
27
|
+
pie: _formatter4.default
|
|
26
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* This methods is the interface between what the developer is providing and what components receives
|
|
31
|
+
* To simplify the components behaviors, it groups series by type, such that LinePlots props are not updated if some line data are modified
|
|
32
|
+
* It also add defaultized values such as the ids, colors
|
|
33
|
+
* @param series The array of series provided by devs
|
|
34
|
+
* @param colors The color palette used to defaultize series colors
|
|
35
|
+
* @returns An object structuring all the series by type.
|
|
36
|
+
*/
|
|
27
37
|
const formatSeries = (series, colors) => {
|
|
28
38
|
// Group series by type
|
|
29
39
|
const seriesGroups = {};
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -12,7 +12,7 @@ import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
|
12
12
|
import { ChartsClipPath } from '../ChartsClipPath';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
15
|
-
function BarChart(props) {
|
|
15
|
+
const BarChart = /*#__PURE__*/React.forwardRef(function BarChart(props, ref) {
|
|
16
16
|
const {
|
|
17
17
|
xAxis,
|
|
18
18
|
yAxis,
|
|
@@ -34,6 +34,7 @@ function BarChart(props) {
|
|
|
34
34
|
const id = useId();
|
|
35
35
|
const clipPathId = `${id}-clip-path`;
|
|
36
36
|
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
37
|
+
ref: ref,
|
|
37
38
|
series: series.map(s => _extends({
|
|
38
39
|
type: 'bar'
|
|
39
40
|
}, s)),
|
|
@@ -65,7 +66,7 @@ function BarChart(props) {
|
|
|
65
66
|
id: clipPathId
|
|
66
67
|
}), children]
|
|
67
68
|
});
|
|
68
|
-
}
|
|
69
|
+
});
|
|
69
70
|
process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
70
71
|
// ----------------------------- Warning --------------------------------
|
|
71
72
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -123,6 +124,7 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
123
124
|
legend: PropTypes.shape({
|
|
124
125
|
classes: PropTypes.object,
|
|
125
126
|
direction: PropTypes.oneOf(['column', 'row']),
|
|
127
|
+
hidden: PropTypes.bool,
|
|
126
128
|
itemWidth: PropTypes.number,
|
|
127
129
|
markSize: PropTypes.number,
|
|
128
130
|
offset: PropTypes.shape({
|
package/esm/BarChart/BarPlot.js
CHANGED
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
3
3
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
4
|
-
import { isBandScale } from '../hooks/useScale';
|
|
5
4
|
import { BarElement } from './BarElement';
|
|
5
|
+
import { isBandScaleConfig } from '../models/axis';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Solution of the equations
|
|
9
|
+
* W = barWidth * N + offset * (N-1)
|
|
10
|
+
* offset / (offset + barWidth) = r
|
|
11
|
+
* @param bandWidth The width available to place bars.
|
|
12
|
+
* @param numberOfGroups The number of bars to place in that space.
|
|
13
|
+
* @param gapRatio The ratio of the gap between bars over the bar width.
|
|
14
|
+
* @returns The bar width and the offset between bars.
|
|
15
|
+
*/
|
|
6
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
17
|
+
function getBandSize({
|
|
18
|
+
bandWidth: W,
|
|
19
|
+
numberOfGroups: N,
|
|
20
|
+
gapRatio: r
|
|
21
|
+
}) {
|
|
22
|
+
if (r === 0) {
|
|
23
|
+
return {
|
|
24
|
+
barWidth: W / N,
|
|
25
|
+
offset: 0
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
const barWidth = W / (N + (N - 1) * r);
|
|
29
|
+
const offset = r * barWidth;
|
|
30
|
+
return {
|
|
31
|
+
barWidth,
|
|
32
|
+
offset
|
|
33
|
+
};
|
|
34
|
+
}
|
|
7
35
|
export function BarPlot() {
|
|
8
36
|
const seriesData = React.useContext(SeriesContext).bar;
|
|
9
37
|
const axisData = React.useContext(CartesianContext);
|
|
@@ -30,19 +58,27 @@ export function BarPlot() {
|
|
|
30
58
|
var _series$seriesId$xAxi, _series$seriesId$yAxi;
|
|
31
59
|
const xAxisKey = (_series$seriesId$xAxi = series[seriesId].xAxisKey) != null ? _series$seriesId$xAxi : defaultXAxisId;
|
|
32
60
|
const yAxisKey = (_series$seriesId$yAxi = series[seriesId].yAxisKey) != null ? _series$seriesId$yAxi : defaultYAxisId;
|
|
33
|
-
const
|
|
34
|
-
const
|
|
35
|
-
if (!
|
|
36
|
-
throw new Error(`Axis with id "${xAxisKey}" shoud be of type "band" to display the bar series ${
|
|
61
|
+
const xAxisConfig = xAxis[xAxisKey];
|
|
62
|
+
const yAxisConfig = yAxis[yAxisKey];
|
|
63
|
+
if (!isBandScaleConfig(xAxisConfig)) {
|
|
64
|
+
throw new Error(`Axis with id "${xAxisKey}" shoud be of type "band" to display the bar series of id "${seriesId}"`);
|
|
37
65
|
}
|
|
38
66
|
if (xAxis[xAxisKey].data === undefined) {
|
|
39
67
|
throw new Error(`Axis with id "${xAxisKey}" shoud have data property`);
|
|
40
68
|
}
|
|
69
|
+
const xScale = xAxisConfig.scale;
|
|
70
|
+
const yScale = yAxisConfig.scale;
|
|
41
71
|
|
|
42
72
|
// Currently assuming all bars are vertical
|
|
43
73
|
const bandWidth = xScale.bandwidth();
|
|
44
|
-
const
|
|
45
|
-
|
|
74
|
+
const {
|
|
75
|
+
barWidth,
|
|
76
|
+
offset
|
|
77
|
+
} = getBandSize({
|
|
78
|
+
bandWidth,
|
|
79
|
+
numberOfGroups: stackingGroups.length,
|
|
80
|
+
gapRatio: xAxisConfig.barGapRatio
|
|
81
|
+
});
|
|
46
82
|
|
|
47
83
|
// @ts-ignore TODO: fix when adding a correct API for customisation
|
|
48
84
|
const {
|
|
@@ -56,7 +92,7 @@ export function BarPlot() {
|
|
|
56
92
|
return /*#__PURE__*/_jsx(BarElement, {
|
|
57
93
|
id: seriesId,
|
|
58
94
|
dataIndex: dataIndex,
|
|
59
|
-
x: xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + groupIndex * barWidth + offset,
|
|
95
|
+
x: xScale((_xAxis$xAxisKey$data = xAxis[xAxisKey].data) == null ? void 0 : _xAxis$xAxisKey$data[dataIndex]) + groupIndex * (barWidth + offset),
|
|
60
96
|
y: yScale(value),
|
|
61
97
|
height: yScale(baseline) - yScale(value),
|
|
62
98
|
width: barWidth,
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const legendGetter = params => {
|
|
2
|
+
const {
|
|
3
|
+
seriesOrder,
|
|
4
|
+
series
|
|
5
|
+
} = params;
|
|
6
|
+
const data = seriesOrder.map(seriesId => ({
|
|
7
|
+
color: series[seriesId].color,
|
|
8
|
+
label: series[seriesId].label,
|
|
9
|
+
id: seriesId
|
|
10
|
+
}));
|
|
11
|
+
return data.filter(item => item.label !== undefined);
|
|
12
|
+
};
|
|
13
|
+
export default legendGetter;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
+
import useForkRef from '@mui/utils/useForkRef';
|
|
2
3
|
import { DrawingProvider } from '../context/DrawingProvider';
|
|
3
4
|
import { SeriesContextProvider } from '../context/SeriesContextProvider';
|
|
4
5
|
import { InteractionProvider } from '../context/InteractionProvider';
|
|
@@ -6,7 +7,7 @@ import { ChartsSurface } from '../ChartsSurface';
|
|
|
6
7
|
import { CartesianContextProvider } from '../context/CartesianContextProvider';
|
|
7
8
|
import { HighlightProvider } from '../context/HighlightProvider';
|
|
8
9
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
export function ChartContainer(props) {
|
|
10
|
+
export const ChartContainer = /*#__PURE__*/React.forwardRef(function ChartContainer(props, ref) {
|
|
10
11
|
const {
|
|
11
12
|
width,
|
|
12
13
|
height,
|
|
@@ -21,12 +22,13 @@ export function ChartContainer(props) {
|
|
|
21
22
|
disableAxisListener,
|
|
22
23
|
children
|
|
23
24
|
} = props;
|
|
24
|
-
const
|
|
25
|
+
const svgRef = React.useRef(null);
|
|
26
|
+
const handleRef = useForkRef(ref, svgRef);
|
|
25
27
|
return /*#__PURE__*/_jsx(DrawingProvider, {
|
|
26
28
|
width: width,
|
|
27
29
|
height: height,
|
|
28
30
|
margin: margin,
|
|
29
|
-
svgRef:
|
|
31
|
+
svgRef: svgRef,
|
|
30
32
|
children: /*#__PURE__*/_jsx(SeriesContextProvider, {
|
|
31
33
|
series: series,
|
|
32
34
|
colors: colors,
|
|
@@ -38,7 +40,7 @@ export function ChartContainer(props) {
|
|
|
38
40
|
children: /*#__PURE__*/_jsx(ChartsSurface, {
|
|
39
41
|
width: width,
|
|
40
42
|
height: height,
|
|
41
|
-
ref:
|
|
43
|
+
ref: handleRef,
|
|
42
44
|
sx: sx,
|
|
43
45
|
title: title,
|
|
44
46
|
desc: desc,
|
|
@@ -50,4 +52,4 @@ export function ChartContainer(props) {
|
|
|
50
52
|
})
|
|
51
53
|
})
|
|
52
54
|
});
|
|
53
|
-
}
|
|
55
|
+
});
|
|
@@ -2,7 +2,8 @@ import * as React from 'react';
|
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
4
4
|
import { CartesianContext } from '../context/CartesianContextProvider';
|
|
5
|
-
import { getValueToPositionMapper
|
|
5
|
+
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
6
|
+
import { isBandScale } from '../internals/isBandScale';
|
|
6
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
7
8
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
8
9
|
function ChartsAxisHighlight(props) {
|
|
@@ -26,7 +27,7 @@ function ChartsAxisHighlight(props) {
|
|
|
26
27
|
const getXPosition = getValueToPositionMapper(xScale);
|
|
27
28
|
return /*#__PURE__*/_jsxs(React.Fragment, {
|
|
28
29
|
children: [xAxisHighlight === 'band' && axis.x !== null && isBandScale(xScale) && /*#__PURE__*/_jsx("path", {
|
|
29
|
-
d: `M ${xScale(axis.x.value)
|
|
30
|
+
d: `M ${xScale(axis.x.value) - (xScale.step() - xScale.bandwidth()) / 2} ${yScale.range()[0]} l ${xScale.step()} 0 l 0 ${yScale.range()[1] - yScale.range()[0]} l ${-xScale.step()} 0 Z`,
|
|
30
31
|
fill: "gray",
|
|
31
32
|
fillOpacity: 0.1,
|
|
32
33
|
style: {
|
|
@@ -146,7 +146,8 @@ export function ChartsLegend(inProps) {
|
|
|
146
146
|
const {
|
|
147
147
|
position,
|
|
148
148
|
direction,
|
|
149
|
-
offset
|
|
149
|
+
offset,
|
|
150
|
+
hidden
|
|
150
151
|
} = props;
|
|
151
152
|
const theme = useTheme();
|
|
152
153
|
const classes = useUtilityClasses(_extends({}, props, {
|
|
@@ -154,6 +155,9 @@ export function ChartsLegend(inProps) {
|
|
|
154
155
|
}));
|
|
155
156
|
const drawingArea = React.useContext(DrawingContext);
|
|
156
157
|
const series = React.useContext(SeriesContext);
|
|
158
|
+
if (hidden) {
|
|
159
|
+
return null;
|
|
160
|
+
}
|
|
157
161
|
const seriesToDisplay = getSeriesToDisplay(series);
|
|
158
162
|
return /*#__PURE__*/_jsx(ChartsLegendRoot, {
|
|
159
163
|
ownerState: {
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
import getBarLegend from '../BarChart/legend';
|
|
2
|
+
import getScatterLegend from '../ScatterChart/legend';
|
|
3
|
+
import getLineLegend from '../LineChart/legend';
|
|
4
|
+
import getPieLegend from '../PieChart/legend';
|
|
5
|
+
const legendGetter = {
|
|
6
|
+
bar: getBarLegend,
|
|
7
|
+
scatter: getScatterLegend,
|
|
8
|
+
line: getLineLegend,
|
|
9
|
+
pie: getPieLegend
|
|
10
|
+
};
|
|
1
11
|
export function getSeriesToDisplay(series) {
|
|
2
|
-
return Object.
|
|
12
|
+
return Object.keys(series).flatMap(seriesType => legendGetter[seriesType](series[seriesType]));
|
|
3
13
|
}
|
|
@@ -82,7 +82,7 @@ export function ChartsAxisTooltipContent(props) {
|
|
|
82
82
|
const USED_X_AXIS_ID = xAxisIds[0];
|
|
83
83
|
const relevantSeries = React.useMemo(() => {
|
|
84
84
|
const rep = [];
|
|
85
|
-
Object.keys(series).forEach(seriesType => {
|
|
85
|
+
Object.keys(series).filter(seriesType => ['bar', 'line', 'scatter'].includes(seriesType)).forEach(seriesType => {
|
|
86
86
|
series[seriesType].seriesOrder.forEach(seriesId => {
|
|
87
87
|
const axisKey = series[seriesType].series[seriesId].xAxisKey;
|
|
88
88
|
if (axisKey === undefined || axisKey === USED_X_AXIS_ID) {
|
|
@@ -4,7 +4,6 @@ import { ChartsTooltipTable, ChartsTooltipCell, ChartsTooltipMark, ChartsTooltip
|
|
|
4
4
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
5
5
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
6
6
|
export function DefaultChartsItemContent(props) {
|
|
7
|
-
var _series$label;
|
|
8
7
|
const {
|
|
9
8
|
series,
|
|
10
9
|
itemData,
|
|
@@ -14,8 +13,17 @@ export function DefaultChartsItemContent(props) {
|
|
|
14
13
|
if (itemData.dataIndex === undefined) {
|
|
15
14
|
return null;
|
|
16
15
|
}
|
|
17
|
-
const
|
|
18
|
-
|
|
16
|
+
const {
|
|
17
|
+
displayedLabel,
|
|
18
|
+
color
|
|
19
|
+
} = series.type === 'pie' ? {
|
|
20
|
+
color: series.data[itemData.dataIndex].color,
|
|
21
|
+
displayedLabel: series.data[itemData.dataIndex].label
|
|
22
|
+
} : {
|
|
23
|
+
color: series.color,
|
|
24
|
+
displayedLabel: series.label
|
|
25
|
+
};
|
|
26
|
+
|
|
19
27
|
// TODO: Manage to let TS understand series.data and series.valueFormatter are coherent
|
|
20
28
|
// @ts-ignore
|
|
21
29
|
const formattedValue = series.valueFormatter(series.data[itemData.dataIndex]);
|
|
@@ -14,7 +14,7 @@ import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
|
14
14
|
import { ChartsClipPath } from '../ChartsClipPath';
|
|
15
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
16
|
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
17
|
-
function LineChart(props) {
|
|
17
|
+
const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
18
18
|
const {
|
|
19
19
|
xAxis,
|
|
20
20
|
yAxis,
|
|
@@ -38,6 +38,7 @@ function LineChart(props) {
|
|
|
38
38
|
const id = useId();
|
|
39
39
|
const clipPathId = `${id}-clip-path`;
|
|
40
40
|
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
41
|
+
ref: ref,
|
|
41
42
|
series: series.map(s => _extends({
|
|
42
43
|
type: 'line'
|
|
43
44
|
}, s)),
|
|
@@ -67,7 +68,7 @@ function LineChart(props) {
|
|
|
67
68
|
id: clipPathId
|
|
68
69
|
}), children]
|
|
69
70
|
});
|
|
70
|
-
}
|
|
71
|
+
});
|
|
71
72
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
72
73
|
// ----------------------------- Warning --------------------------------
|
|
73
74
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -125,6 +126,7 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
125
126
|
legend: PropTypes.shape({
|
|
126
127
|
classes: PropTypes.object,
|
|
127
128
|
direction: PropTypes.oneOf(['column', 'row']),
|
|
129
|
+
hidden: PropTypes.bool,
|
|
128
130
|
itemWidth: PropTypes.number,
|
|
129
131
|
markSize: PropTypes.number,
|
|
130
132
|
offset: PropTypes.shape({
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
const legendGetter = params => {
|
|
2
|
+
const {
|
|
3
|
+
seriesOrder,
|
|
4
|
+
series
|
|
5
|
+
} = params;
|
|
6
|
+
const data = seriesOrder.map(seriesId => ({
|
|
7
|
+
color: series[seriesId].color,
|
|
8
|
+
label: series[seriesId].label,
|
|
9
|
+
id: seriesId
|
|
10
|
+
}));
|
|
11
|
+
return data.filter(item => item.label !== undefined);
|
|
12
|
+
};
|
|
13
|
+
export default legendGetter;
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
+
const _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "innerRadius", "outerRadius", "cornerRadius", "highlighted", "faded"];
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { arc as d3Arc } from 'd3-shape';
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
|
+
import { styled } from '@mui/material/styles';
|
|
10
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
11
|
+
import { InteractionContext } from '../context/InteractionProvider';
|
|
12
|
+
import { getIsFaded, getIsHighlighted, useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
export function getPieArcUtilityClass(slot) {
|
|
15
|
+
return generateUtilityClass('MuiPieArc', slot);
|
|
16
|
+
}
|
|
17
|
+
export const pieArcClasses = generateUtilityClasses('MuiPieArc', ['root', 'highlighted', 'faded']);
|
|
18
|
+
const useUtilityClasses = ownerState => {
|
|
19
|
+
const {
|
|
20
|
+
classes,
|
|
21
|
+
id,
|
|
22
|
+
isFaded,
|
|
23
|
+
isHighlighted
|
|
24
|
+
} = ownerState;
|
|
25
|
+
const slots = {
|
|
26
|
+
root: ['root', `series-${id}`, isHighlighted && 'highlighted', isFaded && 'faded']
|
|
27
|
+
};
|
|
28
|
+
return composeClasses(slots, getPieArcUtilityClass, classes);
|
|
29
|
+
};
|
|
30
|
+
const PieArcRoot = styled('path', {
|
|
31
|
+
name: 'MuiPieArc',
|
|
32
|
+
slot: 'Root',
|
|
33
|
+
overridesResolver: (_, styles) => styles.arc
|
|
34
|
+
})(({
|
|
35
|
+
ownerState,
|
|
36
|
+
theme
|
|
37
|
+
}) => ({
|
|
38
|
+
stroke: theme.palette.background.paper,
|
|
39
|
+
strokeWidth: 1,
|
|
40
|
+
strokeLinejoin: 'round',
|
|
41
|
+
fill: ownerState.color,
|
|
42
|
+
opacity: ownerState.isFaded ? 0.3 : 1
|
|
43
|
+
}));
|
|
44
|
+
export default function PieArc(props) {
|
|
45
|
+
var _attibuesOverride$inn, _attibuesOverride$out, _attibuesOverride$cor;
|
|
46
|
+
const {
|
|
47
|
+
id,
|
|
48
|
+
dataIndex,
|
|
49
|
+
classes: innerClasses,
|
|
50
|
+
color,
|
|
51
|
+
highlightScope,
|
|
52
|
+
innerRadius: baseInnerRadius = 0,
|
|
53
|
+
outerRadius: baseOuterRadius,
|
|
54
|
+
cornerRadius: baseCornerRadius = 0,
|
|
55
|
+
highlighted,
|
|
56
|
+
faded = {
|
|
57
|
+
additionalRadius: -5
|
|
58
|
+
}
|
|
59
|
+
} = props,
|
|
60
|
+
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
61
|
+
const getInteractionItemProps = useInteractionItemProps(highlightScope);
|
|
62
|
+
const {
|
|
63
|
+
item
|
|
64
|
+
} = React.useContext(InteractionContext);
|
|
65
|
+
const isHighlighted = getIsHighlighted(item, {
|
|
66
|
+
type: 'pie',
|
|
67
|
+
seriesId: id,
|
|
68
|
+
dataIndex
|
|
69
|
+
}, highlightScope);
|
|
70
|
+
const isFaded = !isHighlighted && getIsFaded(item, {
|
|
71
|
+
type: 'pie',
|
|
72
|
+
seriesId: id,
|
|
73
|
+
dataIndex
|
|
74
|
+
}, highlightScope);
|
|
75
|
+
const ownerState = {
|
|
76
|
+
id,
|
|
77
|
+
dataIndex,
|
|
78
|
+
classes: innerClasses,
|
|
79
|
+
color,
|
|
80
|
+
isFaded,
|
|
81
|
+
isHighlighted
|
|
82
|
+
};
|
|
83
|
+
const classes = useUtilityClasses(ownerState);
|
|
84
|
+
const attibuesOverride = _extends({
|
|
85
|
+
additionalRadius: 0
|
|
86
|
+
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
87
|
+
const innerRadius = Math.max(0, (_attibuesOverride$inn = attibuesOverride.innerRadius) != null ? _attibuesOverride$inn : baseInnerRadius);
|
|
88
|
+
const outerRadius = Math.max(0, (_attibuesOverride$out = attibuesOverride.outerRadius) != null ? _attibuesOverride$out : baseOuterRadius + attibuesOverride.additionalRadius);
|
|
89
|
+
const cornerRadius = (_attibuesOverride$cor = attibuesOverride.cornerRadius) != null ? _attibuesOverride$cor : baseCornerRadius;
|
|
90
|
+
return /*#__PURE__*/_jsx(PieArcRoot, _extends({
|
|
91
|
+
d: d3Arc().cornerRadius(cornerRadius)(_extends({}, other, {
|
|
92
|
+
innerRadius,
|
|
93
|
+
outerRadius
|
|
94
|
+
})),
|
|
95
|
+
ownerState: ownerState,
|
|
96
|
+
className: classes.root
|
|
97
|
+
}, getInteractionItemProps({
|
|
98
|
+
type: 'pie',
|
|
99
|
+
seriesId: id,
|
|
100
|
+
dataIndex
|
|
101
|
+
})));
|
|
102
|
+
}
|
|
103
|
+
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
104
|
+
// ----------------------------- Warning --------------------------------
|
|
105
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
106
|
+
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
107
|
+
// ----------------------------------------------------------------------
|
|
108
|
+
classes: PropTypes.object,
|
|
109
|
+
cornerRadius: PropTypes.number,
|
|
110
|
+
dataIndex: PropTypes.number.isRequired,
|
|
111
|
+
highlightScope: PropTypes.shape({
|
|
112
|
+
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
113
|
+
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
114
|
+
}),
|
|
115
|
+
innerRadius: PropTypes.number,
|
|
116
|
+
outerRadius: PropTypes.number.isRequired
|
|
117
|
+
} : void 0;
|