@mui/x-charts 7.5.0 → 7.6.0
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.js +30 -3
- package/BarChart/BarElement.d.ts +0 -3
- package/BarChart/BarElement.js +8 -19
- package/BarChart/BarLabel/BarLabel.d.ts +1342 -0
- package/BarChart/BarLabel/BarLabel.js +60 -0
- package/BarChart/BarLabel/BarLabel.types.d.ts +39 -0
- package/BarChart/BarLabel/BarLabel.types.js +5 -0
- package/BarChart/BarLabel/BarLabelItem.d.ts +53 -0
- package/BarChart/BarLabel/BarLabelItem.js +127 -0
- package/BarChart/BarLabel/BarLabelPlot.d.ts +16 -0
- package/BarChart/BarLabel/BarLabelPlot.js +106 -0
- package/BarChart/BarLabel/barLabelClasses.d.ts +13 -0
- package/BarChart/BarLabel/barLabelClasses.js +29 -0
- package/BarChart/BarLabel/getBarLabel.d.ts +10 -0
- package/BarChart/BarLabel/getBarLabel.js +31 -0
- package/BarChart/BarLabel/index.d.ts +6 -0
- package/BarChart/BarLabel/index.js +25 -0
- package/BarChart/BarPlot.d.ts +15 -4
- package/BarChart/BarPlot.js +22 -34
- package/BarChart/checkScaleErrors.d.ts +11 -0
- package/BarChart/checkScaleErrors.js +33 -0
- package/BarChart/index.d.ts +1 -0
- package/BarChart/index.js +11 -0
- package/BarChart/types.d.ts +0 -2
- package/CHANGELOG.md +148 -5418
- package/ChartContainer/ChartContainer.d.ts +3 -2
- package/ChartContainer/ChartContainer.js +20 -3
- package/ChartsAxis/ChartsAxis.js +1 -1
- package/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/ChartsClipPath/ChartsClipPath.js +1 -1
- package/ChartsGrid/ChartsGrid.js +1 -1
- package/ChartsLegend/ChartsLegend.js +1 -1
- package/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsSurface.js +1 -1
- package/ChartsText/ChartsText.js +1 -1
- package/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
- package/ChartsTooltip/ChartsTooltip.js +1 -1
- package/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
- package/ChartsXAxis/ChartsXAxis.js +1 -1
- package/ChartsYAxis/ChartsYAxis.js +1 -1
- package/Gauge/Gauge.js +1 -1
- package/Gauge/GaugeContainer.js +1 -1
- package/Gauge/GaugeValueText.js +1 -1
- package/LineChart/AnimatedArea.js +1 -1
- package/LineChart/AnimatedLine.js +1 -1
- package/LineChart/AreaElement.d.ts +0 -2
- package/LineChart/AreaElement.js +8 -18
- package/LineChart/AreaPlot.js +1 -3
- package/LineChart/LineChart.js +19 -2
- package/LineChart/LineElement.d.ts +0 -2
- package/LineChart/LineElement.js +8 -18
- package/LineChart/LineHighlightElement.js +1 -1
- package/LineChart/LineHighlightPlot.js +1 -1
- package/LineChart/LinePlot.js +1 -3
- package/LineChart/MarkElement.d.ts +0 -2
- package/LineChart/MarkElement.js +11 -33
- package/LineChart/MarkPlot.js +1 -2
- package/PieChart/PieArc.d.ts +4 -1
- package/PieChart/PieArc.js +8 -4
- package/PieChart/PieArcLabel.js +1 -1
- package/PieChart/PieArcLabelPlot.d.ts +1 -1
- package/PieChart/PieArcLabelPlot.js +2 -8
- package/PieChart/PieArcPlot.d.ts +1 -1
- package/PieChart/PieArcPlot.js +6 -8
- package/PieChart/PieChart.js +19 -2
- package/PieChart/PiePlot.js +3 -7
- package/PieChart/dataTransform/useTransformData.d.ts +1 -1
- package/PieChart/dataTransform/useTransformData.js +10 -25
- package/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
- package/ScatterChart/Scatter.js +15 -11
- package/ScatterChart/ScatterChart.js +19 -2
- package/ScatterChart/ScatterPlot.js +1 -1
- package/SparkLineChart/SparkLineChart.d.ts +1 -1
- package/SparkLineChart/SparkLineChart.js +14 -1
- package/context/HighlightedProvider/HighlightedContext.d.ts +65 -0
- package/context/HighlightedProvider/HighlightedContext.js +36 -0
- package/context/HighlightedProvider/HighlightedProvider.d.ts +20 -0
- package/context/HighlightedProvider/HighlightedProvider.js +97 -0
- package/context/HighlightedProvider/createIsFaded.d.ts +2 -0
- package/context/HighlightedProvider/createIsFaded.js +19 -0
- package/context/HighlightedProvider/createIsHighlighted.d.ts +2 -0
- package/context/HighlightedProvider/createIsHighlighted.js +19 -0
- package/context/HighlightedProvider/index.d.ts +4 -0
- package/context/HighlightedProvider/index.js +49 -0
- package/context/HighlightedProvider/useHighlighted.d.ts +9 -0
- package/context/HighlightedProvider/useHighlighted.js +24 -0
- package/context/HighlightedProvider/useItemHighlighted.d.ts +21 -0
- package/context/HighlightedProvider/useItemHighlighted.js +37 -0
- package/context/ZAxisContextProvider.js +1 -1
- package/context/index.d.ts +1 -1
- package/context/index.js +15 -0
- package/esm/BarChart/BarChart.js +30 -3
- package/esm/BarChart/BarElement.js +9 -20
- package/esm/BarChart/BarLabel/BarLabel.js +51 -0
- package/esm/BarChart/BarLabel/BarLabel.types.js +1 -0
- package/esm/BarChart/BarLabel/BarLabelItem.js +119 -0
- package/esm/BarChart/BarLabel/BarLabelPlot.js +98 -0
- package/esm/BarChart/BarLabel/barLabelClasses.js +19 -0
- package/esm/BarChart/BarLabel/getBarLabel.js +24 -0
- package/esm/BarChart/BarLabel/index.js +2 -0
- package/esm/BarChart/BarPlot.js +22 -34
- package/esm/BarChart/checkScaleErrors.js +27 -0
- package/esm/BarChart/index.js +2 -1
- package/esm/ChartContainer/ChartContainer.js +20 -3
- package/esm/ChartsAxis/ChartsAxis.js +1 -1
- package/esm/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/esm/ChartsClipPath/ChartsClipPath.js +1 -1
- package/esm/ChartsGrid/ChartsGrid.js +1 -1
- package/esm/ChartsLegend/ChartsLegend.js +1 -1
- package/esm/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/esm/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsSurface.js +1 -1
- package/esm/ChartsText/ChartsText.js +1 -1
- package/esm/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/esm/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
- package/esm/ChartsTooltip/ChartsTooltip.js +1 -1
- package/esm/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/esm/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/esm/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
- package/esm/ChartsXAxis/ChartsXAxis.js +1 -1
- package/esm/ChartsYAxis/ChartsYAxis.js +1 -1
- package/esm/Gauge/Gauge.js +1 -1
- package/esm/Gauge/GaugeContainer.js +1 -1
- package/esm/Gauge/GaugeValueText.js +1 -1
- package/esm/LineChart/AnimatedArea.js +1 -1
- package/esm/LineChart/AnimatedLine.js +1 -1
- package/esm/LineChart/AreaElement.js +9 -19
- package/esm/LineChart/AreaPlot.js +1 -3
- package/esm/LineChart/LineChart.js +19 -2
- package/esm/LineChart/LineElement.js +9 -19
- package/esm/LineChart/LineHighlightElement.js +1 -1
- package/esm/LineChart/LineHighlightPlot.js +1 -1
- package/esm/LineChart/LinePlot.js +1 -3
- package/esm/LineChart/MarkElement.js +12 -34
- package/esm/LineChart/MarkPlot.js +1 -2
- package/esm/PieChart/PieArc.js +8 -4
- package/esm/PieChart/PieArcLabel.js +1 -1
- package/esm/PieChart/PieArcLabelPlot.js +2 -8
- package/esm/PieChart/PieArcPlot.js +6 -8
- package/esm/PieChart/PieChart.js +19 -2
- package/esm/PieChart/PiePlot.js +3 -7
- package/esm/PieChart/dataTransform/useTransformData.js +10 -25
- package/esm/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
- package/esm/ScatterChart/Scatter.js +16 -12
- package/esm/ScatterChart/ScatterChart.js +19 -2
- package/esm/ScatterChart/ScatterPlot.js +1 -1
- package/esm/SparkLineChart/SparkLineChart.js +14 -1
- package/esm/context/HighlightedProvider/HighlightedContext.js +29 -0
- package/esm/context/HighlightedProvider/HighlightedProvider.js +89 -0
- package/esm/context/HighlightedProvider/createIsFaded.js +12 -0
- package/esm/context/HighlightedProvider/createIsHighlighted.js +12 -0
- package/esm/context/HighlightedProvider/index.js +4 -0
- package/esm/context/HighlightedProvider/useHighlighted.js +17 -0
- package/esm/context/HighlightedProvider/useItemHighlighted.js +29 -0
- package/esm/context/ZAxisContextProvider.js +1 -1
- package/esm/context/index.js +1 -0
- package/esm/hooks/useInteractionItemProps.js +9 -41
- package/hooks/useInteractionItemProps.d.ts +1 -4
- package/hooks/useInteractionItemProps.js +11 -45
- package/index.js +1 -1
- package/internals/colorScale.d.ts +1 -1
- package/internals/defaultizeColor.d.ts +13 -13
- package/models/seriesType/common.d.ts +4 -1
- package/modern/BarChart/BarChart.js +30 -3
- package/modern/BarChart/BarElement.js +9 -20
- package/modern/BarChart/BarLabel/BarLabel.js +51 -0
- package/modern/BarChart/BarLabel/BarLabel.types.js +1 -0
- package/modern/BarChart/BarLabel/BarLabelItem.js +119 -0
- package/modern/BarChart/BarLabel/BarLabelPlot.js +98 -0
- package/modern/BarChart/BarLabel/barLabelClasses.js +19 -0
- package/modern/BarChart/BarLabel/getBarLabel.js +24 -0
- package/modern/BarChart/BarLabel/index.js +2 -0
- package/modern/BarChart/BarPlot.js +22 -34
- package/modern/BarChart/checkScaleErrors.js +27 -0
- package/modern/BarChart/index.js +2 -1
- package/modern/ChartContainer/ChartContainer.js +20 -3
- package/modern/ChartsAxis/ChartsAxis.js +1 -1
- package/modern/ChartsAxisHighlight/ChartsAxisHighlight.js +1 -1
- package/modern/ChartsClipPath/ChartsClipPath.js +1 -1
- package/modern/ChartsGrid/ChartsGrid.js +1 -1
- package/modern/ChartsLegend/ChartsLegend.js +1 -1
- package/modern/ChartsLegend/DefaultChartsLegend.js +1 -1
- package/modern/ChartsOnAxisClickHandler/ChartsOnAxisClickHandler.js +1 -1
- package/modern/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/modern/ChartsSurface.js +1 -1
- package/modern/ChartsText/ChartsText.js +1 -1
- package/modern/ChartsTooltip/ChartsAxisTooltipContent.js +1 -1
- package/modern/ChartsTooltip/ChartsItemTooltipContent.js +1 -1
- package/modern/ChartsTooltip/ChartsTooltip.js +1 -1
- package/modern/ChartsTooltip/DefaultChartsAxisTooltipContent.js +1 -1
- package/modern/ChartsTooltip/DefaultChartsItemTooltipContent.js +1 -1
- package/modern/ChartsVoronoiHandler/ChartsVoronoiHandler.js +14 -2
- package/modern/ChartsXAxis/ChartsXAxis.js +1 -1
- package/modern/ChartsYAxis/ChartsYAxis.js +1 -1
- package/modern/Gauge/Gauge.js +1 -1
- package/modern/Gauge/GaugeContainer.js +1 -1
- package/modern/Gauge/GaugeValueText.js +1 -1
- package/modern/LineChart/AnimatedArea.js +1 -1
- package/modern/LineChart/AnimatedLine.js +1 -1
- package/modern/LineChart/AreaElement.js +9 -19
- package/modern/LineChart/AreaPlot.js +1 -3
- package/modern/LineChart/LineChart.js +19 -2
- package/modern/LineChart/LineElement.js +9 -19
- package/modern/LineChart/LineHighlightElement.js +1 -1
- package/modern/LineChart/LineHighlightPlot.js +1 -1
- package/modern/LineChart/LinePlot.js +1 -3
- package/modern/LineChart/MarkElement.js +12 -34
- package/modern/LineChart/MarkPlot.js +1 -2
- package/modern/PieChart/PieArc.js +8 -4
- package/modern/PieChart/PieArcLabel.js +1 -1
- package/modern/PieChart/PieArcLabelPlot.js +2 -8
- package/modern/PieChart/PieArcPlot.js +6 -8
- package/modern/PieChart/PieChart.js +19 -2
- package/modern/PieChart/PiePlot.js +3 -7
- package/modern/PieChart/dataTransform/useTransformData.js +10 -25
- package/modern/ResponsiveChartContainer/ResponsiveChartContainer.js +14 -1
- package/modern/ScatterChart/Scatter.js +16 -12
- package/modern/ScatterChart/ScatterChart.js +19 -2
- package/modern/ScatterChart/ScatterPlot.js +1 -1
- package/modern/SparkLineChart/SparkLineChart.js +14 -1
- package/modern/context/HighlightedProvider/HighlightedContext.js +29 -0
- package/modern/context/HighlightedProvider/HighlightedProvider.js +89 -0
- package/modern/context/HighlightedProvider/createIsFaded.js +12 -0
- package/modern/context/HighlightedProvider/createIsHighlighted.js +12 -0
- package/modern/context/HighlightedProvider/index.js +4 -0
- package/modern/context/HighlightedProvider/useHighlighted.js +17 -0
- package/modern/context/HighlightedProvider/useItemHighlighted.js +29 -0
- package/modern/context/ZAxisContextProvider.js +1 -1
- package/modern/context/index.js +1 -0
- package/modern/hooks/useInteractionItemProps.js +9 -41
- package/modern/index.js +1 -1
- package/package.json +3 -3
- package/themeAugmentation/components.d.ts +4 -0
- package/themeAugmentation/overrides.d.ts +3 -0
- package/themeAugmentation/props.d.ts +2 -0
- package/context/HighlightProvider.d.ts +0 -45
- package/context/HighlightProvider.js +0 -60
- package/esm/context/HighlightProvider.js +0 -51
- package/modern/context/HighlightProvider.js +0 -51
|
@@ -99,7 +99,7 @@ function LineHighlightPlot(props) {
|
|
|
99
99
|
process.env.NODE_ENV !== "production" ? LineHighlightPlot.propTypes = {
|
|
100
100
|
// ----------------------------- Warning --------------------------------
|
|
101
101
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
102
|
-
// | To update them edit the TypeScript types and run "
|
|
102
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
103
103
|
// ----------------------------------------------------------------------
|
|
104
104
|
/**
|
|
105
105
|
* The props used for each component slot.
|
package/LineChart/LinePlot.js
CHANGED
|
@@ -103,7 +103,6 @@ function LinePlot(props) {
|
|
|
103
103
|
d,
|
|
104
104
|
seriesId,
|
|
105
105
|
color,
|
|
106
|
-
highlightScope,
|
|
107
106
|
gradientUsed
|
|
108
107
|
}) => {
|
|
109
108
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_LineElement.LineElement, {
|
|
@@ -111,7 +110,6 @@ function LinePlot(props) {
|
|
|
111
110
|
d: d,
|
|
112
111
|
color: color,
|
|
113
112
|
gradientId: gradientUsed && getGradientId(...gradientUsed),
|
|
114
|
-
highlightScope: highlightScope,
|
|
115
113
|
skipAnimation: skipAnimation,
|
|
116
114
|
slots: slots,
|
|
117
115
|
slotProps: slotProps,
|
|
@@ -126,7 +124,7 @@ function LinePlot(props) {
|
|
|
126
124
|
process.env.NODE_ENV !== "production" ? LinePlot.propTypes = {
|
|
127
125
|
// ----------------------------- Warning --------------------------------
|
|
128
126
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
129
|
-
// | To update them edit the TypeScript types and run "
|
|
127
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
130
128
|
// ----------------------------------------------------------------------
|
|
131
129
|
/**
|
|
132
130
|
* Callback fired when a line item is clicked.
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { HighlightScope } from '../context/HighlightProvider';
|
|
3
2
|
import { SeriesId } from '../models/seriesType/common';
|
|
4
3
|
export interface MarkElementClasses {
|
|
5
4
|
/** Styles applied to the root element. */
|
|
@@ -33,7 +32,6 @@ export type MarkElementProps = Omit<MarkElementOwnerState, 'isFaded' | 'isHighli
|
|
|
33
32
|
* The index to the element in the series' data array.
|
|
34
33
|
*/
|
|
35
34
|
dataIndex: number;
|
|
36
|
-
highlightScope?: Partial<HighlightScope>;
|
|
37
35
|
};
|
|
38
36
|
/**
|
|
39
37
|
* Demos:
|
package/LineChart/MarkElement.js
CHANGED
|
@@ -20,8 +20,9 @@ var _web = require("@react-spring/web");
|
|
|
20
20
|
var _utils = require("../internals/utils");
|
|
21
21
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
22
22
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
23
|
+
var _context = require("../context");
|
|
23
24
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
24
|
-
const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "
|
|
25
|
+
const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "onClick", "skipAnimation"];
|
|
25
26
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
26
27
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
27
28
|
function getMarkElementUtilityClass(slot) {
|
|
@@ -52,21 +53,6 @@ const MarkElementPath = (0, _styles.styled)(_web.animated.path, {
|
|
|
52
53
|
stroke: ownerState.color,
|
|
53
54
|
strokeWidth: 2
|
|
54
55
|
}));
|
|
55
|
-
MarkElementPath.propTypes = {
|
|
56
|
-
// ----------------------------- Warning --------------------------------
|
|
57
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
58
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
59
|
-
// ----------------------------------------------------------------------
|
|
60
|
-
as: _propTypes.default.elementType,
|
|
61
|
-
ownerState: _propTypes.default.shape({
|
|
62
|
-
classes: _propTypes.default.object,
|
|
63
|
-
color: _propTypes.default.string.isRequired,
|
|
64
|
-
id: _propTypes.default.string.isRequired,
|
|
65
|
-
isFaded: _propTypes.default.bool.isRequired,
|
|
66
|
-
isHighlighted: _propTypes.default.bool.isRequired
|
|
67
|
-
}).isRequired,
|
|
68
|
-
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object])
|
|
69
|
-
};
|
|
70
56
|
/**
|
|
71
57
|
* Demos:
|
|
72
58
|
*
|
|
@@ -86,24 +72,20 @@ function MarkElement(props) {
|
|
|
86
72
|
color,
|
|
87
73
|
shape,
|
|
88
74
|
dataIndex,
|
|
89
|
-
highlightScope,
|
|
90
75
|
onClick,
|
|
91
76
|
skipAnimation
|
|
92
77
|
} = props,
|
|
93
78
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
94
|
-
const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(
|
|
79
|
+
const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)();
|
|
80
|
+
const {
|
|
81
|
+
isFaded,
|
|
82
|
+
isHighlighted
|
|
83
|
+
} = (0, _context.useItemHighlighted)({
|
|
84
|
+
seriesId: id
|
|
85
|
+
});
|
|
95
86
|
const {
|
|
96
|
-
item,
|
|
97
87
|
axis
|
|
98
88
|
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
99
|
-
const isHighlighted = axis.x?.index === dataIndex || (0, _useInteractionItemProps.getIsHighlighted)(item, {
|
|
100
|
-
type: 'line',
|
|
101
|
-
seriesId: id
|
|
102
|
-
}, highlightScope);
|
|
103
|
-
const isFaded = !isHighlighted && (0, _useInteractionItemProps.getIsFaded)(item, {
|
|
104
|
-
type: 'line',
|
|
105
|
-
seriesId: id
|
|
106
|
-
}, highlightScope);
|
|
107
89
|
const position = (0, _web.useSpring)({
|
|
108
90
|
x,
|
|
109
91
|
y,
|
|
@@ -112,7 +94,7 @@ function MarkElement(props) {
|
|
|
112
94
|
const ownerState = {
|
|
113
95
|
id,
|
|
114
96
|
classes: innerClasses,
|
|
115
|
-
isHighlighted,
|
|
97
|
+
isHighlighted: axis.x?.index === dataIndex || isHighlighted,
|
|
116
98
|
isFaded,
|
|
117
99
|
color
|
|
118
100
|
};
|
|
@@ -136,17 +118,13 @@ function MarkElement(props) {
|
|
|
136
118
|
process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
|
|
137
119
|
// ----------------------------- Warning --------------------------------
|
|
138
120
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
139
|
-
// | To update them edit the TypeScript types and run "
|
|
121
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
140
122
|
// ----------------------------------------------------------------------
|
|
141
123
|
classes: _propTypes.default.object,
|
|
142
124
|
/**
|
|
143
125
|
* The index to the element in the series' data array.
|
|
144
126
|
*/
|
|
145
127
|
dataIndex: _propTypes.default.number.isRequired,
|
|
146
|
-
highlightScope: _propTypes.default.shape({
|
|
147
|
-
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
148
|
-
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
149
|
-
}),
|
|
150
128
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
151
129
|
/**
|
|
152
130
|
* The shape of the marker.
|
package/LineChart/MarkPlot.js
CHANGED
|
@@ -148,7 +148,6 @@ function MarkPlot(props) {
|
|
|
148
148
|
x: x,
|
|
149
149
|
y: y // Don't know why TS doesn't get from the filter that y can't be null
|
|
150
150
|
,
|
|
151
|
-
highlightScope: series[seriesId].highlightScope,
|
|
152
151
|
skipAnimation: skipAnimation,
|
|
153
152
|
onClick: onItemClick && (event => onItemClick(event, {
|
|
154
153
|
type: 'line',
|
|
@@ -165,7 +164,7 @@ function MarkPlot(props) {
|
|
|
165
164
|
process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
|
|
166
165
|
// ----------------------------- Warning --------------------------------
|
|
167
166
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
168
|
-
// | To update them edit the TypeScript types and run "
|
|
167
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
169
168
|
// ----------------------------------------------------------------------
|
|
170
169
|
/**
|
|
171
170
|
* Callback fired when a line mark item is clicked.
|
package/PieChart/PieArc.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/// <reference types="@react-spring/core" />
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import { SpringValue } from '@react-spring/web';
|
|
4
|
-
import { HighlightScope } from '../context/HighlightProvider';
|
|
5
4
|
import { PieItemId } from '../models';
|
|
5
|
+
import { HighlightScope } from '../context';
|
|
6
6
|
export interface PieArcClasses {
|
|
7
7
|
/** Styles applied to the root element. */
|
|
8
8
|
root: string;
|
|
@@ -25,6 +25,9 @@ export declare const pieArcClasses: PieArcClasses;
|
|
|
25
25
|
export type PieArcProps = Omit<React.SVGProps<SVGPathElement>, 'ref' | 'id'> & PieArcOwnerState & {
|
|
26
26
|
cornerRadius: SpringValue<number>;
|
|
27
27
|
endAngle: SpringValue<number>;
|
|
28
|
+
/**
|
|
29
|
+
* @deprecated Use the `isFaded` or `isHighlighted` props instead.
|
|
30
|
+
*/
|
|
28
31
|
highlightScope?: Partial<HighlightScope>;
|
|
29
32
|
innerRadius: SpringValue<number>;
|
|
30
33
|
onClick?: (event: React.MouseEvent<SVGPathElement, MouseEvent>) => void;
|
package/PieChart/PieArc.js
CHANGED
|
@@ -19,7 +19,7 @@ var _styles = require("@mui/material/styles");
|
|
|
19
19
|
var _generateUtilityClasses = _interopRequireDefault(require("@mui/utils/generateUtilityClasses"));
|
|
20
20
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
21
21
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
22
|
-
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "
|
|
22
|
+
const _excluded = ["classes", "color", "cornerRadius", "dataIndex", "endAngle", "id", "innerRadius", "isFaded", "isHighlighted", "onClick", "outerRadius", "paddingAngle", "startAngle", "highlightScope"];
|
|
23
23
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
24
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
25
|
function getPieArcUtilityClass(slot) {
|
|
@@ -56,7 +56,6 @@ function PieArc(props) {
|
|
|
56
56
|
cornerRadius,
|
|
57
57
|
dataIndex,
|
|
58
58
|
endAngle,
|
|
59
|
-
highlightScope,
|
|
60
59
|
id,
|
|
61
60
|
innerRadius,
|
|
62
61
|
isFaded,
|
|
@@ -76,7 +75,7 @@ function PieArc(props) {
|
|
|
76
75
|
isHighlighted
|
|
77
76
|
};
|
|
78
77
|
const classes = useUtilityClasses(ownerState);
|
|
79
|
-
const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(
|
|
78
|
+
const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)();
|
|
80
79
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(PieArcRoot, (0, _extends2.default)({
|
|
81
80
|
d: (0, _web.to)([startAngle, endAngle, paddingAngle, innerRadius, outerRadius, cornerRadius], (sA, eA, pA, iR, oR, cR) => (0, _d3Shape.arc)().cornerRadius(cR)({
|
|
82
81
|
padAngle: pA,
|
|
@@ -98,12 +97,17 @@ function PieArc(props) {
|
|
|
98
97
|
process.env.NODE_ENV !== "production" ? PieArc.propTypes = {
|
|
99
98
|
// ----------------------------- Warning --------------------------------
|
|
100
99
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
101
|
-
// | To update them edit the TypeScript types and run "
|
|
100
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
102
101
|
// ----------------------------------------------------------------------
|
|
103
102
|
classes: _propTypes.default.object,
|
|
104
103
|
dataIndex: _propTypes.default.number.isRequired,
|
|
104
|
+
/**
|
|
105
|
+
* @deprecated Use the `isFaded` or `isHighlighted` props instead.
|
|
106
|
+
*/
|
|
105
107
|
highlightScope: _propTypes.default.shape({
|
|
108
|
+
fade: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
106
109
|
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
110
|
+
highlight: _propTypes.default.oneOf(['item', 'none', 'series']),
|
|
107
111
|
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
108
112
|
}),
|
|
109
113
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
package/PieChart/PieArcLabel.js
CHANGED
|
@@ -106,7 +106,7 @@ function PieArcLabel(props) {
|
|
|
106
106
|
process.env.NODE_ENV !== "production" ? PieArcLabel.propTypes = {
|
|
107
107
|
// ----------------------------- Warning --------------------------------
|
|
108
108
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
109
|
-
// | To update them edit the TypeScript types and run "
|
|
109
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
110
110
|
// ----------------------------------------------------------------------
|
|
111
111
|
classes: _propTypes.default.object,
|
|
112
112
|
color: _propTypes.default.string.isRequired,
|
|
@@ -7,7 +7,7 @@ export interface PieArcLabelPlotSlots {
|
|
|
7
7
|
export interface PieArcLabelPlotSlotProps {
|
|
8
8
|
pieArcLabel?: Partial<PieArcLabelProps>;
|
|
9
9
|
}
|
|
10
|
-
export interface PieArcLabelPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'arcLabel' | 'arcLabelMinAngle' | 'id'
|
|
10
|
+
export interface PieArcLabelPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'arcLabel' | 'arcLabelMinAngle' | 'id'>, ComputedPieRadius {
|
|
11
11
|
/**
|
|
12
12
|
* Override the arc attributes when it is faded.
|
|
13
13
|
* @default { additionalRadius: -5 }
|
|
@@ -15,7 +15,7 @@ var _useTransformData = require("./dataTransform/useTransformData");
|
|
|
15
15
|
var _PieArcLabel = require("./PieArcLabel");
|
|
16
16
|
var _getLabel = require("../internals/getLabel");
|
|
17
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
18
|
-
const _excluded = ["arcLabel", "arcLabelMinAngle", "arcLabelRadius", "cornerRadius", "data", "faded", "highlighted", "
|
|
18
|
+
const _excluded = ["arcLabel", "arcLabelMinAngle", "arcLabelRadius", "cornerRadius", "data", "faded", "highlighted", "id", "innerRadius", "outerRadius", "paddingAngle", "skipAnimation", "slotProps", "slots"],
|
|
19
19
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "outerRadius", "arcLabelRadius", "cornerRadius"];
|
|
20
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -52,7 +52,6 @@ function PieArcLabelPlot(props) {
|
|
|
52
52
|
additionalRadius: -5
|
|
53
53
|
},
|
|
54
54
|
highlighted,
|
|
55
|
-
highlightScope,
|
|
56
55
|
id,
|
|
57
56
|
innerRadius,
|
|
58
57
|
outerRadius,
|
|
@@ -69,7 +68,6 @@ function PieArcLabelPlot(props) {
|
|
|
69
68
|
cornerRadius,
|
|
70
69
|
paddingAngle,
|
|
71
70
|
id,
|
|
72
|
-
highlightScope,
|
|
73
71
|
highlighted,
|
|
74
72
|
faded,
|
|
75
73
|
data
|
|
@@ -114,7 +112,7 @@ function PieArcLabelPlot(props) {
|
|
|
114
112
|
process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
115
113
|
// ----------------------------- Warning --------------------------------
|
|
116
114
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
117
|
-
// | To update them edit the TypeScript types and run "
|
|
115
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
118
116
|
// ----------------------------------------------------------------------
|
|
119
117
|
/**
|
|
120
118
|
* The label displayed into the arc.
|
|
@@ -171,10 +169,6 @@ process.env.NODE_ENV !== "production" ? PieArcLabelPlot.propTypes = {
|
|
|
171
169
|
outerRadius: _propTypes.default.number,
|
|
172
170
|
paddingAngle: _propTypes.default.number
|
|
173
171
|
}),
|
|
174
|
-
highlightScope: _propTypes.default.shape({
|
|
175
|
-
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
176
|
-
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
177
|
-
}),
|
|
178
172
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
179
173
|
/**
|
|
180
174
|
* The radius between circle center and the beginning of the arc.
|
package/PieChart/PieArcPlot.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface PieArcPlotSlots {
|
|
|
7
7
|
export interface PieArcPlotSlotProps {
|
|
8
8
|
pieArc?: Partial<PieArcProps>;
|
|
9
9
|
}
|
|
10
|
-
export interface PieArcPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'id'
|
|
10
|
+
export interface PieArcPlotProps extends Pick<DefaultizedPieSeriesType, 'data' | 'faded' | 'highlighted' | 'cornerRadius' | 'paddingAngle' | 'id'>, ComputedPieRadius {
|
|
11
11
|
/**
|
|
12
12
|
* Override the arc attributes when it is faded.
|
|
13
13
|
* @default { additionalRadius: -5 }
|
package/PieChart/PieArcPlot.js
CHANGED
|
@@ -13,8 +13,9 @@ var _web = require("@react-spring/web");
|
|
|
13
13
|
var _PieArc = require("./PieArc");
|
|
14
14
|
var _transition = require("./dataTransform/transition");
|
|
15
15
|
var _useTransformData = require("./dataTransform/useTransformData");
|
|
16
|
+
var _context = require("../context");
|
|
16
17
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
|
-
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "
|
|
18
|
+
const _excluded = ["slots", "slotProps", "innerRadius", "outerRadius", "cornerRadius", "paddingAngle", "id", "highlighted", "faded", "data", "onItemClick", "skipAnimation"],
|
|
18
19
|
_excluded2 = ["startAngle", "endAngle", "paddingAngle", "innerRadius", "arcLabelRadius", "outerRadius", "cornerRadius"];
|
|
19
20
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
20
21
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -27,7 +28,6 @@ function PieArcPlot(props) {
|
|
|
27
28
|
cornerRadius = 0,
|
|
28
29
|
paddingAngle = 0,
|
|
29
30
|
id,
|
|
30
|
-
highlightScope,
|
|
31
31
|
highlighted,
|
|
32
32
|
faded = {
|
|
33
33
|
additionalRadius: -5
|
|
@@ -43,7 +43,6 @@ function PieArcPlot(props) {
|
|
|
43
43
|
cornerRadius,
|
|
44
44
|
paddingAngle,
|
|
45
45
|
id,
|
|
46
|
-
highlightScope,
|
|
47
46
|
highlighted,
|
|
48
47
|
faded,
|
|
49
48
|
data
|
|
@@ -51,6 +50,9 @@ function PieArcPlot(props) {
|
|
|
51
50
|
const transition = (0, _web.useTransition)(transformedData, (0, _extends2.default)({}, _transition.defaultTransitionConfig, {
|
|
52
51
|
immediate: skipAnimation
|
|
53
52
|
}));
|
|
53
|
+
const {
|
|
54
|
+
highlightScope
|
|
55
|
+
} = (0, _context.useHighlighted)();
|
|
54
56
|
if (data.length === 0) {
|
|
55
57
|
return null;
|
|
56
58
|
}
|
|
@@ -94,7 +96,7 @@ function PieArcPlot(props) {
|
|
|
94
96
|
process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
95
97
|
// ----------------------------- Warning --------------------------------
|
|
96
98
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
97
|
-
// | To update them edit the TypeScript types and run "
|
|
99
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
98
100
|
// ----------------------------------------------------------------------
|
|
99
101
|
/**
|
|
100
102
|
* The radius between circle center and the arc label in px.
|
|
@@ -142,10 +144,6 @@ process.env.NODE_ENV !== "production" ? PieArcPlot.propTypes = {
|
|
|
142
144
|
outerRadius: _propTypes.default.number,
|
|
143
145
|
paddingAngle: _propTypes.default.number
|
|
144
146
|
}),
|
|
145
|
-
highlightScope: _propTypes.default.shape({
|
|
146
|
-
faded: _propTypes.default.oneOf(['global', 'none', 'series']),
|
|
147
|
-
highlighted: _propTypes.default.oneOf(['item', 'none', 'series'])
|
|
148
|
-
}),
|
|
149
147
|
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
150
148
|
/**
|
|
151
149
|
* The radius between circle center and the beginning of the arc.
|
package/PieChart/PieChart.js
CHANGED
|
@@ -70,7 +70,9 @@ function PieChart(props) {
|
|
|
70
70
|
slots,
|
|
71
71
|
slotProps,
|
|
72
72
|
onItemClick,
|
|
73
|
-
loading
|
|
73
|
+
loading,
|
|
74
|
+
highlightedItem,
|
|
75
|
+
onHighlightChange
|
|
74
76
|
} = props;
|
|
75
77
|
const isRTL = (0, _useIsRTL.useIsRTL)();
|
|
76
78
|
const margin = (0, _extends2.default)({}, isRTL ? defaultRTLMargin : defaultMargin, marginProps);
|
|
@@ -97,6 +99,8 @@ function PieChart(props) {
|
|
|
97
99
|
colors: colors,
|
|
98
100
|
sx: sx,
|
|
99
101
|
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
102
|
+
highlightedItem: highlightedItem,
|
|
103
|
+
onHighlightChange: onHighlightChange,
|
|
100
104
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
101
105
|
topAxis: topAxis,
|
|
102
106
|
leftAxis: leftAxis,
|
|
@@ -125,7 +129,7 @@ function PieChart(props) {
|
|
|
125
129
|
process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
126
130
|
// ----------------------------- Warning --------------------------------
|
|
127
131
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
128
|
-
// | To update them edit the TypeScript types and run "
|
|
132
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
129
133
|
// ----------------------------------------------------------------------
|
|
130
134
|
/**
|
|
131
135
|
* The configuration of axes highlight.
|
|
@@ -164,6 +168,13 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
164
168
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
165
169
|
*/
|
|
166
170
|
height: _propTypes.default.number,
|
|
171
|
+
/**
|
|
172
|
+
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
173
|
+
*/
|
|
174
|
+
highlightedItem: _propTypes.default.shape({
|
|
175
|
+
dataIndex: _propTypes.default.number,
|
|
176
|
+
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
177
|
+
}),
|
|
167
178
|
/**
|
|
168
179
|
* Indicate which axis to display the left of the charts.
|
|
169
180
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -203,6 +214,12 @@ process.env.NODE_ENV !== "production" ? PieChart.propTypes = {
|
|
|
203
214
|
right: _propTypes.default.number,
|
|
204
215
|
top: _propTypes.default.number
|
|
205
216
|
}),
|
|
217
|
+
/**
|
|
218
|
+
* The callback fired when the highlighted item changes.
|
|
219
|
+
*
|
|
220
|
+
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
221
|
+
*/
|
|
222
|
+
onHighlightChange: _propTypes.default.func,
|
|
206
223
|
/**
|
|
207
224
|
* Callback fired when a pie arc is clicked.
|
|
208
225
|
*/
|
package/PieChart/PiePlot.js
CHANGED
|
@@ -58,8 +58,7 @@ function PiePlot(props) {
|
|
|
58
58
|
cx: cxParam,
|
|
59
59
|
cy: cyParam,
|
|
60
60
|
highlighted,
|
|
61
|
-
faded
|
|
62
|
-
highlightScope
|
|
61
|
+
faded
|
|
63
62
|
} = series[seriesId];
|
|
64
63
|
const {
|
|
65
64
|
cx,
|
|
@@ -84,7 +83,6 @@ function PiePlot(props) {
|
|
|
84
83
|
id: seriesId,
|
|
85
84
|
data: data,
|
|
86
85
|
skipAnimation: skipAnimation,
|
|
87
|
-
highlightScope: highlightScope,
|
|
88
86
|
highlighted: highlighted,
|
|
89
87
|
faded: faded,
|
|
90
88
|
onItemClick: onItemClick,
|
|
@@ -103,8 +101,7 @@ function PiePlot(props) {
|
|
|
103
101
|
arcLabelMinAngle,
|
|
104
102
|
data,
|
|
105
103
|
cx: cxParam,
|
|
106
|
-
cy: cyParam
|
|
107
|
-
highlightScope
|
|
104
|
+
cy: cyParam
|
|
108
105
|
} = series[seriesId];
|
|
109
106
|
const {
|
|
110
107
|
cx,
|
|
@@ -133,7 +130,6 @@ function PiePlot(props) {
|
|
|
133
130
|
skipAnimation: skipAnimation,
|
|
134
131
|
arcLabel: arcLabel,
|
|
135
132
|
arcLabelMinAngle: arcLabelMinAngle,
|
|
136
|
-
highlightScope: highlightScope,
|
|
137
133
|
slots: slots,
|
|
138
134
|
slotProps: slotProps
|
|
139
135
|
})
|
|
@@ -144,7 +140,7 @@ function PiePlot(props) {
|
|
|
144
140
|
process.env.NODE_ENV !== "production" ? PiePlot.propTypes = {
|
|
145
141
|
// ----------------------------- Warning --------------------------------
|
|
146
142
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
147
|
-
// | To update them edit the TypeScript types and run "
|
|
143
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
148
144
|
// ----------------------------------------------------------------------
|
|
149
145
|
/**
|
|
150
146
|
* Callback fired when a pie item is clicked.
|
|
@@ -12,4 +12,4 @@ export interface ValueWithHighlight extends DefaultizedPieValueType, AnimatedObj
|
|
|
12
12
|
isFaded: boolean;
|
|
13
13
|
isHighlighted: boolean;
|
|
14
14
|
}
|
|
15
|
-
export declare function useTransformData(series: Pick<DefaultizedPieSeriesType, 'cornerRadius' | 'paddingAngle' | 'id' | '
|
|
15
|
+
export declare function useTransformData(series: Pick<DefaultizedPieSeriesType, 'cornerRadius' | 'paddingAngle' | 'id' | 'highlighted' | 'faded' | 'data'> & ComputedPieRadius): ValueWithHighlight[];
|
|
@@ -7,14 +7,12 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
exports.useTransformData = useTransformData;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var React = _interopRequireWildcard(require("react"));
|
|
10
|
-
var
|
|
11
|
-
var _useInteractionItemProps = require("../../hooks/useInteractionItemProps");
|
|
10
|
+
var _context = require("../../context");
|
|
12
11
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
13
12
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
14
13
|
function useTransformData(series) {
|
|
15
14
|
const {
|
|
16
15
|
id: seriesId,
|
|
17
|
-
highlightScope,
|
|
18
16
|
data,
|
|
19
17
|
faded,
|
|
20
18
|
highlighted,
|
|
@@ -25,29 +23,16 @@ function useTransformData(series) {
|
|
|
25
23
|
cornerRadius: baseCornerRadius = 0
|
|
26
24
|
} = series;
|
|
27
25
|
const {
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
seriesId,
|
|
34
|
-
dataIndex
|
|
35
|
-
}, highlightScope);
|
|
36
|
-
const isFaded = !isHighlighted && (0, _useInteractionItemProps.getIsFaded)(highlightedItem, {
|
|
37
|
-
type: 'pie',
|
|
26
|
+
isFaded: isItemFaded,
|
|
27
|
+
isHighlighted: isItemHighlighted
|
|
28
|
+
} = (0, _context.useHighlighted)();
|
|
29
|
+
const dataWithHighlight = React.useMemo(() => data.map((item, itemIndex) => {
|
|
30
|
+
const currentItem = {
|
|
38
31
|
seriesId,
|
|
39
|
-
dataIndex
|
|
40
|
-
}, highlightScope);
|
|
41
|
-
return {
|
|
42
|
-
isHighlighted,
|
|
43
|
-
isFaded
|
|
32
|
+
dataIndex: itemIndex
|
|
44
33
|
};
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
const {
|
|
48
|
-
isHighlighted,
|
|
49
|
-
isFaded
|
|
50
|
-
} = getHighlightStatus(itemIndex);
|
|
34
|
+
const isHighlighted = isItemHighlighted(currentItem);
|
|
35
|
+
const isFaded = !isHighlighted && isItemFaded(currentItem);
|
|
51
36
|
const attributesOverride = (0, _extends2.default)({
|
|
52
37
|
additionalRadius: 0
|
|
53
38
|
}, isFaded && faded || isHighlighted && highlighted || {});
|
|
@@ -65,6 +50,6 @@ function useTransformData(series) {
|
|
|
65
50
|
cornerRadius,
|
|
66
51
|
arcLabelRadius
|
|
67
52
|
});
|
|
68
|
-
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded,
|
|
53
|
+
}), [baseCornerRadius, baseInnerRadius, baseOuterRadius, basePaddingAngle, baseArcLabelRadius, data, faded, highlighted, isItemFaded, isItemHighlighted, seriesId]);
|
|
69
54
|
return dataWithHighlight;
|
|
70
55
|
}
|
|
@@ -59,7 +59,7 @@ const ResponsiveChartContainer = exports.ResponsiveChartContainer = /*#__PURE__*
|
|
|
59
59
|
process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
60
60
|
// ----------------------------- Warning --------------------------------
|
|
61
61
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
62
|
-
// | To update them edit the TypeScript types and run "
|
|
62
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
63
63
|
// ----------------------------------------------------------------------
|
|
64
64
|
children: _propTypes.default.node,
|
|
65
65
|
className: _propTypes.default.string,
|
|
@@ -83,6 +83,13 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
83
83
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
84
84
|
*/
|
|
85
85
|
height: _propTypes.default.number,
|
|
86
|
+
/**
|
|
87
|
+
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
88
|
+
*/
|
|
89
|
+
highlightedItem: _propTypes.default.shape({
|
|
90
|
+
dataIndex: _propTypes.default.number,
|
|
91
|
+
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
92
|
+
}),
|
|
86
93
|
/**
|
|
87
94
|
* The margin between the SVG and the drawing area.
|
|
88
95
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
@@ -95,6 +102,12 @@ process.env.NODE_ENV !== "production" ? ResponsiveChartContainer.propTypes = {
|
|
|
95
102
|
right: _propTypes.default.number,
|
|
96
103
|
top: _propTypes.default.number
|
|
97
104
|
}),
|
|
105
|
+
/**
|
|
106
|
+
* The callback fired when the highlighted item changes.
|
|
107
|
+
*
|
|
108
|
+
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
109
|
+
*/
|
|
110
|
+
onHighlightChange: _propTypes.default.func,
|
|
98
111
|
/**
|
|
99
112
|
* The array of series to display.
|
|
100
113
|
* Each type of series has its own specificity.
|
package/ScatterChart/Scatter.js
CHANGED
|
@@ -11,6 +11,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
11
11
|
var _useScale = require("../hooks/useScale");
|
|
12
12
|
var _useInteractionItemProps = require("../hooks/useInteractionItemProps");
|
|
13
13
|
var _InteractionProvider = require("../context/InteractionProvider");
|
|
14
|
+
var _context = require("../context");
|
|
14
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
16
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -34,16 +35,15 @@ function Scatter(props) {
|
|
|
34
35
|
markerSize,
|
|
35
36
|
onItemClick
|
|
36
37
|
} = props;
|
|
37
|
-
const highlightScope = React.useMemo(() => (0, _extends2.default)({
|
|
38
|
-
highlighted: 'item',
|
|
39
|
-
faded: 'global'
|
|
40
|
-
}, series.highlightScope), [series.highlightScope]);
|
|
41
38
|
const {
|
|
42
|
-
item,
|
|
43
39
|
useVoronoiInteraction
|
|
44
40
|
} = React.useContext(_InteractionProvider.InteractionContext);
|
|
45
41
|
const skipInteractionHandlers = useVoronoiInteraction || series.disableHover;
|
|
46
|
-
const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(
|
|
42
|
+
const getInteractionItemProps = (0, _useInteractionItemProps.useInteractionItemProps)(skipInteractionHandlers);
|
|
43
|
+
const {
|
|
44
|
+
isFaded,
|
|
45
|
+
isHighlighted
|
|
46
|
+
} = (0, _context.useHighlighted)();
|
|
47
47
|
const cleanData = React.useMemo(() => {
|
|
48
48
|
const getXPosition = (0, _useScale.getValueToPositionMapper)(xScale);
|
|
49
49
|
const getYPosition = (0, _useScale.getValueToPositionMapper)(yScale);
|
|
@@ -65,12 +65,16 @@ function Scatter(props) {
|
|
|
65
65
|
dataIndex: i
|
|
66
66
|
};
|
|
67
67
|
if (isInRange) {
|
|
68
|
-
const
|
|
68
|
+
const currentItem = {
|
|
69
|
+
seriesId: pointCtx.seriesId,
|
|
70
|
+
dataIndex: pointCtx.dataIndex
|
|
71
|
+
};
|
|
72
|
+
const isItemHighlighted = isHighlighted(currentItem);
|
|
69
73
|
temp.push({
|
|
70
74
|
x,
|
|
71
75
|
y,
|
|
72
|
-
isHighlighted,
|
|
73
|
-
isFaded: !
|
|
76
|
+
isHighlighted: isItemHighlighted,
|
|
77
|
+
isFaded: !isItemHighlighted && isFaded(currentItem),
|
|
74
78
|
interactionProps: getInteractionItemProps(pointCtx),
|
|
75
79
|
id: scatterPoint.id,
|
|
76
80
|
dataIndex: i,
|
|
@@ -79,7 +83,7 @@ function Scatter(props) {
|
|
|
79
83
|
}
|
|
80
84
|
}
|
|
81
85
|
return temp;
|
|
82
|
-
}, [xScale, yScale, series.data, series.id,
|
|
86
|
+
}, [xScale, yScale, series.data, series.id, getInteractionItemProps, color, colorGetter, isFaded, isHighlighted]);
|
|
83
87
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
84
88
|
children: cleanData.map(dataPoint => /*#__PURE__*/(0, _jsxRuntime.jsx)("circle", (0, _extends2.default)({
|
|
85
89
|
cx: 0,
|
|
@@ -100,7 +104,7 @@ function Scatter(props) {
|
|
|
100
104
|
process.env.NODE_ENV !== "production" ? Scatter.propTypes = {
|
|
101
105
|
// ----------------------------- Warning --------------------------------
|
|
102
106
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
103
|
-
// | To update them edit the TypeScript types and run "
|
|
107
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
104
108
|
// ----------------------------------------------------------------------
|
|
105
109
|
color: _propTypes.default.string.isRequired,
|
|
106
110
|
colorGetter: _propTypes.default.func,
|