@mui/x-charts 7.0.0-beta.2 → 7.0.0-beta.4
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 +21 -5
- package/BarChart/BarChart.js +27 -7
- package/CHANGELOG.md +298 -23
- package/ChartsGrid/ChartsGrid.d.ts +30 -0
- package/ChartsGrid/ChartsGrid.js +128 -0
- package/ChartsGrid/chartsGridClasses.d.ts +13 -0
- package/ChartsGrid/chartsGridClasses.js +14 -0
- package/ChartsGrid/index.d.ts +2 -0
- package/ChartsGrid/index.js +27 -0
- package/ChartsGrid/package.json +6 -0
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsSurface.js +6 -4
- package/ChartsTooltip/utils.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.d.ts +0 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +1 -2
- package/ChartsXAxis/ChartsXAxis.js +3 -3
- package/ChartsYAxis/ChartsYAxis.js +3 -3
- package/Gauge/Gauge.d.ts +13 -0
- package/Gauge/Gauge.js +154 -0
- package/Gauge/GaugeContainer.d.ts +17 -0
- package/Gauge/GaugeContainer.js +214 -0
- package/Gauge/GaugeProvider.d.ts +117 -0
- package/Gauge/GaugeProvider.js +99 -0
- package/Gauge/GaugeReferenceArc.d.ts +2 -0
- package/Gauge/GaugeReferenceArc.js +44 -0
- package/Gauge/GaugeValueArc.d.ts +2 -0
- package/Gauge/GaugeValueArc.js +51 -0
- package/Gauge/GaugeValueText.d.ts +15 -0
- package/Gauge/GaugeValueText.js +77 -0
- package/Gauge/gaugeClasses.d.ts +14 -0
- package/Gauge/gaugeClasses.js +15 -0
- package/Gauge/index.d.ts +7 -0
- package/Gauge/index.js +87 -0
- package/Gauge/package.json +6 -0
- package/Gauge/utils.d.ts +19 -0
- package/Gauge/utils.js +75 -0
- package/LineChart/LineChart.d.ts +24 -5
- package/LineChart/LineChart.js +31 -7
- package/PieChart/PieArc.d.ts +4 -4
- package/PieChart/PieArc.js +9 -9
- package/PieChart/PieArcLabelPlot.js +13 -13
- package/PieChart/PieChart.d.ts +22 -0
- package/PieChart/PieChart.js +22 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.d.ts +0 -2
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
- package/ResponsiveChartContainer/useChartContainerDimensions.d.ts +2 -0
- package/ResponsiveChartContainer/useChartContainerDimensions.js +76 -0
- package/ScatterChart/ScatterChart.d.ts +18 -0
- package/ScatterChart/ScatterChart.js +25 -3
- package/SparkLineChart/SparkLineChart.js +0 -2
- package/context/CartesianContextProvider.d.ts +0 -8
- package/context/CartesianContextProvider.js +4 -89
- package/context/DrawingProvider.d.ts +2 -11
- package/context/DrawingProvider.js +10 -35
- package/context/HighlightProvider.js +3 -0
- package/context/InteractionProvider.js +3 -0
- package/context/SeriesContextProvider.js +3 -0
- package/context/index.d.ts +0 -2
- package/context/index.js +1 -15
- package/esm/BarChart/BarChart.js +27 -7
- package/esm/ChartsGrid/ChartsGrid.js +121 -0
- package/esm/ChartsGrid/chartsGridClasses.js +6 -0
- package/esm/ChartsGrid/index.js +2 -0
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/esm/ChartsSurface.js +6 -4
- package/esm/ChartsTooltip/utils.js +2 -2
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
- package/esm/ChartsXAxis/ChartsXAxis.js +2 -2
- package/esm/ChartsYAxis/ChartsYAxis.js +2 -2
- package/esm/Gauge/Gauge.js +147 -0
- package/esm/Gauge/GaugeContainer.js +209 -0
- package/esm/Gauge/GaugeProvider.js +88 -0
- package/esm/Gauge/GaugeReferenceArc.js +35 -0
- package/esm/Gauge/GaugeValueArc.js +42 -0
- package/esm/Gauge/GaugeValueText.js +69 -0
- package/esm/Gauge/gaugeClasses.js +7 -0
- package/esm/Gauge/index.js +7 -0
- package/esm/Gauge/utils.js +68 -0
- package/esm/LineChart/LineChart.js +31 -7
- package/esm/PieChart/PieArc.js +9 -9
- package/esm/PieChart/PieArcLabelPlot.js +13 -13
- package/esm/PieChart/PieChart.js +22 -2
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
- package/esm/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
- package/esm/ScatterChart/ScatterChart.js +25 -3
- package/esm/SparkLineChart/SparkLineChart.js +0 -2
- package/esm/context/CartesianContextProvider.js +3 -88
- package/esm/context/DrawingProvider.js +10 -36
- package/esm/context/HighlightProvider.js +3 -0
- package/esm/context/InteractionProvider.js +3 -0
- package/esm/context/SeriesContextProvider.js +3 -0
- package/esm/context/index.js +1 -2
- package/esm/hooks/useAxisEvents.js +2 -2
- package/esm/hooks/useTicks.js +2 -3
- package/esm/index.js +2 -0
- package/hooks/useAxisEvents.js +1 -1
- package/hooks/useTicks.d.ts +2 -3
- package/hooks/useTicks.js +2 -3
- package/index.d.ts +2 -0
- package/index.js +23 -1
- package/modern/BarChart/BarChart.js +27 -7
- package/modern/ChartsGrid/ChartsGrid.js +121 -0
- package/modern/ChartsGrid/chartsGridClasses.js +6 -0
- package/modern/ChartsGrid/index.js +2 -0
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +2 -2
- package/modern/ChartsSurface.js +6 -4
- package/modern/ChartsTooltip/utils.js +2 -2
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +2 -3
- package/modern/ChartsXAxis/ChartsXAxis.js +2 -2
- package/modern/ChartsYAxis/ChartsYAxis.js +2 -2
- package/modern/Gauge/Gauge.js +147 -0
- package/modern/Gauge/GaugeContainer.js +206 -0
- package/modern/Gauge/GaugeProvider.js +88 -0
- package/modern/Gauge/GaugeReferenceArc.js +35 -0
- package/modern/Gauge/GaugeValueArc.js +42 -0
- package/modern/Gauge/GaugeValueText.js +69 -0
- package/modern/Gauge/gaugeClasses.js +7 -0
- package/modern/Gauge/index.js +7 -0
- package/modern/Gauge/utils.js +68 -0
- package/modern/LineChart/LineChart.js +31 -7
- package/modern/PieChart/PieArc.js +9 -9
- package/modern/PieChart/PieArcLabelPlot.js +13 -13
- package/modern/PieChart/PieChart.js +22 -2
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +2 -68
- package/modern/ResponsiveChartContainer/useChartContainerDimensions.js +66 -0
- package/modern/ScatterChart/ScatterChart.js +25 -3
- package/modern/SparkLineChart/SparkLineChart.js +0 -2
- package/modern/context/CartesianContextProvider.js +3 -88
- package/modern/context/DrawingProvider.js +10 -36
- package/modern/context/HighlightProvider.js +3 -0
- package/modern/context/InteractionProvider.js +3 -0
- package/modern/context/SeriesContextProvider.js +3 -0
- package/modern/context/index.js +1 -2
- package/modern/hooks/useAxisEvents.js +2 -2
- package/modern/hooks/useTicks.js +2 -3
- package/modern/index.js +3 -1
- package/package.json +4 -4
- package/legacy/BarChart/BarChart.js +0 -418
- package/legacy/BarChart/BarElement.js +0 -119
- package/legacy/BarChart/BarPlot.js +0 -232
- package/legacy/BarChart/extremums.js +0 -45
- package/legacy/BarChart/formatter.js +0 -78
- package/legacy/BarChart/index.js +0 -3
- package/legacy/BarChart/legend.js +0 -15
- package/legacy/ChartContainer/ChartContainer.js +0 -189
- package/legacy/ChartContainer/index.js +0 -1
- package/legacy/ChartsAxis/ChartsAxis.js +0 -215
- package/legacy/ChartsAxis/axisClasses.js +0 -5
- package/legacy/ChartsAxis/index.js +0 -2
- package/legacy/ChartsAxisHighlight/ChartsAxisHighlight.js +0 -105
- package/legacy/ChartsAxisHighlight/index.js +0 -1
- package/legacy/ChartsClipPath/ChartsClipPath.js +0 -48
- package/legacy/ChartsClipPath/index.js +0 -1
- package/legacy/ChartsLegend/ChartsLegend.js +0 -100
- package/legacy/ChartsLegend/DefaultChartsLegend.js +0 -302
- package/legacy/ChartsLegend/chartsLegendClasses.js +0 -5
- package/legacy/ChartsLegend/index.js +0 -4
- package/legacy/ChartsLegend/utils.js +0 -15
- package/legacy/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +0 -75
- package/legacy/ChartsOnAxisClickHandler/index.js +0 -1
- package/legacy/ChartsReferenceLine/ChartsReferenceLine.js +0 -72
- package/legacy/ChartsReferenceLine/ChartsXReferenceLine.js +0 -105
- package/legacy/ChartsReferenceLine/ChartsYReferenceLine.js +0 -105
- package/legacy/ChartsReferenceLine/chartsReferenceLineClasses.js +0 -6
- package/legacy/ChartsReferenceLine/common.js +0 -19
- package/legacy/ChartsReferenceLine/index.js +0 -2
- package/legacy/ChartsSurface.js +0 -76
- package/legacy/ChartsText/ChartsText.js +0 -95
- package/legacy/ChartsText/index.js +0 -1
- package/legacy/ChartsTooltip/ChartsAxisTooltipContent.js +0 -96
- package/legacy/ChartsTooltip/ChartsItemTooltipContent.js +0 -53
- package/legacy/ChartsTooltip/ChartsTooltip.js +0 -148
- package/legacy/ChartsTooltip/ChartsTooltipTable.js +0 -80
- package/legacy/ChartsTooltip/DefaultChartsAxisTooltipContent.js +0 -118
- package/legacy/ChartsTooltip/DefaultChartsItemTooltipContent.js +0 -78
- package/legacy/ChartsTooltip/chartsTooltipClasses.js +0 -5
- package/legacy/ChartsTooltip/index.js +0 -6
- package/legacy/ChartsTooltip/utils.js +0 -103
- package/legacy/ChartsVoronoiHandler/ChartsVoronoiHandler.js +0 -206
- package/legacy/ChartsVoronoiHandler/index.js +0 -1
- package/legacy/ChartsXAxis/ChartsXAxis.js +0 -339
- package/legacy/ChartsXAxis/index.js +0 -1
- package/legacy/ChartsYAxis/ChartsYAxis.js +0 -267
- package/legacy/ChartsYAxis/index.js +0 -1
- package/legacy/LineChart/AnimatedArea.js +0 -102
- package/legacy/LineChart/AnimatedLine.js +0 -104
- package/legacy/LineChart/AreaElement.js +0 -112
- package/legacy/LineChart/AreaPlot.js +0 -149
- package/legacy/LineChart/LineChart.js +0 -426
- package/legacy/LineChart/LineElement.js +0 -112
- package/legacy/LineChart/LineHighlightElement.js +0 -79
- package/legacy/LineChart/LineHighlightPlot.js +0 -97
- package/legacy/LineChart/LinePlot.js +0 -144
- package/legacy/LineChart/MarkElement.js +0 -153
- package/legacy/LineChart/MarkPlot.js +0 -178
- package/legacy/LineChart/extremums.js +0 -54
- package/legacy/LineChart/formatter.js +0 -82
- package/legacy/LineChart/index.js +0 -11
- package/legacy/LineChart/legend.js +0 -15
- package/legacy/PieChart/PieArc.js +0 -103
- package/legacy/PieChart/PieArcLabel.js +0 -112
- package/legacy/PieChart/PieArcLabelPlot.js +0 -193
- package/legacy/PieChart/PieArcPlot.js +0 -180
- package/legacy/PieChart/PieChart.js +0 -382
- package/legacy/PieChart/PiePlot.js +0 -137
- package/legacy/PieChart/dataTransform/transition.js +0 -149
- package/legacy/PieChart/dataTransform/useTransformData.js +0 -63
- package/legacy/PieChart/formatter.js +0 -55
- package/legacy/PieChart/index.js +0 -6
- package/legacy/PieChart/legend.js +0 -16
- package/legacy/ResponsiveChartContainer/ResponsiveChartContainer.js +0 -255
- package/legacy/ResponsiveChartContainer/index.js +0 -1
- package/legacy/ScatterChart/Scatter.js +0 -110
- package/legacy/ScatterChart/ScatterChart.js +0 -370
- package/legacy/ScatterChart/ScatterPlot.js +0 -80
- package/legacy/ScatterChart/extremums.js +0 -39
- package/legacy/ScatterChart/formatter.js +0 -12
- package/legacy/ScatterChart/index.js +0 -3
- package/legacy/ScatterChart/legend.js +0 -15
- package/legacy/SparkLineChart/SparkLineChart.js +0 -266
- package/legacy/SparkLineChart/index.js +0 -1
- package/legacy/colorPalettes/colorPalettes.js +0 -15
- package/legacy/colorPalettes/index.js +0 -1
- package/legacy/constants.js +0 -8
- package/legacy/context/CartesianContextProvider.js +0 -327
- package/legacy/context/DrawingProvider.js +0 -74
- package/legacy/context/HighlightProvider.js +0 -56
- package/legacy/context/InteractionProvider.js +0 -81
- package/legacy/context/SeriesContextProvider.js +0 -74
- package/legacy/context/index.js +0 -2
- package/legacy/hooks/index.js +0 -2
- package/legacy/hooks/useAxisEvents.js +0 -120
- package/legacy/hooks/useChartDimensions.js +0 -18
- package/legacy/hooks/useDrawingArea.js +0 -21
- package/legacy/hooks/useInteractionItemProps.js +0 -71
- package/legacy/hooks/useMounted.js +0 -21
- package/legacy/hooks/useReducedMotion.js +0 -27
- package/legacy/hooks/useScale.js +0 -33
- package/legacy/hooks/useTicks.js +0 -66
- package/legacy/index.js +0 -31
- package/legacy/internals/components/AxisSharedComponents.js +0 -25
- package/legacy/internals/defaultizeColor.js +0 -17
- package/legacy/internals/defaultizeValueFormatter.js +0 -12
- package/legacy/internals/domUtils.js +0 -121
- package/legacy/internals/geometry.js +0 -37
- package/legacy/internals/getCurve.js +0 -39
- package/legacy/internals/getScale.js +0 -17
- package/legacy/internals/getWordsByLines.js +0 -15
- package/legacy/internals/isBandScale.js +0 -3
- package/legacy/internals/stackSeries.js +0 -92
- package/legacy/internals/useAnimatedPath.js +0 -32
- package/legacy/internals/utils.js +0 -52
- package/legacy/models/axis.js +0 -6
- package/legacy/models/helpers.js +0 -1
- package/legacy/models/index.js +0 -4
- package/legacy/models/layout.js +0 -1
- package/legacy/models/seriesType/bar.js +0 -1
- package/legacy/models/seriesType/common.js +0 -1
- package/legacy/models/seriesType/config.js +0 -1
- package/legacy/models/seriesType/index.js +0 -5
- package/legacy/models/seriesType/line.js +0 -1
- package/legacy/models/seriesType/pie.js +0 -1
- package/legacy/models/seriesType/scatter.js +0 -1
- package/legacy/models/stacking.js +0 -1
- package/legacy/themeAugmentation/index.js +0 -3
|
@@ -1,180 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "onItemClick", "skipAnimation"],
|
|
4
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { useTransition } from '@react-spring/web';
|
|
8
|
-
import { PieArc } from './PieArc';
|
|
9
|
-
import { defaultTransitionConfig } from './dataTransform/transition';
|
|
10
|
-
import { useTransformData } from './dataTransform/useTransformData';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
function PieArcPlot(props) {
|
|
13
|
-
var _slots$pieArc;
|
|
14
|
-
var slots = props.slots,
|
|
15
|
-
slotProps = props.slotProps,
|
|
16
|
-
_props$innerRadius = props.innerRadius,
|
|
17
|
-
innerRadius = _props$innerRadius === void 0 ? 0 : _props$innerRadius,
|
|
18
|
-
outerRadius = props.outerRadius,
|
|
19
|
-
_props$cornerRadius = props.cornerRadius,
|
|
20
|
-
cornerRadius = _props$cornerRadius === void 0 ? 0 : _props$cornerRadius,
|
|
21
|
-
_props$paddingAngle = props.paddingAngle,
|
|
22
|
-
paddingAngle = _props$paddingAngle === void 0 ? 0 : _props$paddingAngle,
|
|
23
|
-
id = props.id,
|
|
24
|
-
highlightScope = props.highlightScope,
|
|
25
|
-
highlighted = props.highlighted,
|
|
26
|
-
_props$faded = props.faded,
|
|
27
|
-
faded = _props$faded === void 0 ? {
|
|
28
|
-
additionalRadius: -5
|
|
29
|
-
} : _props$faded,
|
|
30
|
-
data = props.data,
|
|
31
|
-
onItemClick = props.onItemClick,
|
|
32
|
-
skipAnimation = props.skipAnimation,
|
|
33
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
34
|
-
var transformedData = useTransformData({
|
|
35
|
-
innerRadius: innerRadius,
|
|
36
|
-
outerRadius: outerRadius,
|
|
37
|
-
cornerRadius: cornerRadius,
|
|
38
|
-
paddingAngle: paddingAngle,
|
|
39
|
-
id: id,
|
|
40
|
-
highlightScope: highlightScope,
|
|
41
|
-
highlighted: highlighted,
|
|
42
|
-
faded: faded,
|
|
43
|
-
data: data
|
|
44
|
-
});
|
|
45
|
-
var transition = useTransition(transformedData, _extends({}, defaultTransitionConfig, {
|
|
46
|
-
immediate: skipAnimation
|
|
47
|
-
}));
|
|
48
|
-
if (data.length === 0) {
|
|
49
|
-
return null;
|
|
50
|
-
}
|
|
51
|
-
var Arc = (_slots$pieArc = slots == null ? void 0 : slots.pieArc) != null ? _slots$pieArc : PieArc;
|
|
52
|
-
return /*#__PURE__*/_jsx("g", _extends({}, other, {
|
|
53
|
-
children: transition(function (_ref, item, _, index) {
|
|
54
|
-
var startAngle = _ref.startAngle,
|
|
55
|
-
endAngle = _ref.endAngle,
|
|
56
|
-
pA = _ref.paddingAngle,
|
|
57
|
-
iR = _ref.innerRadius,
|
|
58
|
-
arcLabelRadius = _ref.arcLabelRadius,
|
|
59
|
-
oR = _ref.outerRadius,
|
|
60
|
-
cR = _ref.cornerRadius,
|
|
61
|
-
style = _objectWithoutProperties(_ref, _excluded2);
|
|
62
|
-
return /*#__PURE__*/_jsx(Arc, _extends({
|
|
63
|
-
startAngle: startAngle,
|
|
64
|
-
endAngle: endAngle,
|
|
65
|
-
paddingAngle: pA,
|
|
66
|
-
innerRadius: iR,
|
|
67
|
-
outerRadius: oR,
|
|
68
|
-
cornerRadius: cR,
|
|
69
|
-
style: style,
|
|
70
|
-
id: id,
|
|
71
|
-
color: item.color,
|
|
72
|
-
dataIndex: index,
|
|
73
|
-
highlightScope: highlightScope,
|
|
74
|
-
isFaded: item.isFaded,
|
|
75
|
-
isHighlighted: item.isHighlighted,
|
|
76
|
-
onClick: onItemClick && function (event) {
|
|
77
|
-
onItemClick(event, {
|
|
78
|
-
type: 'pie',
|
|
79
|
-
seriesId: id,
|
|
80
|
-
dataIndex: index
|
|
81
|
-
}, item);
|
|
82
|
-
}
|
|
83
|
-
}, slotProps == null ? void 0 : slotProps.pieArc));
|
|
84
|
-
})
|
|
85
|
-
}));
|
|
86
|
-
}
|
|
87
|
-
process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
88
|
-
// ----------------------------- Warning --------------------------------
|
|
89
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
90
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
91
|
-
// ----------------------------------------------------------------------
|
|
92
|
-
/**
|
|
93
|
-
* The radius between circle center and the arc label in px.
|
|
94
|
-
* @default (innerRadius - outerRadius) / 2
|
|
95
|
-
*/
|
|
96
|
-
arcLabelRadius: PropTypes.number,
|
|
97
|
-
/**
|
|
98
|
-
* The radius applied to arc corners (similar to border radius).
|
|
99
|
-
* @default 0
|
|
100
|
-
*/
|
|
101
|
-
cornerRadius: PropTypes.number,
|
|
102
|
-
data: PropTypes.arrayOf(PropTypes.shape({
|
|
103
|
-
color: PropTypes.string.isRequired,
|
|
104
|
-
endAngle: PropTypes.number.isRequired,
|
|
105
|
-
formattedValue: PropTypes.string.isRequired,
|
|
106
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
107
|
-
index: PropTypes.number.isRequired,
|
|
108
|
-
label: PropTypes.string,
|
|
109
|
-
padAngle: PropTypes.number.isRequired,
|
|
110
|
-
startAngle: PropTypes.number.isRequired,
|
|
111
|
-
value: PropTypes.number.isRequired
|
|
112
|
-
})).isRequired,
|
|
113
|
-
/**
|
|
114
|
-
* Override the arc attibutes when it is faded.
|
|
115
|
-
* @default { additionalRadius: -5 }
|
|
116
|
-
*/
|
|
117
|
-
faded: PropTypes.shape({
|
|
118
|
-
additionalRadius: PropTypes.number,
|
|
119
|
-
arcLabelRadius: PropTypes.number,
|
|
120
|
-
color: PropTypes.string,
|
|
121
|
-
cornerRadius: PropTypes.number,
|
|
122
|
-
innerRadius: PropTypes.number,
|
|
123
|
-
outerRadius: PropTypes.number,
|
|
124
|
-
paddingAngle: PropTypes.number
|
|
125
|
-
}),
|
|
126
|
-
/**
|
|
127
|
-
* Override the arc attibutes when it is highlighted.
|
|
128
|
-
*/
|
|
129
|
-
highlighted: PropTypes.shape({
|
|
130
|
-
additionalRadius: PropTypes.number,
|
|
131
|
-
arcLabelRadius: PropTypes.number,
|
|
132
|
-
color: PropTypes.string,
|
|
133
|
-
cornerRadius: PropTypes.number,
|
|
134
|
-
innerRadius: PropTypes.number,
|
|
135
|
-
outerRadius: PropTypes.number,
|
|
136
|
-
paddingAngle: PropTypes.number
|
|
137
|
-
}),
|
|
138
|
-
highlightScope: PropTypes.shape({
|
|
139
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
140
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
141
|
-
}),
|
|
142
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
143
|
-
/**
|
|
144
|
-
* The radius between circle center and the begining of the arc.
|
|
145
|
-
* @default 0
|
|
146
|
-
*/
|
|
147
|
-
innerRadius: PropTypes.number,
|
|
148
|
-
/**
|
|
149
|
-
* Callback fired when a pie item is clicked.
|
|
150
|
-
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
151
|
-
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
152
|
-
* @param {DefaultizedPieValueType} item The pie item.
|
|
153
|
-
*/
|
|
154
|
-
onItemClick: PropTypes.func,
|
|
155
|
-
/**
|
|
156
|
-
* The radius between circle center and the end of the arc.
|
|
157
|
-
*/
|
|
158
|
-
outerRadius: PropTypes.number.isRequired,
|
|
159
|
-
/**
|
|
160
|
-
* The padding angle (deg) between two arcs.
|
|
161
|
-
* @default 0
|
|
162
|
-
*/
|
|
163
|
-
paddingAngle: PropTypes.number,
|
|
164
|
-
/**
|
|
165
|
-
* If `true`, animations are skipped.
|
|
166
|
-
* @default false
|
|
167
|
-
*/
|
|
168
|
-
skipAnimation: PropTypes.bool,
|
|
169
|
-
/**
|
|
170
|
-
* The props used for each component slot.
|
|
171
|
-
* @default {}
|
|
172
|
-
*/
|
|
173
|
-
slotProps: PropTypes.object,
|
|
174
|
-
/**
|
|
175
|
-
* Overridable component slots.
|
|
176
|
-
* @default {}
|
|
177
|
-
*/
|
|
178
|
-
slots: PropTypes.object
|
|
179
|
-
} : void 0;
|
|
180
|
-
export { PieArcPlot };
|
|
@@ -1,382 +0,0 @@
|
|
|
1
|
-
import _toConsumableArray from "@babel/runtime/helpers/esm/toConsumableArray";
|
|
2
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import PropTypes from 'prop-types';
|
|
5
|
-
import { ResponsiveChartContainer } from '../ResponsiveChartContainer';
|
|
6
|
-
import { ChartsAxis } from '../ChartsAxis/ChartsAxis';
|
|
7
|
-
import { DEFAULT_X_AXIS_KEY } from '../constants';
|
|
8
|
-
import { ChartsTooltip } from '../ChartsTooltip';
|
|
9
|
-
import { ChartsLegend } from '../ChartsLegend';
|
|
10
|
-
import { ChartsAxisHighlight } from '../ChartsAxisHighlight';
|
|
11
|
-
import { PiePlot } from './PiePlot';
|
|
12
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
var defaultMargin = {
|
|
15
|
-
top: 5,
|
|
16
|
-
bottom: 5,
|
|
17
|
-
left: 5,
|
|
18
|
-
right: 100
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
/**
|
|
22
|
-
* Demos:
|
|
23
|
-
*
|
|
24
|
-
* - [Pie](https://mui.com/x/react-charts/pie/)
|
|
25
|
-
* - [Pie demonstration](https://mui.com/x/react-charts/pie-demo/)
|
|
26
|
-
*
|
|
27
|
-
* API:
|
|
28
|
-
*
|
|
29
|
-
* - [PieChart API](https://mui.com/x/api/charts/pie-chart/)
|
|
30
|
-
*/
|
|
31
|
-
function PieChart(props) {
|
|
32
|
-
var xAxis = props.xAxis,
|
|
33
|
-
yAxis = props.yAxis,
|
|
34
|
-
series = props.series,
|
|
35
|
-
width = props.width,
|
|
36
|
-
height = props.height,
|
|
37
|
-
marginProps = props.margin,
|
|
38
|
-
colors = props.colors,
|
|
39
|
-
sx = props.sx,
|
|
40
|
-
_props$tooltip = props.tooltip,
|
|
41
|
-
tooltip = _props$tooltip === void 0 ? {
|
|
42
|
-
trigger: 'item'
|
|
43
|
-
} : _props$tooltip,
|
|
44
|
-
_props$axisHighlight = props.axisHighlight,
|
|
45
|
-
axisHighlight = _props$axisHighlight === void 0 ? {
|
|
46
|
-
x: 'none',
|
|
47
|
-
y: 'none'
|
|
48
|
-
} : _props$axisHighlight,
|
|
49
|
-
skipAnimation = props.skipAnimation,
|
|
50
|
-
_props$legend = props.legend,
|
|
51
|
-
legend = _props$legend === void 0 ? {
|
|
52
|
-
direction: 'column',
|
|
53
|
-
position: {
|
|
54
|
-
vertical: 'middle',
|
|
55
|
-
horizontal: 'right'
|
|
56
|
-
}
|
|
57
|
-
} : _props$legend,
|
|
58
|
-
_props$topAxis = props.topAxis,
|
|
59
|
-
topAxis = _props$topAxis === void 0 ? null : _props$topAxis,
|
|
60
|
-
_props$leftAxis = props.leftAxis,
|
|
61
|
-
leftAxis = _props$leftAxis === void 0 ? null : _props$leftAxis,
|
|
62
|
-
_props$rightAxis = props.rightAxis,
|
|
63
|
-
rightAxis = _props$rightAxis === void 0 ? null : _props$rightAxis,
|
|
64
|
-
_props$bottomAxis = props.bottomAxis,
|
|
65
|
-
bottomAxis = _props$bottomAxis === void 0 ? null : _props$bottomAxis,
|
|
66
|
-
children = props.children,
|
|
67
|
-
slots = props.slots,
|
|
68
|
-
slotProps = props.slotProps,
|
|
69
|
-
onItemClick = props.onItemClick;
|
|
70
|
-
var margin = _extends({}, defaultMargin, marginProps);
|
|
71
|
-
return /*#__PURE__*/_jsxs(ResponsiveChartContainer, {
|
|
72
|
-
series: series.map(function (s) {
|
|
73
|
-
return _extends({
|
|
74
|
-
type: 'pie'
|
|
75
|
-
}, s);
|
|
76
|
-
}),
|
|
77
|
-
width: width,
|
|
78
|
-
height: height,
|
|
79
|
-
margin: margin,
|
|
80
|
-
xAxis: xAxis != null ? xAxis : [{
|
|
81
|
-
id: DEFAULT_X_AXIS_KEY,
|
|
82
|
-
scaleType: 'point',
|
|
83
|
-
data: _toConsumableArray(new Array(Math.max.apply(Math, _toConsumableArray(series.map(function (s) {
|
|
84
|
-
return s.data.length;
|
|
85
|
-
}))))).map(function (_, index) {
|
|
86
|
-
return index;
|
|
87
|
-
})
|
|
88
|
-
}],
|
|
89
|
-
yAxis: yAxis,
|
|
90
|
-
colors: colors,
|
|
91
|
-
sx: sx,
|
|
92
|
-
disableAxisListener: (tooltip == null ? void 0 : tooltip.trigger) !== 'axis' && (axisHighlight == null ? void 0 : axisHighlight.x) === 'none' && (axisHighlight == null ? void 0 : axisHighlight.y) === 'none',
|
|
93
|
-
children: [/*#__PURE__*/_jsx(ChartsAxis, {
|
|
94
|
-
topAxis: topAxis,
|
|
95
|
-
leftAxis: leftAxis,
|
|
96
|
-
rightAxis: rightAxis,
|
|
97
|
-
bottomAxis: bottomAxis,
|
|
98
|
-
slots: slots,
|
|
99
|
-
slotProps: slotProps
|
|
100
|
-
}), /*#__PURE__*/_jsx(PiePlot, {
|
|
101
|
-
slots: slots,
|
|
102
|
-
slotProps: slotProps,
|
|
103
|
-
onItemClick: onItemClick,
|
|
104
|
-
skipAnimation: skipAnimation
|
|
105
|
-
}), /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legend, {
|
|
106
|
-
slots: slots,
|
|
107
|
-
slotProps: slotProps
|
|
108
|
-
})), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlight)), /*#__PURE__*/_jsx(ChartsTooltip, _extends({}, tooltip)), children]
|
|
109
|
-
});
|
|
110
|
-
}
|
|
111
|
-
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
112
|
-
// ----------------------------- Warning --------------------------------
|
|
113
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
114
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
115
|
-
// ----------------------------------------------------------------------
|
|
116
|
-
axisHighlight: PropTypes.shape({
|
|
117
|
-
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
118
|
-
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
119
|
-
}),
|
|
120
|
-
/**
|
|
121
|
-
* Indicate which axis to display the bottom of the charts.
|
|
122
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
123
|
-
* @default null
|
|
124
|
-
*/
|
|
125
|
-
bottomAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
126
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
127
|
-
classes: PropTypes.object,
|
|
128
|
-
disableLine: PropTypes.bool,
|
|
129
|
-
disableTicks: PropTypes.bool,
|
|
130
|
-
fill: PropTypes.string,
|
|
131
|
-
label: PropTypes.string,
|
|
132
|
-
labelFontSize: PropTypes.number,
|
|
133
|
-
labelStyle: PropTypes.object,
|
|
134
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
135
|
-
slotProps: PropTypes.object,
|
|
136
|
-
slots: PropTypes.object,
|
|
137
|
-
stroke: PropTypes.string,
|
|
138
|
-
tickFontSize: PropTypes.number,
|
|
139
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
140
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
141
|
-
tickLabelStyle: PropTypes.object,
|
|
142
|
-
tickMaxStep: PropTypes.number,
|
|
143
|
-
tickMinStep: PropTypes.number,
|
|
144
|
-
tickNumber: PropTypes.number,
|
|
145
|
-
tickSize: PropTypes.number
|
|
146
|
-
}), PropTypes.string]),
|
|
147
|
-
children: PropTypes.node,
|
|
148
|
-
className: PropTypes.string,
|
|
149
|
-
/**
|
|
150
|
-
* Color palette used to colorize multiple series.
|
|
151
|
-
* @default blueberryTwilightPalette
|
|
152
|
-
*/
|
|
153
|
-
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
154
|
-
/**
|
|
155
|
-
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
156
|
-
*/
|
|
157
|
-
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
158
|
-
desc: PropTypes.string,
|
|
159
|
-
/**
|
|
160
|
-
* If `true`, the charts will not listen to the mouse move event.
|
|
161
|
-
* It might break interactive features, but will improve performance.
|
|
162
|
-
* @default false
|
|
163
|
-
*/
|
|
164
|
-
disableAxisListener: PropTypes.bool,
|
|
165
|
-
/**
|
|
166
|
-
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
167
|
-
* @default undefined
|
|
168
|
-
*/
|
|
169
|
-
height: PropTypes.number,
|
|
170
|
-
/**
|
|
171
|
-
* Indicate which axis to display the left of the charts.
|
|
172
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
173
|
-
* @default null
|
|
174
|
-
*/
|
|
175
|
-
leftAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
176
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
177
|
-
classes: PropTypes.object,
|
|
178
|
-
disableLine: PropTypes.bool,
|
|
179
|
-
disableTicks: PropTypes.bool,
|
|
180
|
-
fill: PropTypes.string,
|
|
181
|
-
label: PropTypes.string,
|
|
182
|
-
labelFontSize: PropTypes.number,
|
|
183
|
-
labelStyle: PropTypes.object,
|
|
184
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
185
|
-
slotProps: PropTypes.object,
|
|
186
|
-
slots: PropTypes.object,
|
|
187
|
-
stroke: PropTypes.string,
|
|
188
|
-
tickFontSize: PropTypes.number,
|
|
189
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
190
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
191
|
-
tickLabelStyle: PropTypes.object,
|
|
192
|
-
tickMaxStep: PropTypes.number,
|
|
193
|
-
tickMinStep: PropTypes.number,
|
|
194
|
-
tickNumber: PropTypes.number,
|
|
195
|
-
tickSize: PropTypes.number
|
|
196
|
-
}), PropTypes.string]),
|
|
197
|
-
/**
|
|
198
|
-
* @deprecated Consider using `slotProps.legend` instead.
|
|
199
|
-
*/
|
|
200
|
-
legend: PropTypes.shape({
|
|
201
|
-
classes: PropTypes.object,
|
|
202
|
-
direction: PropTypes.oneOf(['column', 'row']),
|
|
203
|
-
hidden: PropTypes.bool,
|
|
204
|
-
position: PropTypes.shape({
|
|
205
|
-
horizontal: PropTypes.oneOf(['left', 'middle', 'right']).isRequired,
|
|
206
|
-
vertical: PropTypes.oneOf(['bottom', 'middle', 'top']).isRequired
|
|
207
|
-
}),
|
|
208
|
-
slotProps: PropTypes.object,
|
|
209
|
-
slots: PropTypes.object
|
|
210
|
-
}),
|
|
211
|
-
/**
|
|
212
|
-
* The margin between the SVG and the drawing area.
|
|
213
|
-
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
214
|
-
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
215
|
-
* @default object Depends on the charts type.
|
|
216
|
-
*/
|
|
217
|
-
margin: PropTypes.shape({
|
|
218
|
-
bottom: PropTypes.number,
|
|
219
|
-
left: PropTypes.number,
|
|
220
|
-
right: PropTypes.number,
|
|
221
|
-
top: PropTypes.number
|
|
222
|
-
}),
|
|
223
|
-
onItemClick: PropTypes.func,
|
|
224
|
-
/**
|
|
225
|
-
* Indicate which axis to display the right of the charts.
|
|
226
|
-
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
227
|
-
* @default null
|
|
228
|
-
*/
|
|
229
|
-
rightAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
230
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
231
|
-
classes: PropTypes.object,
|
|
232
|
-
disableLine: PropTypes.bool,
|
|
233
|
-
disableTicks: PropTypes.bool,
|
|
234
|
-
fill: PropTypes.string,
|
|
235
|
-
label: PropTypes.string,
|
|
236
|
-
labelFontSize: PropTypes.number,
|
|
237
|
-
labelStyle: PropTypes.object,
|
|
238
|
-
position: PropTypes.oneOf(['left', 'right']),
|
|
239
|
-
slotProps: PropTypes.object,
|
|
240
|
-
slots: PropTypes.object,
|
|
241
|
-
stroke: PropTypes.string,
|
|
242
|
-
tickFontSize: PropTypes.number,
|
|
243
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
244
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
245
|
-
tickLabelStyle: PropTypes.object,
|
|
246
|
-
tickMaxStep: PropTypes.number,
|
|
247
|
-
tickMinStep: PropTypes.number,
|
|
248
|
-
tickNumber: PropTypes.number,
|
|
249
|
-
tickSize: PropTypes.number
|
|
250
|
-
}), PropTypes.string]),
|
|
251
|
-
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
252
|
-
/**
|
|
253
|
-
* If `true`, animations are skipped.
|
|
254
|
-
* @default false
|
|
255
|
-
*/
|
|
256
|
-
skipAnimation: PropTypes.bool,
|
|
257
|
-
/**
|
|
258
|
-
* The props used for each component slot.
|
|
259
|
-
* @default {}
|
|
260
|
-
*/
|
|
261
|
-
slotProps: PropTypes.object,
|
|
262
|
-
slots: PropTypes.object,
|
|
263
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
264
|
-
title: PropTypes.string,
|
|
265
|
-
tooltip: PropTypes.shape({
|
|
266
|
-
axisContent: PropTypes.elementType,
|
|
267
|
-
classes: PropTypes.object,
|
|
268
|
-
itemContent: PropTypes.elementType,
|
|
269
|
-
slotProps: PropTypes.object,
|
|
270
|
-
slots: PropTypes.object,
|
|
271
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
272
|
-
}),
|
|
273
|
-
/**
|
|
274
|
-
* Indicate which axis to display the top of the charts.
|
|
275
|
-
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
276
|
-
* @default null
|
|
277
|
-
*/
|
|
278
|
-
topAxis: PropTypes.oneOfType([PropTypes.shape({
|
|
279
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
280
|
-
classes: PropTypes.object,
|
|
281
|
-
disableLine: PropTypes.bool,
|
|
282
|
-
disableTicks: PropTypes.bool,
|
|
283
|
-
fill: PropTypes.string,
|
|
284
|
-
label: PropTypes.string,
|
|
285
|
-
labelFontSize: PropTypes.number,
|
|
286
|
-
labelStyle: PropTypes.object,
|
|
287
|
-
position: PropTypes.oneOf(['bottom', 'top']),
|
|
288
|
-
slotProps: PropTypes.object,
|
|
289
|
-
slots: PropTypes.object,
|
|
290
|
-
stroke: PropTypes.string,
|
|
291
|
-
tickFontSize: PropTypes.number,
|
|
292
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
293
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
294
|
-
tickLabelStyle: PropTypes.object,
|
|
295
|
-
tickMaxStep: PropTypes.number,
|
|
296
|
-
tickMinStep: PropTypes.number,
|
|
297
|
-
tickNumber: PropTypes.number,
|
|
298
|
-
tickSize: PropTypes.number
|
|
299
|
-
}), PropTypes.string]),
|
|
300
|
-
viewBox: PropTypes.shape({
|
|
301
|
-
height: PropTypes.number,
|
|
302
|
-
width: PropTypes.number,
|
|
303
|
-
x: PropTypes.number,
|
|
304
|
-
y: PropTypes.number
|
|
305
|
-
}),
|
|
306
|
-
/**
|
|
307
|
-
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
308
|
-
* @default undefined
|
|
309
|
-
*/
|
|
310
|
-
width: PropTypes.number,
|
|
311
|
-
/**
|
|
312
|
-
* The configuration of the x-axes.
|
|
313
|
-
* If not provided, a default axis config is used with id set to `DEFAULT_X_AXIS_KEY`.
|
|
314
|
-
*/
|
|
315
|
-
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
316
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
317
|
-
classes: PropTypes.object,
|
|
318
|
-
data: PropTypes.array,
|
|
319
|
-
dataKey: PropTypes.string,
|
|
320
|
-
disableLine: PropTypes.bool,
|
|
321
|
-
disableTicks: PropTypes.bool,
|
|
322
|
-
fill: PropTypes.string,
|
|
323
|
-
hideTooltip: PropTypes.bool,
|
|
324
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
325
|
-
label: PropTypes.string,
|
|
326
|
-
labelFontSize: PropTypes.number,
|
|
327
|
-
labelStyle: PropTypes.object,
|
|
328
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
329
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
330
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
331
|
-
reverse: PropTypes.bool,
|
|
332
|
-
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
333
|
-
slotProps: PropTypes.object,
|
|
334
|
-
slots: PropTypes.object,
|
|
335
|
-
stroke: PropTypes.string,
|
|
336
|
-
tickFontSize: PropTypes.number,
|
|
337
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
338
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
339
|
-
tickLabelStyle: PropTypes.object,
|
|
340
|
-
tickMaxStep: PropTypes.number,
|
|
341
|
-
tickMinStep: PropTypes.number,
|
|
342
|
-
tickNumber: PropTypes.number,
|
|
343
|
-
tickSize: PropTypes.number,
|
|
344
|
-
valueFormatter: PropTypes.func
|
|
345
|
-
})),
|
|
346
|
-
/**
|
|
347
|
-
* The configuration of the y-axes.
|
|
348
|
-
* If not provided, a default axis config is used with id set to `DEFAULT_Y_AXIS_KEY`.
|
|
349
|
-
*/
|
|
350
|
-
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
351
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
352
|
-
classes: PropTypes.object,
|
|
353
|
-
data: PropTypes.array,
|
|
354
|
-
dataKey: PropTypes.string,
|
|
355
|
-
disableLine: PropTypes.bool,
|
|
356
|
-
disableTicks: PropTypes.bool,
|
|
357
|
-
fill: PropTypes.string,
|
|
358
|
-
hideTooltip: PropTypes.bool,
|
|
359
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
360
|
-
label: PropTypes.string,
|
|
361
|
-
labelFontSize: PropTypes.number,
|
|
362
|
-
labelStyle: PropTypes.object,
|
|
363
|
-
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
364
|
-
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
365
|
-
position: PropTypes.oneOf(['bottom', 'left', 'right', 'top']),
|
|
366
|
-
reverse: PropTypes.bool,
|
|
367
|
-
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
368
|
-
slotProps: PropTypes.object,
|
|
369
|
-
slots: PropTypes.object,
|
|
370
|
-
stroke: PropTypes.string,
|
|
371
|
-
tickFontSize: PropTypes.number,
|
|
372
|
-
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
373
|
-
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
374
|
-
tickLabelStyle: PropTypes.object,
|
|
375
|
-
tickMaxStep: PropTypes.number,
|
|
376
|
-
tickMinStep: PropTypes.number,
|
|
377
|
-
tickNumber: PropTypes.number,
|
|
378
|
-
tickSize: PropTypes.number,
|
|
379
|
-
valueFormatter: PropTypes.func
|
|
380
|
-
}))
|
|
381
|
-
} : void 0;
|
|
382
|
-
export { PieChart };
|
|
@@ -1,137 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import PropTypes from 'prop-types';
|
|
3
|
-
import { SeriesContext } from '../context/SeriesContextProvider';
|
|
4
|
-
import { DrawingContext } from '../context/DrawingProvider';
|
|
5
|
-
import { PieArcPlot } from './PieArcPlot';
|
|
6
|
-
import { PieArcLabelPlot } from './PieArcLabelPlot';
|
|
7
|
-
import { getPercentageValue } from '../internals/utils';
|
|
8
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
-
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
10
|
-
/**
|
|
11
|
-
* Demos:
|
|
12
|
-
*
|
|
13
|
-
* - [Pie](https://mui.com/x/react-charts/pie/)
|
|
14
|
-
* - [Pie demonstration](https://mui.com/x/react-charts/pie-demo/)
|
|
15
|
-
*
|
|
16
|
-
* API:
|
|
17
|
-
*
|
|
18
|
-
* - [PiePlot API](https://mui.com/x/api/charts/pie-plot/)
|
|
19
|
-
*/
|
|
20
|
-
function PiePlot(props) {
|
|
21
|
-
var skipAnimation = props.skipAnimation,
|
|
22
|
-
slots = props.slots,
|
|
23
|
-
slotProps = props.slotProps,
|
|
24
|
-
onItemClick = props.onItemClick;
|
|
25
|
-
var seriesData = React.useContext(SeriesContext).pie;
|
|
26
|
-
var _React$useContext = React.useContext(DrawingContext),
|
|
27
|
-
left = _React$useContext.left,
|
|
28
|
-
top = _React$useContext.top,
|
|
29
|
-
width = _React$useContext.width,
|
|
30
|
-
height = _React$useContext.height;
|
|
31
|
-
if (seriesData === undefined) {
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
var availableRadius = Math.min(width, height) / 2;
|
|
35
|
-
var series = seriesData.series,
|
|
36
|
-
seriesOrder = seriesData.seriesOrder;
|
|
37
|
-
return /*#__PURE__*/_jsxs("g", {
|
|
38
|
-
children: [seriesOrder.map(function (seriesId) {
|
|
39
|
-
var _series$seriesId = series[seriesId],
|
|
40
|
-
innerRadiusParam = _series$seriesId.innerRadius,
|
|
41
|
-
outerRadiusParam = _series$seriesId.outerRadius,
|
|
42
|
-
cornerRadius = _series$seriesId.cornerRadius,
|
|
43
|
-
paddingAngle = _series$seriesId.paddingAngle,
|
|
44
|
-
data = _series$seriesId.data,
|
|
45
|
-
cxParam = _series$seriesId.cx,
|
|
46
|
-
cyParam = _series$seriesId.cy,
|
|
47
|
-
highlighted = _series$seriesId.highlighted,
|
|
48
|
-
faded = _series$seriesId.faded,
|
|
49
|
-
highlightScope = _series$seriesId.highlightScope;
|
|
50
|
-
var outerRadius = getPercentageValue(outerRadiusParam != null ? outerRadiusParam : availableRadius, availableRadius);
|
|
51
|
-
var innerRadius = getPercentageValue(innerRadiusParam != null ? innerRadiusParam : 0, availableRadius);
|
|
52
|
-
var cx = getPercentageValue(cxParam != null ? cxParam : '50%', width);
|
|
53
|
-
var cy = getPercentageValue(cyParam != null ? cyParam : '50%', height);
|
|
54
|
-
return /*#__PURE__*/_jsx("g", {
|
|
55
|
-
transform: "translate(".concat(left + cx, ", ").concat(top + cy, ")"),
|
|
56
|
-
children: /*#__PURE__*/_jsx(PieArcPlot, {
|
|
57
|
-
innerRadius: innerRadius,
|
|
58
|
-
outerRadius: outerRadius,
|
|
59
|
-
cornerRadius: cornerRadius,
|
|
60
|
-
paddingAngle: paddingAngle,
|
|
61
|
-
id: seriesId,
|
|
62
|
-
data: data,
|
|
63
|
-
skipAnimation: skipAnimation,
|
|
64
|
-
highlightScope: highlightScope,
|
|
65
|
-
highlighted: highlighted,
|
|
66
|
-
faded: faded,
|
|
67
|
-
onItemClick: onItemClick,
|
|
68
|
-
slots: slots,
|
|
69
|
-
slotProps: slotProps
|
|
70
|
-
})
|
|
71
|
-
}, seriesId);
|
|
72
|
-
}), seriesOrder.map(function (seriesId) {
|
|
73
|
-
var _series$seriesId2 = series[seriesId],
|
|
74
|
-
innerRadiusParam = _series$seriesId2.innerRadius,
|
|
75
|
-
outerRadiusParam = _series$seriesId2.outerRadius,
|
|
76
|
-
arcLabelRadiusParam = _series$seriesId2.arcLabelRadius,
|
|
77
|
-
cornerRadius = _series$seriesId2.cornerRadius,
|
|
78
|
-
paddingAngle = _series$seriesId2.paddingAngle,
|
|
79
|
-
arcLabel = _series$seriesId2.arcLabel,
|
|
80
|
-
arcLabelMinAngle = _series$seriesId2.arcLabelMinAngle,
|
|
81
|
-
data = _series$seriesId2.data,
|
|
82
|
-
cxParam = _series$seriesId2.cx,
|
|
83
|
-
cyParam = _series$seriesId2.cy,
|
|
84
|
-
highlightScope = _series$seriesId2.highlightScope;
|
|
85
|
-
var outerRadius = getPercentageValue(outerRadiusParam != null ? outerRadiusParam : availableRadius, availableRadius);
|
|
86
|
-
var innerRadius = getPercentageValue(innerRadiusParam != null ? innerRadiusParam : 0, availableRadius);
|
|
87
|
-
var arcLabelRadius = arcLabelRadiusParam === undefined ? (outerRadius + innerRadius) / 2 : getPercentageValue(arcLabelRadiusParam, availableRadius);
|
|
88
|
-
var cx = getPercentageValue(cxParam != null ? cxParam : '50%', width);
|
|
89
|
-
var cy = getPercentageValue(cyParam != null ? cyParam : '50%', height);
|
|
90
|
-
return /*#__PURE__*/_jsx("g", {
|
|
91
|
-
transform: "translate(".concat(left + cx, ", ").concat(top + cy, ")"),
|
|
92
|
-
children: /*#__PURE__*/_jsx(PieArcLabelPlot, {
|
|
93
|
-
innerRadius: innerRadius,
|
|
94
|
-
outerRadius: outerRadius != null ? outerRadius : availableRadius,
|
|
95
|
-
arcLabelRadius: arcLabelRadius,
|
|
96
|
-
cornerRadius: cornerRadius,
|
|
97
|
-
paddingAngle: paddingAngle,
|
|
98
|
-
id: seriesId,
|
|
99
|
-
data: data,
|
|
100
|
-
skipAnimation: skipAnimation,
|
|
101
|
-
arcLabel: arcLabel,
|
|
102
|
-
arcLabelMinAngle: arcLabelMinAngle,
|
|
103
|
-
highlightScope: highlightScope
|
|
104
|
-
})
|
|
105
|
-
}, seriesId);
|
|
106
|
-
})]
|
|
107
|
-
});
|
|
108
|
-
}
|
|
109
|
-
process.env.NODE_ENV !== "production" ? PiePlot.propTypes = {
|
|
110
|
-
// ----------------------------- Warning --------------------------------
|
|
111
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
112
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
113
|
-
// ----------------------------------------------------------------------
|
|
114
|
-
/**
|
|
115
|
-
* Callback fired when a pie item is clicked.
|
|
116
|
-
* @param {React.MouseEvent<SVGPathElement, MouseEvent>} event The event source of the callback.
|
|
117
|
-
* @param {PieItemIdentifier} pieItemIdentifier The pie item identifier.
|
|
118
|
-
* @param {DefaultizedPieValueType} item The pie item.
|
|
119
|
-
*/
|
|
120
|
-
onItemClick: PropTypes.func,
|
|
121
|
-
/**
|
|
122
|
-
* If `true`, animations are skipped.
|
|
123
|
-
* @default false
|
|
124
|
-
*/
|
|
125
|
-
skipAnimation: PropTypes.bool,
|
|
126
|
-
/**
|
|
127
|
-
* The props used for each component slot.
|
|
128
|
-
* @default {}
|
|
129
|
-
*/
|
|
130
|
-
slotProps: PropTypes.object,
|
|
131
|
-
/**
|
|
132
|
-
* Overridable component slots.
|
|
133
|
-
* @default {}
|
|
134
|
-
*/
|
|
135
|
-
slots: PropTypes.object
|
|
136
|
-
} : void 0;
|
|
137
|
-
export { PiePlot };
|