@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
|
@@ -62,7 +62,7 @@ function ChartsOnAxisClickHandler(props) {
|
|
|
62
62
|
process.env.NODE_ENV !== "production" ? ChartsOnAxisClickHandler.propTypes = {
|
|
63
63
|
// ----------------------------- Warning --------------------------------
|
|
64
64
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
65
|
-
// | To update them edit the TypeScript types and run "
|
|
65
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
66
66
|
// ----------------------------------------------------------------------
|
|
67
67
|
/**
|
|
68
68
|
* The function called for onClick events.
|
|
@@ -23,7 +23,7 @@ function ChartsReferenceLine(props) {
|
|
|
23
23
|
process.env.NODE_ENV !== "production" ? ChartsReferenceLine.propTypes = {
|
|
24
24
|
// ----------------------------- Warning --------------------------------
|
|
25
25
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
26
|
-
// | To update them edit the TypeScript types and run "
|
|
26
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
27
27
|
// ----------------------------------------------------------------------
|
|
28
28
|
/**
|
|
29
29
|
* The id of the axis used for the reference value.
|
package/esm/ChartsSurface.js
CHANGED
|
@@ -44,7 +44,7 @@ const ChartsSurface = /*#__PURE__*/React.forwardRef(function ChartsSurface(props
|
|
|
44
44
|
process.env.NODE_ENV !== "production" ? ChartsSurface.propTypes = {
|
|
45
45
|
// ----------------------------- Warning --------------------------------
|
|
46
46
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
47
|
-
// | To update them edit the TypeScript types and run "
|
|
47
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
48
48
|
// ----------------------------------------------------------------------
|
|
49
49
|
children: PropTypes.node,
|
|
50
50
|
className: PropTypes.string,
|
|
@@ -70,7 +70,7 @@ function ChartsText(props) {
|
|
|
70
70
|
process.env.NODE_ENV !== "production" ? ChartsText.propTypes = {
|
|
71
71
|
// ----------------------------- Warning --------------------------------
|
|
72
72
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
73
|
-
// | To update them edit the TypeScript types and run "
|
|
73
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
74
74
|
// ----------------------------------------------------------------------
|
|
75
75
|
/**
|
|
76
76
|
* Height of a text line (in `em`).
|
|
@@ -80,7 +80,7 @@ function ChartsAxisTooltipContent(props) {
|
|
|
80
80
|
process.env.NODE_ENV !== "production" ? ChartsAxisTooltipContent.propTypes = {
|
|
81
81
|
// ----------------------------- Warning --------------------------------
|
|
82
82
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
83
|
-
// | To update them edit the TypeScript types and run "
|
|
83
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
84
84
|
// ----------------------------------------------------------------------
|
|
85
85
|
axisData: PropTypes.shape({
|
|
86
86
|
x: PropTypes.shape({
|
|
@@ -60,7 +60,7 @@ function ChartsItemTooltipContent(props) {
|
|
|
60
60
|
process.env.NODE_ENV !== "production" ? ChartsItemTooltipContent.propTypes = {
|
|
61
61
|
// ----------------------------- Warning --------------------------------
|
|
62
62
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
63
|
-
// | To update them edit the TypeScript types and run "
|
|
63
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
64
64
|
// ----------------------------------------------------------------------
|
|
65
65
|
classes: PropTypes.object.isRequired,
|
|
66
66
|
content: PropTypes.elementType,
|
|
@@ -110,7 +110,7 @@ function ChartsTooltip(props) {
|
|
|
110
110
|
process.env.NODE_ENV !== "production" ? ChartsTooltip.propTypes = {
|
|
111
111
|
// ----------------------------- Warning --------------------------------
|
|
112
112
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
113
|
-
// | To update them edit the TypeScript types and run "
|
|
113
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
114
114
|
// ----------------------------------------------------------------------
|
|
115
115
|
/**
|
|
116
116
|
* Component to override the tooltip content when trigger is set to 'axis'.
|
|
@@ -80,7 +80,7 @@ function DefaultChartsAxisTooltipContent(props) {
|
|
|
80
80
|
process.env.NODE_ENV !== "production" ? DefaultChartsAxisTooltipContent.propTypes = {
|
|
81
81
|
// ----------------------------- Warning --------------------------------
|
|
82
82
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
83
|
-
// | To update them edit the TypeScript types and run "
|
|
83
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
84
84
|
// ----------------------------------------------------------------------
|
|
85
85
|
/**
|
|
86
86
|
* The properties of the triggered axis.
|
|
@@ -61,7 +61,7 @@ function DefaultChartsItemTooltipContent(props) {
|
|
|
61
61
|
process.env.NODE_ENV !== "production" ? DefaultChartsItemTooltipContent.propTypes = {
|
|
62
62
|
// ----------------------------- Warning --------------------------------
|
|
63
63
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
|
-
// | To update them edit the TypeScript types and run "
|
|
64
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
65
65
|
// ----------------------------------------------------------------------
|
|
66
66
|
/**
|
|
67
67
|
* Override or extend the styles applied to the component.
|
|
@@ -8,6 +8,7 @@ import { SeriesContext } from '../context/SeriesContextProvider';
|
|
|
8
8
|
import { getValueToPositionMapper } from '../hooks/useScale';
|
|
9
9
|
import { getSVGPoint } from '../internals/utils';
|
|
10
10
|
import { useDrawingArea, useSvgRef } from '../hooks';
|
|
11
|
+
import { useHighlighted } from '../context';
|
|
11
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
13
|
function ChartsVoronoiHandler(props) {
|
|
13
14
|
const {
|
|
@@ -36,6 +37,10 @@ function ChartsVoronoiHandler(props) {
|
|
|
36
37
|
} = React.useContext(SeriesContext).scatter ?? {};
|
|
37
38
|
const voronoiRef = React.useRef({});
|
|
38
39
|
const delauneyRef = React.useRef(undefined);
|
|
40
|
+
const {
|
|
41
|
+
setHighlighted,
|
|
42
|
+
clearHighlighted
|
|
43
|
+
} = useHighlighted();
|
|
39
44
|
const defaultXAxisId = xAxisIds[0];
|
|
40
45
|
const defaultYAxisId = yAxisIds[0];
|
|
41
46
|
useEnhancedEffect(() => {
|
|
@@ -129,6 +134,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
129
134
|
dispatch({
|
|
130
135
|
type: 'exitChart'
|
|
131
136
|
});
|
|
137
|
+
clearHighlighted();
|
|
132
138
|
};
|
|
133
139
|
const handleMouseMove = event => {
|
|
134
140
|
const closestPoint = getClosestPoint(event);
|
|
@@ -136,6 +142,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
136
142
|
dispatch({
|
|
137
143
|
type: 'exitChart'
|
|
138
144
|
});
|
|
145
|
+
clearHighlighted();
|
|
139
146
|
return;
|
|
140
147
|
}
|
|
141
148
|
if (closestPoint === 'outside-voronoi-max-radius' || closestPoint === 'no-point-found') {
|
|
@@ -145,6 +152,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
145
152
|
type: 'scatter'
|
|
146
153
|
}
|
|
147
154
|
});
|
|
155
|
+
clearHighlighted();
|
|
148
156
|
return;
|
|
149
157
|
}
|
|
150
158
|
const {
|
|
@@ -159,6 +167,10 @@ function ChartsVoronoiHandler(props) {
|
|
|
159
167
|
dataIndex
|
|
160
168
|
}
|
|
161
169
|
});
|
|
170
|
+
setHighlighted({
|
|
171
|
+
seriesId,
|
|
172
|
+
dataIndex
|
|
173
|
+
});
|
|
162
174
|
};
|
|
163
175
|
const handleMouseClick = event => {
|
|
164
176
|
if (!onItemClick) {
|
|
@@ -187,7 +199,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
187
199
|
element.removeEventListener('mousemove', handleMouseMove);
|
|
188
200
|
element.removeEventListener('click', handleMouseClick);
|
|
189
201
|
};
|
|
190
|
-
}, [svgRef, dispatch, left, width, top, height, yAxis, xAxis, voronoiMaxRadius, onItemClick]);
|
|
202
|
+
}, [svgRef, dispatch, left, width, top, height, yAxis, xAxis, voronoiMaxRadius, onItemClick, setHighlighted, clearHighlighted]);
|
|
191
203
|
|
|
192
204
|
// eslint-disable-next-line react/jsx-no-useless-fragment
|
|
193
205
|
return /*#__PURE__*/_jsx(React.Fragment, {});
|
|
@@ -195,7 +207,7 @@ function ChartsVoronoiHandler(props) {
|
|
|
195
207
|
process.env.NODE_ENV !== "production" ? ChartsVoronoiHandler.propTypes = {
|
|
196
208
|
// ----------------------------- Warning --------------------------------
|
|
197
209
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
198
|
-
// | To update them edit the TypeScript types and run "
|
|
210
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
199
211
|
// ----------------------------------------------------------------------
|
|
200
212
|
/**
|
|
201
213
|
* Callback fired when clicking on a scatter item.
|
|
@@ -248,7 +248,7 @@ function ChartsXAxis(inProps) {
|
|
|
248
248
|
process.env.NODE_ENV !== "production" ? ChartsXAxis.propTypes = {
|
|
249
249
|
// ----------------------------- Warning --------------------------------
|
|
250
250
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
251
|
-
// | To update them edit the TypeScript types and run "
|
|
251
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
252
252
|
// ----------------------------------------------------------------------
|
|
253
253
|
/**
|
|
254
254
|
* The id of the axis to render.
|
|
@@ -184,7 +184,7 @@ function ChartsYAxis(inProps) {
|
|
|
184
184
|
process.env.NODE_ENV !== "production" ? ChartsYAxis.propTypes = {
|
|
185
185
|
// ----------------------------- Warning --------------------------------
|
|
186
186
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
187
|
-
// | To update them edit the TypeScript types and run "
|
|
187
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
188
188
|
// ----------------------------------------------------------------------
|
|
189
189
|
/**
|
|
190
190
|
* The id of the axis to render.
|
package/esm/Gauge/Gauge.js
CHANGED
|
@@ -44,7 +44,7 @@ function Gauge(props) {
|
|
|
44
44
|
process.env.NODE_ENV !== "production" ? Gauge.propTypes = {
|
|
45
45
|
// ----------------------------- Warning --------------------------------
|
|
46
46
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
47
|
-
// | To update them edit the TypeScript types and run "
|
|
47
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
48
48
|
// ----------------------------------------------------------------------
|
|
49
49
|
children: PropTypes.node,
|
|
50
50
|
classes: PropTypes.object,
|
|
@@ -106,7 +106,7 @@ const GaugeContainer = /*#__PURE__*/React.forwardRef(function GaugeContainer(pro
|
|
|
106
106
|
process.env.NODE_ENV !== "production" ? GaugeContainer.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
|
children: PropTypes.node,
|
|
112
112
|
className: PropTypes.string,
|
|
@@ -48,7 +48,7 @@ function GaugeValueText(props) {
|
|
|
48
48
|
process.env.NODE_ENV !== "production" ? GaugeValueText.propTypes = {
|
|
49
49
|
// ----------------------------- Warning --------------------------------
|
|
50
50
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
51
|
-
// | To update them edit the TypeScript types and run "
|
|
51
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
52
52
|
// ----------------------------------------------------------------------
|
|
53
53
|
/**
|
|
54
54
|
* Height of a text line (in `em`).
|
|
@@ -83,7 +83,7 @@ function AnimatedArea(props) {
|
|
|
83
83
|
process.env.NODE_ENV !== "production" ? AnimatedArea.propTypes = {
|
|
84
84
|
// ----------------------------- Warning --------------------------------
|
|
85
85
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
86
|
-
// | To update them edit the TypeScript types and run "
|
|
86
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
87
87
|
// ----------------------------------------------------------------------
|
|
88
88
|
d: PropTypes.string.isRequired,
|
|
89
89
|
ownerState: PropTypes.shape({
|
|
@@ -86,7 +86,7 @@ function AnimatedLine(props) {
|
|
|
86
86
|
process.env.NODE_ENV !== "production" ? AnimatedLine.propTypes = {
|
|
87
87
|
// ----------------------------- Warning --------------------------------
|
|
88
88
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
89
|
-
// | To update them edit the TypeScript types and run "
|
|
89
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
90
90
|
// ----------------------------------------------------------------------
|
|
91
91
|
d: PropTypes.string.isRequired,
|
|
92
92
|
ownerState: PropTypes.shape({
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "classes", "color", "gradientId", "
|
|
3
|
+
const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
7
|
import { useSlotProps } from '@mui/base/utils';
|
|
8
8
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
9
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
10
|
-
import {
|
|
11
|
-
import { InteractionContext } from '../context/InteractionProvider';
|
|
10
|
+
import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
12
11
|
import { AnimatedArea } from './AnimatedArea';
|
|
12
|
+
import { useItemHighlighted } from '../context';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
export function getAreaElementUtilityClass(slot) {
|
|
15
15
|
return generateUtilityClass('MuiAreaElement', slot);
|
|
@@ -43,24 +43,18 @@ function AreaElement(props) {
|
|
|
43
43
|
classes: innerClasses,
|
|
44
44
|
color,
|
|
45
45
|
gradientId,
|
|
46
|
-
highlightScope,
|
|
47
46
|
slots,
|
|
48
47
|
slotProps,
|
|
49
48
|
onClick
|
|
50
49
|
} = props,
|
|
51
50
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
52
|
-
const getInteractionItemProps = useInteractionItemProps(
|
|
51
|
+
const getInteractionItemProps = useInteractionItemProps();
|
|
53
52
|
const {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type: 'line',
|
|
58
|
-
seriesId: id
|
|
59
|
-
}, highlightScope);
|
|
60
|
-
const isFaded = !isHighlighted && getIsFaded(item, {
|
|
61
|
-
type: 'line',
|
|
53
|
+
isFaded,
|
|
54
|
+
isHighlighted
|
|
55
|
+
} = useItemHighlighted({
|
|
62
56
|
seriesId: id
|
|
63
|
-
}
|
|
57
|
+
});
|
|
64
58
|
const ownerState = {
|
|
65
59
|
id,
|
|
66
60
|
classes: innerClasses,
|
|
@@ -89,16 +83,12 @@ function AreaElement(props) {
|
|
|
89
83
|
process.env.NODE_ENV !== "production" ? AreaElement.propTypes = {
|
|
90
84
|
// ----------------------------- Warning --------------------------------
|
|
91
85
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
92
|
-
// | To update them edit the TypeScript types and run "
|
|
86
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
93
87
|
// ----------------------------------------------------------------------
|
|
94
88
|
classes: PropTypes.object,
|
|
95
89
|
color: PropTypes.string.isRequired,
|
|
96
90
|
d: PropTypes.string.isRequired,
|
|
97
91
|
gradientId: PropTypes.string,
|
|
98
|
-
highlightScope: PropTypes.shape({
|
|
99
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
100
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
101
|
-
}),
|
|
102
92
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
103
93
|
/**
|
|
104
94
|
* If `true`, animations are skipped.
|
|
@@ -97,7 +97,6 @@ function AreaPlot(props) {
|
|
|
97
97
|
d,
|
|
98
98
|
seriesId,
|
|
99
99
|
color,
|
|
100
|
-
highlightScope,
|
|
101
100
|
area,
|
|
102
101
|
gradientUsed
|
|
103
102
|
}) => !!area && /*#__PURE__*/_jsx(AreaElement, {
|
|
@@ -105,7 +104,6 @@ function AreaPlot(props) {
|
|
|
105
104
|
d: d,
|
|
106
105
|
color: color,
|
|
107
106
|
gradientId: gradientUsed && getGradientId(...gradientUsed),
|
|
108
|
-
highlightScope: highlightScope,
|
|
109
107
|
slots: slots,
|
|
110
108
|
slotProps: slotProps,
|
|
111
109
|
onClick: onItemClick && (event => onItemClick(event, {
|
|
@@ -119,7 +117,7 @@ function AreaPlot(props) {
|
|
|
119
117
|
process.env.NODE_ENV !== "production" ? AreaPlot.propTypes = {
|
|
120
118
|
// ----------------------------- Warning --------------------------------
|
|
121
119
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
122
|
-
// | To update them edit the TypeScript types and run "
|
|
120
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
123
121
|
// ----------------------------------------------------------------------
|
|
124
122
|
/**
|
|
125
123
|
* Callback fired when a line area item is clicked.
|
|
@@ -57,7 +57,9 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
57
57
|
slots,
|
|
58
58
|
slotProps,
|
|
59
59
|
skipAnimation,
|
|
60
|
-
loading
|
|
60
|
+
loading,
|
|
61
|
+
highlightedItem,
|
|
62
|
+
onHighlightChange
|
|
61
63
|
} = props;
|
|
62
64
|
const id = useId();
|
|
63
65
|
const clipPathId = `${id}-clip-path`;
|
|
@@ -82,6 +84,8 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
82
84
|
dataset: dataset,
|
|
83
85
|
sx: sx,
|
|
84
86
|
disableAxisListener: tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none' && !onAxisClick,
|
|
87
|
+
highlightedItem: highlightedItem,
|
|
88
|
+
onHighlightChange: onHighlightChange,
|
|
85
89
|
children: [onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, {
|
|
86
90
|
onAxisClick: onAxisClick
|
|
87
91
|
}), grid && /*#__PURE__*/_jsx(ChartsGrid, {
|
|
@@ -133,7 +137,7 @@ const LineChart = /*#__PURE__*/React.forwardRef(function LineChart(props, ref) {
|
|
|
133
137
|
process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
134
138
|
// ----------------------------- Warning --------------------------------
|
|
135
139
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
136
|
-
// | To update them edit the TypeScript types and run "
|
|
140
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
137
141
|
// ----------------------------------------------------------------------
|
|
138
142
|
/**
|
|
139
143
|
* The configuration of axes highlight.
|
|
@@ -183,6 +187,13 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
183
187
|
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
184
188
|
*/
|
|
185
189
|
height: PropTypes.number,
|
|
190
|
+
/**
|
|
191
|
+
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
192
|
+
*/
|
|
193
|
+
highlightedItem: PropTypes.shape({
|
|
194
|
+
dataIndex: PropTypes.number,
|
|
195
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
196
|
+
}),
|
|
186
197
|
/**
|
|
187
198
|
* Indicate which axis to display the left of the charts.
|
|
188
199
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -231,6 +242,12 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
231
242
|
* @param {null | AxisData} data The data about the clicked axis and items associated with it.
|
|
232
243
|
*/
|
|
233
244
|
onAxisClick: PropTypes.func,
|
|
245
|
+
/**
|
|
246
|
+
* The callback fired when the highlighted item changes.
|
|
247
|
+
*
|
|
248
|
+
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
249
|
+
*/
|
|
250
|
+
onHighlightChange: PropTypes.func,
|
|
234
251
|
/**
|
|
235
252
|
* Callback fired when a line element is clicked.
|
|
236
253
|
*/
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["id", "classes", "color", "gradientId", "
|
|
3
|
+
const _excluded = ["id", "classes", "color", "gradientId", "slots", "slotProps", "onClick"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
7
7
|
import { useSlotProps } from '@mui/base/utils';
|
|
8
8
|
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
9
9
|
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
10
|
-
import {
|
|
11
|
-
import { getIsFaded, getIsHighlighted, useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
10
|
+
import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
12
11
|
import { AnimatedLine } from './AnimatedLine';
|
|
12
|
+
import { useItemHighlighted } from '../context';
|
|
13
13
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
14
|
export function getLineElementUtilityClass(slot) {
|
|
15
15
|
return generateUtilityClass('MuiLineElement', slot);
|
|
@@ -43,24 +43,18 @@ function LineElement(props) {
|
|
|
43
43
|
classes: innerClasses,
|
|
44
44
|
color,
|
|
45
45
|
gradientId,
|
|
46
|
-
highlightScope,
|
|
47
46
|
slots,
|
|
48
47
|
slotProps,
|
|
49
48
|
onClick
|
|
50
49
|
} = props,
|
|
51
50
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
52
|
-
const getInteractionItemProps = useInteractionItemProps(
|
|
51
|
+
const getInteractionItemProps = useInteractionItemProps();
|
|
53
52
|
const {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
type: 'line',
|
|
58
|
-
seriesId: id
|
|
59
|
-
}, highlightScope);
|
|
60
|
-
const isFaded = !isHighlighted && getIsFaded(item, {
|
|
61
|
-
type: 'line',
|
|
53
|
+
isFaded,
|
|
54
|
+
isHighlighted
|
|
55
|
+
} = useItemHighlighted({
|
|
62
56
|
seriesId: id
|
|
63
|
-
}
|
|
57
|
+
});
|
|
64
58
|
const ownerState = {
|
|
65
59
|
id,
|
|
66
60
|
classes: innerClasses,
|
|
@@ -89,16 +83,12 @@ function LineElement(props) {
|
|
|
89
83
|
process.env.NODE_ENV !== "production" ? LineElement.propTypes = {
|
|
90
84
|
// ----------------------------- Warning --------------------------------
|
|
91
85
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
92
|
-
// | To update them edit the TypeScript types and run "
|
|
86
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
93
87
|
// ----------------------------------------------------------------------
|
|
94
88
|
classes: PropTypes.object,
|
|
95
89
|
color: PropTypes.string.isRequired,
|
|
96
90
|
d: PropTypes.string.isRequired,
|
|
97
91
|
gradientId: PropTypes.string,
|
|
98
|
-
highlightScope: PropTypes.shape({
|
|
99
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
100
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
101
|
-
}),
|
|
102
92
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
103
93
|
/**
|
|
104
94
|
* If `true`, animations are skipped.
|
|
@@ -72,7 +72,7 @@ function LineHighlightElement(props) {
|
|
|
72
72
|
process.env.NODE_ENV !== "production" ? LineHighlightElement.propTypes = {
|
|
73
73
|
// ----------------------------- Warning --------------------------------
|
|
74
74
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
75
|
-
// | To update them edit the TypeScript types and run "
|
|
75
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
76
76
|
// ----------------------------------------------------------------------
|
|
77
77
|
classes: PropTypes.object,
|
|
78
78
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
@@ -90,7 +90,7 @@ function LineHighlightPlot(props) {
|
|
|
90
90
|
process.env.NODE_ENV !== "production" ? LineHighlightPlot.propTypes = {
|
|
91
91
|
// ----------------------------- Warning --------------------------------
|
|
92
92
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
93
|
-
// | To update them edit the TypeScript types and run "
|
|
93
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
94
94
|
// ----------------------------------------------------------------------
|
|
95
95
|
/**
|
|
96
96
|
* The props used for each component slot.
|
|
@@ -94,7 +94,6 @@ function LinePlot(props) {
|
|
|
94
94
|
d,
|
|
95
95
|
seriesId,
|
|
96
96
|
color,
|
|
97
|
-
highlightScope,
|
|
98
97
|
gradientUsed
|
|
99
98
|
}) => {
|
|
100
99
|
return /*#__PURE__*/_jsx(LineElement, {
|
|
@@ -102,7 +101,6 @@ function LinePlot(props) {
|
|
|
102
101
|
d: d,
|
|
103
102
|
color: color,
|
|
104
103
|
gradientId: gradientUsed && getGradientId(...gradientUsed),
|
|
105
|
-
highlightScope: highlightScope,
|
|
106
104
|
skipAnimation: skipAnimation,
|
|
107
105
|
slots: slots,
|
|
108
106
|
slotProps: slotProps,
|
|
@@ -117,7 +115,7 @@ function LinePlot(props) {
|
|
|
117
115
|
process.env.NODE_ENV !== "production" ? LinePlot.propTypes = {
|
|
118
116
|
// ----------------------------- Warning --------------------------------
|
|
119
117
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
120
|
-
// | To update them edit the TypeScript types and run "
|
|
118
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
121
119
|
// ----------------------------------------------------------------------
|
|
122
120
|
/**
|
|
123
121
|
* Callback fired when a line item is clicked.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
2
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
3
|
-
const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "
|
|
3
|
+
const _excluded = ["x", "y", "id", "classes", "color", "shape", "dataIndex", "onClick", "skipAnimation"];
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import composeClasses from '@mui/utils/composeClasses';
|
|
@@ -11,7 +11,8 @@ import { symbol as d3Symbol, symbolsFill as d3SymbolsFill } from 'd3-shape';
|
|
|
11
11
|
import { animated, to, useSpring } from '@react-spring/web';
|
|
12
12
|
import { getSymbol } from '../internals/utils';
|
|
13
13
|
import { InteractionContext } from '../context/InteractionProvider';
|
|
14
|
-
import {
|
|
14
|
+
import { useInteractionItemProps } from '../hooks/useInteractionItemProps';
|
|
15
|
+
import { useItemHighlighted } from '../context';
|
|
15
16
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
16
17
|
export function getMarkElementUtilityClass(slot) {
|
|
17
18
|
return generateUtilityClass('MuiMarkElement', slot);
|
|
@@ -41,21 +42,6 @@ const MarkElementPath = styled(animated.path, {
|
|
|
41
42
|
stroke: ownerState.color,
|
|
42
43
|
strokeWidth: 2
|
|
43
44
|
}));
|
|
44
|
-
MarkElementPath.propTypes = {
|
|
45
|
-
// ----------------------------- Warning --------------------------------
|
|
46
|
-
// | These PropTypes are generated from the TypeScript type definitions |
|
|
47
|
-
// | To update them edit the TypeScript types and run "yarn proptypes" |
|
|
48
|
-
// ----------------------------------------------------------------------
|
|
49
|
-
as: PropTypes.elementType,
|
|
50
|
-
ownerState: PropTypes.shape({
|
|
51
|
-
classes: PropTypes.object,
|
|
52
|
-
color: PropTypes.string.isRequired,
|
|
53
|
-
id: PropTypes.string.isRequired,
|
|
54
|
-
isFaded: PropTypes.bool.isRequired,
|
|
55
|
-
isHighlighted: PropTypes.bool.isRequired
|
|
56
|
-
}).isRequired,
|
|
57
|
-
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object])
|
|
58
|
-
};
|
|
59
45
|
/**
|
|
60
46
|
* Demos:
|
|
61
47
|
*
|
|
@@ -75,24 +61,20 @@ function MarkElement(props) {
|
|
|
75
61
|
color,
|
|
76
62
|
shape,
|
|
77
63
|
dataIndex,
|
|
78
|
-
highlightScope,
|
|
79
64
|
onClick,
|
|
80
65
|
skipAnimation
|
|
81
66
|
} = props,
|
|
82
67
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
83
|
-
const getInteractionItemProps = useInteractionItemProps(
|
|
68
|
+
const getInteractionItemProps = useInteractionItemProps();
|
|
69
|
+
const {
|
|
70
|
+
isFaded,
|
|
71
|
+
isHighlighted
|
|
72
|
+
} = useItemHighlighted({
|
|
73
|
+
seriesId: id
|
|
74
|
+
});
|
|
84
75
|
const {
|
|
85
|
-
item,
|
|
86
76
|
axis
|
|
87
77
|
} = React.useContext(InteractionContext);
|
|
88
|
-
const isHighlighted = axis.x?.index === dataIndex || getIsHighlighted(item, {
|
|
89
|
-
type: 'line',
|
|
90
|
-
seriesId: id
|
|
91
|
-
}, highlightScope);
|
|
92
|
-
const isFaded = !isHighlighted && getIsFaded(item, {
|
|
93
|
-
type: 'line',
|
|
94
|
-
seriesId: id
|
|
95
|
-
}, highlightScope);
|
|
96
78
|
const position = useSpring({
|
|
97
79
|
x,
|
|
98
80
|
y,
|
|
@@ -101,7 +83,7 @@ function MarkElement(props) {
|
|
|
101
83
|
const ownerState = {
|
|
102
84
|
id,
|
|
103
85
|
classes: innerClasses,
|
|
104
|
-
isHighlighted,
|
|
86
|
+
isHighlighted: axis.x?.index === dataIndex || isHighlighted,
|
|
105
87
|
isFaded,
|
|
106
88
|
color
|
|
107
89
|
};
|
|
@@ -125,17 +107,13 @@ function MarkElement(props) {
|
|
|
125
107
|
process.env.NODE_ENV !== "production" ? MarkElement.propTypes = {
|
|
126
108
|
// ----------------------------- Warning --------------------------------
|
|
127
109
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
128
|
-
// | To update them edit the TypeScript types and run "
|
|
110
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
129
111
|
// ----------------------------------------------------------------------
|
|
130
112
|
classes: PropTypes.object,
|
|
131
113
|
/**
|
|
132
114
|
* The index to the element in the series' data array.
|
|
133
115
|
*/
|
|
134
116
|
dataIndex: PropTypes.number.isRequired,
|
|
135
|
-
highlightScope: PropTypes.shape({
|
|
136
|
-
faded: PropTypes.oneOf(['global', 'none', 'series']),
|
|
137
|
-
highlighted: PropTypes.oneOf(['item', 'none', 'series'])
|
|
138
|
-
}),
|
|
139
117
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
140
118
|
/**
|
|
141
119
|
* The shape of the marker.
|
|
@@ -139,7 +139,6 @@ function MarkPlot(props) {
|
|
|
139
139
|
x: x,
|
|
140
140
|
y: y // Don't know why TS doesn't get from the filter that y can't be null
|
|
141
141
|
,
|
|
142
|
-
highlightScope: series[seriesId].highlightScope,
|
|
143
142
|
skipAnimation: skipAnimation,
|
|
144
143
|
onClick: onItemClick && (event => onItemClick(event, {
|
|
145
144
|
type: 'line',
|
|
@@ -156,7 +155,7 @@ function MarkPlot(props) {
|
|
|
156
155
|
process.env.NODE_ENV !== "production" ? MarkPlot.propTypes = {
|
|
157
156
|
// ----------------------------- Warning --------------------------------
|
|
158
157
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
159
|
-
// | To update them edit the TypeScript types and run "
|
|
158
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
160
159
|
// ----------------------------------------------------------------------
|
|
161
160
|
/**
|
|
162
161
|
* Callback fired when a line mark item is clicked.
|