@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,82 +0,0 @@
|
|
|
1
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
2
|
-
import _defineProperty from "@babel/runtime/helpers/esm/defineProperty";
|
|
3
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
-
import { stack as d3Stack } from 'd3-shape';
|
|
5
|
-
import { getStackingGroups } from '../internals/stackSeries';
|
|
6
|
-
import defaultizeValueFormatter from '../internals/defaultizeValueFormatter';
|
|
7
|
-
var warnedOnce = false;
|
|
8
|
-
|
|
9
|
-
// For now it's a copy past of bar charts formatter, but maybe will diverge later
|
|
10
|
-
var formatter = function formatter(params, dataset) {
|
|
11
|
-
var _ref;
|
|
12
|
-
var seriesOrder = params.seriesOrder,
|
|
13
|
-
series = params.series;
|
|
14
|
-
var stackingGroups = getStackingGroups(_extends({}, params, {
|
|
15
|
-
defaultStrategy: {
|
|
16
|
-
stackOffset: 'none'
|
|
17
|
-
}
|
|
18
|
-
}));
|
|
19
|
-
|
|
20
|
-
// Create a data set with format adapted to d3
|
|
21
|
-
var d3Dataset = (_ref = dataset) != null ? _ref : [];
|
|
22
|
-
seriesOrder.forEach(function (id) {
|
|
23
|
-
var data = series[id].data;
|
|
24
|
-
if (data !== undefined) {
|
|
25
|
-
data.forEach(function (value, index) {
|
|
26
|
-
if (d3Dataset.length <= index) {
|
|
27
|
-
d3Dataset.push(_defineProperty({}, id, value));
|
|
28
|
-
} else {
|
|
29
|
-
d3Dataset[index][id] = value;
|
|
30
|
-
}
|
|
31
|
-
});
|
|
32
|
-
} else if (dataset === undefined && process.env.NODE_ENV !== 'production') {
|
|
33
|
-
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'));
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
var completedSeries = {};
|
|
37
|
-
stackingGroups.forEach(function (stackingGroup) {
|
|
38
|
-
// Get stacked values, and derive the domain
|
|
39
|
-
var ids = stackingGroup.ids,
|
|
40
|
-
stackingOrder = stackingGroup.stackingOrder,
|
|
41
|
-
stackingOffset = stackingGroup.stackingOffset;
|
|
42
|
-
var stackedSeries = d3Stack().keys(ids.map(function (id) {
|
|
43
|
-
// Use dataKey if needed and available
|
|
44
|
-
var dataKey = series[id].dataKey;
|
|
45
|
-
return series[id].data === undefined && dataKey !== undefined ? dataKey : id;
|
|
46
|
-
})).value(function (d, key) {
|
|
47
|
-
var _d$key;
|
|
48
|
-
return (_d$key = d[key]) != null ? _d$key : 0;
|
|
49
|
-
}) // defaultize null value to 0
|
|
50
|
-
.order(stackingOrder).offset(stackingOffset)(d3Dataset);
|
|
51
|
-
ids.forEach(function (id, index) {
|
|
52
|
-
var dataKey = series[id].dataKey;
|
|
53
|
-
completedSeries[id] = _extends({}, series[id], {
|
|
54
|
-
data: dataKey ? dataset.map(function (data) {
|
|
55
|
-
var value = data[dataKey];
|
|
56
|
-
if (typeof value !== 'number') {
|
|
57
|
-
if (process.env.NODE_ENV !== 'production' && !warnedOnce && value !== null) {
|
|
58
|
-
warnedOnce = true;
|
|
59
|
-
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.']);
|
|
60
|
-
}
|
|
61
|
-
return null;
|
|
62
|
-
}
|
|
63
|
-
return value;
|
|
64
|
-
}) : series[id].data,
|
|
65
|
-
stackedData: stackedSeries[index].map(function (_ref2) {
|
|
66
|
-
var _ref3 = _slicedToArray(_ref2, 2),
|
|
67
|
-
a = _ref3[0],
|
|
68
|
-
b = _ref3[1];
|
|
69
|
-
return [a, b];
|
|
70
|
-
})
|
|
71
|
-
});
|
|
72
|
-
});
|
|
73
|
-
});
|
|
74
|
-
return {
|
|
75
|
-
seriesOrder: seriesOrder,
|
|
76
|
-
stackingGroups: stackingGroups,
|
|
77
|
-
series: defaultizeValueFormatter(completedSeries, function (v) {
|
|
78
|
-
return v == null ? '' : v.toLocaleString();
|
|
79
|
-
})
|
|
80
|
-
};
|
|
81
|
-
};
|
|
82
|
-
export default formatter;
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
export * from './LineChart';
|
|
2
|
-
export * from './LinePlot';
|
|
3
|
-
export * from './AreaPlot';
|
|
4
|
-
export * from './MarkPlot';
|
|
5
|
-
export * from './LineHighlightPlot';
|
|
6
|
-
export * from './AreaElement';
|
|
7
|
-
export * from './AnimatedArea';
|
|
8
|
-
export * from './LineElement';
|
|
9
|
-
export * from './AnimatedLine';
|
|
10
|
-
export * from './MarkElement';
|
|
11
|
-
export * from './LineHighlightElement';
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
var legendGetter = function legendGetter(params) {
|
|
2
|
-
var seriesOrder = params.seriesOrder,
|
|
3
|
-
series = params.series;
|
|
4
|
-
var data = seriesOrder.map(function (seriesId) {
|
|
5
|
-
return {
|
|
6
|
-
color: series[seriesId].color,
|
|
7
|
-
label: series[seriesId].label,
|
|
8
|
-
id: seriesId
|
|
9
|
-
};
|
|
10
|
-
});
|
|
11
|
-
return data.filter(function (item) {
|
|
12
|
-
return item.label !== undefined;
|
|
13
|
-
});
|
|
14
|
-
};
|
|
15
|
-
export default legendGetter;
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
var _excluded = ["id", "dataIndex", "classes", "color", "highlightScope", "onClick", "isFaded", "isHighlighted", "startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "cornerRadius"];
|
|
4
|
-
import * as React from 'react';
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import { arc as d3Arc } from 'd3-shape';
|
|
7
|
-
import { animated, to } from '@react-spring/web';
|
|
8
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
-
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
10
|
-
import { styled } from '@mui/material/styles';
|
|
11
|
-
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
12
|
-
import { 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 var pieArcClasses = generateUtilityClasses('MuiPieArc', ['root', 'highlighted', 'faded']);
|
|
18
|
-
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
19
|
-
var classes = ownerState.classes,
|
|
20
|
-
id = ownerState.id,
|
|
21
|
-
isFaded = ownerState.isFaded,
|
|
22
|
-
isHighlighted = ownerState.isHighlighted;
|
|
23
|
-
var slots = {
|
|
24
|
-
root: ['root', "series-".concat(id), isHighlighted && 'highlighted', isFaded && 'faded']
|
|
25
|
-
};
|
|
26
|
-
return composeClasses(slots, getPieArcUtilityClass, classes);
|
|
27
|
-
};
|
|
28
|
-
var PieArcRoot = styled(animated.path, {
|
|
29
|
-
name: 'MuiPieArc',
|
|
30
|
-
slot: 'Root',
|
|
31
|
-
overridesResolver: function overridesResolver(_, styles) {
|
|
32
|
-
return styles.arc;
|
|
33
|
-
}
|
|
34
|
-
})(function (_ref) {
|
|
35
|
-
var theme = _ref.theme;
|
|
36
|
-
return {
|
|
37
|
-
stroke: (theme.vars || theme).palette.background.paper,
|
|
38
|
-
strokeWidth: 1,
|
|
39
|
-
strokeLinejoin: 'round'
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
function PieArc(props) {
|
|
43
|
-
var id = props.id,
|
|
44
|
-
dataIndex = props.dataIndex,
|
|
45
|
-
innerClasses = props.classes,
|
|
46
|
-
color = props.color,
|
|
47
|
-
highlightScope = props.highlightScope,
|
|
48
|
-
onClick = props.onClick,
|
|
49
|
-
isFaded = props.isFaded,
|
|
50
|
-
isHighlighted = props.isHighlighted,
|
|
51
|
-
startAngle = props.startAngle,
|
|
52
|
-
endAngle = props.endAngle,
|
|
53
|
-
paddingAngle = props.paddingAngle,
|
|
54
|
-
innerRadius = props.innerRadius,
|
|
55
|
-
outerRadius = props.outerRadius,
|
|
56
|
-
cornerRadius = props.cornerRadius,
|
|
57
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
58
|
-
var ownerState = {
|
|
59
|
-
id: id,
|
|
60
|
-
dataIndex: dataIndex,
|
|
61
|
-
classes: innerClasses,
|
|
62
|
-
color: color,
|
|
63
|
-
isFaded: isFaded,
|
|
64
|
-
isHighlighted: isHighlighted
|
|
65
|
-
};
|
|
66
|
-
var classes = useUtilityClasses(ownerState);
|
|
67
|
-
var getInteractionItemProps = useInteractionItemProps(highlightScope);
|
|
68
|
-
return /*#__PURE__*/_jsx(PieArcRoot, _extends({
|
|
69
|
-
d: to([startAngle, endAngle, paddingAngle, innerRadius, outerRadius, cornerRadius], function (sA, eA, pA, iR, oR, cR) {
|
|
70
|
-
return d3Arc().cornerRadius(cR)({
|
|
71
|
-
padAngle: pA,
|
|
72
|
-
startAngle: sA,
|
|
73
|
-
endAngle: eA,
|
|
74
|
-
innerRadius: iR,
|
|
75
|
-
outerRadius: oR
|
|
76
|
-
});
|
|
77
|
-
}),
|
|
78
|
-
onClick: onClick,
|
|
79
|
-
cursor: onClick ? 'pointer' : 'unset',
|
|
80
|
-
ownerState: ownerState,
|
|
81
|
-
className: classes.root
|
|
82
|
-
}, other, getInteractionItemProps({
|
|
83
|
-
type: 'pie',
|
|
84
|
-
seriesId: id,
|
|
85
|
-
dataIndex: dataIndex
|
|
86
|
-
})));
|
|
87
|
-
}
|
|
88
|
-
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
89
|
-
// ----------------------------- Warning --------------------------------
|
|
90
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
91
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
92
|
-
// ----------------------------------------------------------------------
|
|
93
|
-
classes: PropTypes.object,
|
|
94
|
-
dataIndex: PropTypes.number.isRequired,
|
|
95
|
-
highlightScope: PropTypes.shape({
|
|
96
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
97
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
98
|
-
}),
|
|
99
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
100
|
-
isFaded: PropTypes.bool.isRequired,
|
|
101
|
-
isHighlighted: PropTypes.bool.isRequired
|
|
102
|
-
} : void 0;
|
|
103
|
-
export { PieArc };
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
|
3
|
-
import _slicedToArray from "@babel/runtime/helpers/esm/slicedToArray";
|
|
4
|
-
var _excluded = ["id", "classes", "color", "startAngle", "endAngle", "paddingAngle", "arcLabelRadius", "innerRadius", "outerRadius", "cornerRadius", "formattedArcLabel", "isHighlighted", "isFaded", "style"];
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { animated, to } from '@react-spring/web';
|
|
8
|
-
import { arc as d3Arc } from 'd3-shape';
|
|
9
|
-
import composeClasses from '@mui/utils/composeClasses';
|
|
10
|
-
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
11
|
-
import { styled } from '@mui/material/styles';
|
|
12
|
-
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
-
export function getPieArcLabelUtilityClass(slot) {
|
|
15
|
-
return generateUtilityClass('MuiPieArcLabel', slot);
|
|
16
|
-
}
|
|
17
|
-
export var pieArcLabelClasses = generateUtilityClasses('MuiPieArcLabel', ['root', 'highlighted', 'faded']);
|
|
18
|
-
var useUtilityClasses = function useUtilityClasses(ownerState) {
|
|
19
|
-
var classes = ownerState.classes,
|
|
20
|
-
id = ownerState.id,
|
|
21
|
-
isFaded = ownerState.isFaded,
|
|
22
|
-
isHighlighted = ownerState.isHighlighted;
|
|
23
|
-
var slots = {
|
|
24
|
-
root: ['root', "series-".concat(id), isHighlighted && 'highlighted', isFaded && 'faded']
|
|
25
|
-
};
|
|
26
|
-
return composeClasses(slots, getPieArcLabelUtilityClass, classes);
|
|
27
|
-
};
|
|
28
|
-
var PieArcLabelRoot = styled(animated.text, {
|
|
29
|
-
name: 'MuiPieArcLabel',
|
|
30
|
-
slot: 'Root',
|
|
31
|
-
overridesResolver: function overridesResolver(_, styles) {
|
|
32
|
-
return styles.root;
|
|
33
|
-
}
|
|
34
|
-
})(function (_ref) {
|
|
35
|
-
var theme = _ref.theme;
|
|
36
|
-
return {
|
|
37
|
-
fill: (theme.vars || theme).palette.text.primary,
|
|
38
|
-
textAnchor: 'middle',
|
|
39
|
-
dominantBaseline: 'middle'
|
|
40
|
-
};
|
|
41
|
-
});
|
|
42
|
-
/**
|
|
43
|
-
* Helper to compute label position.
|
|
44
|
-
* It's not an inline function because we need it in inerpolation.
|
|
45
|
-
*/
|
|
46
|
-
var getLabelPosition = function getLabelPosition(formattedArcLabel, variable) {
|
|
47
|
-
return function (startAngle, endAngle, padAngle, arcLabelRadius, cornerRadius) {
|
|
48
|
-
if (!formattedArcLabel) {
|
|
49
|
-
return 0;
|
|
50
|
-
}
|
|
51
|
-
var _ref2 = d3Arc().cornerRadius(cornerRadius).centroid({
|
|
52
|
-
padAngle: padAngle,
|
|
53
|
-
startAngle: startAngle,
|
|
54
|
-
endAngle: endAngle,
|
|
55
|
-
innerRadius: arcLabelRadius,
|
|
56
|
-
outerRadius: arcLabelRadius
|
|
57
|
-
}),
|
|
58
|
-
_ref3 = _slicedToArray(_ref2, 2),
|
|
59
|
-
x = _ref3[0],
|
|
60
|
-
y = _ref3[1];
|
|
61
|
-
if (variable === 'x') {
|
|
62
|
-
return x;
|
|
63
|
-
}
|
|
64
|
-
return y;
|
|
65
|
-
};
|
|
66
|
-
};
|
|
67
|
-
function PieArcLabel(props) {
|
|
68
|
-
var id = props.id,
|
|
69
|
-
innerClasses = props.classes,
|
|
70
|
-
color = props.color,
|
|
71
|
-
startAngle = props.startAngle,
|
|
72
|
-
endAngle = props.endAngle,
|
|
73
|
-
paddingAngle = props.paddingAngle,
|
|
74
|
-
arcLabelRadius = props.arcLabelRadius,
|
|
75
|
-
innerRadius = props.innerRadius,
|
|
76
|
-
outerRadius = props.outerRadius,
|
|
77
|
-
cornerRadius = props.cornerRadius,
|
|
78
|
-
formattedArcLabel = props.formattedArcLabel,
|
|
79
|
-
isHighlighted = props.isHighlighted,
|
|
80
|
-
isFaded = props.isFaded,
|
|
81
|
-
style = props.style,
|
|
82
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
83
|
-
var ownerState = {
|
|
84
|
-
id: id,
|
|
85
|
-
classes: innerClasses,
|
|
86
|
-
color: color,
|
|
87
|
-
isFaded: isFaded,
|
|
88
|
-
isHighlighted: isHighlighted
|
|
89
|
-
};
|
|
90
|
-
var classes = useUtilityClasses(ownerState);
|
|
91
|
-
return /*#__PURE__*/_jsx(PieArcLabelRoot, _extends({
|
|
92
|
-
className: classes.root
|
|
93
|
-
}, other, {
|
|
94
|
-
style: _extends({
|
|
95
|
-
x: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'x')),
|
|
96
|
-
y: to([startAngle, endAngle, paddingAngle, arcLabelRadius, cornerRadius], getLabelPosition(formattedArcLabel, 'y'))
|
|
97
|
-
}, style),
|
|
98
|
-
children: formattedArcLabel
|
|
99
|
-
}));
|
|
100
|
-
}
|
|
101
|
-
process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
102
|
-
// ----------------------------- Warning --------------------------------
|
|
103
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
104
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
105
|
-
// ----------------------------------------------------------------------
|
|
106
|
-
classes: PropTypes.object,
|
|
107
|
-
formattedArcLabel: PropTypes.string,
|
|
108
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
109
|
-
isFaded: PropTypes.bool.isRequired,
|
|
110
|
-
isHighlighted: PropTypes.bool.isRequired
|
|
111
|
-
} : void 0;
|
|
112
|
-
export { PieArcLabel };
|
|
@@ -1,193 +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", "arcLabelRadius", "cornerRadius", "paddingAngle", "id", "highlightScope", "highlighted", "faded", "data", "arcLabel", "arcLabelMinAngle", "skipAnimation"],
|
|
4
|
-
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
|
|
5
|
-
import * as React from 'react';
|
|
6
|
-
import PropTypes from 'prop-types';
|
|
7
|
-
import { useTransition } from '@react-spring/web';
|
|
8
|
-
import { defaultLabelTransitionConfig } from './dataTransform/transition';
|
|
9
|
-
import { useTransformData } from './dataTransform/useTransformData';
|
|
10
|
-
import { PieArcLabel } from './PieArcLabel';
|
|
11
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
-
var RATIO = 180 / Math.PI;
|
|
13
|
-
function getItemLabel(arcLabel, arcLabelMinAngle, item) {
|
|
14
|
-
if (!arcLabel) {
|
|
15
|
-
return null;
|
|
16
|
-
}
|
|
17
|
-
var angle = (item.endAngle - item.startAngle) * RATIO;
|
|
18
|
-
if (angle < arcLabelMinAngle) {
|
|
19
|
-
return null;
|
|
20
|
-
}
|
|
21
|
-
if (typeof arcLabel === 'string') {
|
|
22
|
-
var _item$arcLabel;
|
|
23
|
-
return (_item$arcLabel = item[arcLabel]) == null ? void 0 : _item$arcLabel.toString();
|
|
24
|
-
}
|
|
25
|
-
return arcLabel(item);
|
|
26
|
-
}
|
|
27
|
-
function PieArcLabelPlot(props) {
|
|
28
|
-
var _slots$pieArcLabel;
|
|
29
|
-
var slots = props.slots,
|
|
30
|
-
slotProps = props.slotProps,
|
|
31
|
-
innerRadius = props.innerRadius,
|
|
32
|
-
outerRadius = props.outerRadius,
|
|
33
|
-
arcLabelRadius = props.arcLabelRadius,
|
|
34
|
-
_props$cornerRadius = props.cornerRadius,
|
|
35
|
-
cornerRadius = _props$cornerRadius === void 0 ? 0 : _props$cornerRadius,
|
|
36
|
-
_props$paddingAngle = props.paddingAngle,
|
|
37
|
-
paddingAngle = _props$paddingAngle === void 0 ? 0 : _props$paddingAngle,
|
|
38
|
-
id = props.id,
|
|
39
|
-
highlightScope = props.highlightScope,
|
|
40
|
-
highlighted = props.highlighted,
|
|
41
|
-
_props$faded = props.faded,
|
|
42
|
-
faded = _props$faded === void 0 ? {
|
|
43
|
-
additionalRadius: -5
|
|
44
|
-
} : _props$faded,
|
|
45
|
-
data = props.data,
|
|
46
|
-
arcLabel = props.arcLabel,
|
|
47
|
-
_props$arcLabelMinAng = props.arcLabelMinAngle,
|
|
48
|
-
arcLabelMinAngle = _props$arcLabelMinAng === void 0 ? 0 : _props$arcLabelMinAng,
|
|
49
|
-
skipAnimation = props.skipAnimation,
|
|
50
|
-
other = _objectWithoutProperties(props, _excluded);
|
|
51
|
-
var transformedData = useTransformData({
|
|
52
|
-
innerRadius: innerRadius,
|
|
53
|
-
outerRadius: outerRadius,
|
|
54
|
-
arcLabelRadius: arcLabelRadius,
|
|
55
|
-
cornerRadius: cornerRadius,
|
|
56
|
-
paddingAngle: paddingAngle,
|
|
57
|
-
id: id,
|
|
58
|
-
highlightScope: highlightScope,
|
|
59
|
-
highlighted: highlighted,
|
|
60
|
-
faded: faded,
|
|
61
|
-
data: data
|
|
62
|
-
});
|
|
63
|
-
var transition = useTransition(transformedData, _extends({}, defaultLabelTransitionConfig, {
|
|
64
|
-
immediate: skipAnimation
|
|
65
|
-
}));
|
|
66
|
-
if (data.length === 0) {
|
|
67
|
-
return null;
|
|
68
|
-
}
|
|
69
|
-
var ArcLabel = (_slots$pieArcLabel = slots == null ? void 0 : slots.pieArcLabel) != null ? _slots$pieArcLabel : PieArcLabel;
|
|
70
|
-
return /*#__PURE__*/_jsx("g", _extends({}, other, {
|
|
71
|
-
children: transition(function (_ref, item) {
|
|
72
|
-
var startAngle = _ref.startAngle,
|
|
73
|
-
endAngle = _ref.endAngle,
|
|
74
|
-
pA = _ref.paddingAngle,
|
|
75
|
-
iR = _ref.innerRadius,
|
|
76
|
-
oR = _ref.outerRadius,
|
|
77
|
-
aLR = _ref.arcLabelRadius,
|
|
78
|
-
cR = _ref.cornerRadius,
|
|
79
|
-
style = _objectWithoutProperties(_ref, _excluded2);
|
|
80
|
-
return /*#__PURE__*/_jsx(ArcLabel, _extends({
|
|
81
|
-
startAngle: startAngle,
|
|
82
|
-
endAngle: endAngle,
|
|
83
|
-
paddingAngle: pA,
|
|
84
|
-
innerRadius: iR,
|
|
85
|
-
outerRadius: oR,
|
|
86
|
-
arcLabelRadius: aLR,
|
|
87
|
-
cornerRadius: cR,
|
|
88
|
-
style: style,
|
|
89
|
-
id: id,
|
|
90
|
-
color: item.color,
|
|
91
|
-
isFaded: item.isFaded,
|
|
92
|
-
isHighlighted: item.isHighlighted,
|
|
93
|
-
formattedArcLabel: getItemLabel(arcLabel, arcLabelMinAngle, item)
|
|
94
|
-
}, slotProps == null ? void 0 : slotProps.pieArcLabel));
|
|
95
|
-
})
|
|
96
|
-
}));
|
|
97
|
-
}
|
|
98
|
-
process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
99
|
-
// ----------------------------- Warning --------------------------------
|
|
100
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
101
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
102
|
-
// ----------------------------------------------------------------------
|
|
103
|
-
/**
|
|
104
|
-
* The label displayed into the arc.
|
|
105
|
-
*/
|
|
106
|
-
arcLabel: PropTypes.oneOfType([PropTypes.oneOf(['formattedValue', 'label', 'value']), PropTypes.func]),
|
|
107
|
-
/**
|
|
108
|
-
* The minimal angle required to display the arc label.
|
|
109
|
-
* @default 0
|
|
110
|
-
*/
|
|
111
|
-
arcLabelMinAngle: PropTypes.number,
|
|
112
|
-
/**
|
|
113
|
-
* The radius between circle center and the arc label in px.
|
|
114
|
-
* @default (innerRadius - outerRadius) / 2
|
|
115
|
-
*/
|
|
116
|
-
arcLabelRadius: PropTypes.number,
|
|
117
|
-
/**
|
|
118
|
-
* The radius applied to arc corners (similar to border radius).
|
|
119
|
-
* @default 0
|
|
120
|
-
*/
|
|
121
|
-
cornerRadius: PropTypes.number,
|
|
122
|
-
data: PropTypes.arrayOf(PropTypes.shape({
|
|
123
|
-
color: PropTypes.string.isRequired,
|
|
124
|
-
endAngle: PropTypes.number.isRequired,
|
|
125
|
-
formattedValue: PropTypes.string.isRequired,
|
|
126
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
127
|
-
index: PropTypes.number.isRequired,
|
|
128
|
-
label: PropTypes.string,
|
|
129
|
-
padAngle: PropTypes.number.isRequired,
|
|
130
|
-
startAngle: PropTypes.number.isRequired,
|
|
131
|
-
value: PropTypes.number.isRequired
|
|
132
|
-
})).isRequired,
|
|
133
|
-
/**
|
|
134
|
-
* Override the arc attibutes when it is faded.
|
|
135
|
-
* @default { additionalRadius: -5 }
|
|
136
|
-
*/
|
|
137
|
-
faded: PropTypes.shape({
|
|
138
|
-
additionalRadius: PropTypes.number,
|
|
139
|
-
arcLabelRadius: PropTypes.number,
|
|
140
|
-
color: PropTypes.string,
|
|
141
|
-
cornerRadius: PropTypes.number,
|
|
142
|
-
innerRadius: PropTypes.number,
|
|
143
|
-
outerRadius: PropTypes.number,
|
|
144
|
-
paddingAngle: PropTypes.number
|
|
145
|
-
}),
|
|
146
|
-
/**
|
|
147
|
-
* Override the arc attibutes when it is highlighted.
|
|
148
|
-
*/
|
|
149
|
-
highlighted: PropTypes.shape({
|
|
150
|
-
additionalRadius: PropTypes.number,
|
|
151
|
-
arcLabelRadius: PropTypes.number,
|
|
152
|
-
color: PropTypes.string,
|
|
153
|
-
cornerRadius: PropTypes.number,
|
|
154
|
-
innerRadius: PropTypes.number,
|
|
155
|
-
outerRadius: PropTypes.number,
|
|
156
|
-
paddingAngle: PropTypes.number
|
|
157
|
-
}),
|
|
158
|
-
highlightScope: PropTypes.shape({
|
|
159
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
160
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
161
|
-
}),
|
|
162
|
-
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
163
|
-
/**
|
|
164
|
-
* The radius between circle center and the begining of the arc.
|
|
165
|
-
* @default 0
|
|
166
|
-
*/
|
|
167
|
-
innerRadius: PropTypes.number,
|
|
168
|
-
/**
|
|
169
|
-
* The radius between circle center and the end of the arc.
|
|
170
|
-
*/
|
|
171
|
-
outerRadius: PropTypes.number.isRequired,
|
|
172
|
-
/**
|
|
173
|
-
* The padding angle (deg) between two arcs.
|
|
174
|
-
* @default 0
|
|
175
|
-
*/
|
|
176
|
-
paddingAngle: PropTypes.number,
|
|
177
|
-
/**
|
|
178
|
-
* If `true`, animations are skipped.
|
|
179
|
-
* @default false
|
|
180
|
-
*/
|
|
181
|
-
skipAnimation: PropTypes.bool,
|
|
182
|
-
/**
|
|
183
|
-
* The props used for each component slot.
|
|
184
|
-
* @default {}
|
|
185
|
-
*/
|
|
186
|
-
slotProps: PropTypes.object,
|
|
187
|
-
/**
|
|
188
|
-
* Overridable component slots.
|
|
189
|
-
* @default {}
|
|
190
|
-
*/
|
|
191
|
-
slots: PropTypes.object
|
|
192
|
-
} : void 0;
|
|
193
|
-
export { PieArcLabelPlot };
|