@mui/x-charts 8.14.0 → 8.15.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 +8 -0
- package/BarChart/BarChart.plugins.d.ts +2 -1
- package/BarChart/BarChart.plugins.js +2 -1
- package/BarChart/useBarChartProps.js +4 -2
- package/BarChart/useBarPlotData.js +20 -33
- package/CHANGELOG.md +202 -0
- package/ChartContainer/ChartContainer.js +8 -0
- package/ChartContainer/useChartContainerProps.js +4 -2
- package/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +9 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
- package/ChartsBrushOverlay/ChartsBrushOverlay.js +102 -0
- package/ChartsBrushOverlay/index.d.ts +4 -0
- package/ChartsBrushOverlay/index.js +19 -0
- package/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/ChartsReferenceLine/ChartsXReferenceLine.js +13 -8
- package/ChartsReferenceLine/ChartsYReferenceLine.js +13 -8
- package/ChartsReferenceLine/common.d.ts +3 -1
- package/ChartsReferenceLine/common.js +3 -1
- package/ChartsTooltip/ChartsTooltipContainer.js +20 -2
- package/ChartsXAxis/getVisibleLabels.js +45 -25
- package/Gauge/Gauge.js +2 -9
- package/Gauge/GaugeReferenceArc.d.ts +4 -1
- package/Gauge/GaugeReferenceArc.js +12 -3
- package/Gauge/GaugeValueArc.d.ts +4 -1
- package/Gauge/GaugeValueArc.js +16 -8
- package/Gauge/GaugeValueText.js +3 -1
- package/LineChart/LineChart.js +8 -0
- package/LineChart/LineChart.plugins.d.ts +2 -1
- package/LineChart/LineChart.plugins.js +2 -1
- package/LineChart/useLineChartProps.js +4 -2
- package/ScatterChart/ScatterChart.js +8 -0
- package/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/ScatterChart/ScatterChart.plugins.js +2 -1
- package/ScatterChart/seriesConfig/seriesProcessor.js +1 -1
- package/ScatterChart/useScatterChartProps.js +5 -3
- package/SparkLineChart/SparkLineChart.js +8 -0
- package/esm/BarChart/BarChart.js +8 -0
- package/esm/BarChart/BarChart.plugins.d.ts +2 -1
- package/esm/BarChart/BarChart.plugins.js +2 -1
- package/esm/BarChart/useBarChartProps.js +4 -2
- package/esm/BarChart/useBarPlotData.js +20 -33
- package/esm/ChartContainer/ChartContainer.js +8 -0
- package/esm/ChartContainer/useChartContainerProps.js +4 -2
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.d.ts +12 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.classes.js +2 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.d.ts +6 -0
- package/esm/ChartsBrushOverlay/ChartsBrushOverlay.js +95 -0
- package/esm/ChartsBrushOverlay/index.d.ts +4 -0
- package/esm/ChartsBrushOverlay/index.js +2 -0
- package/esm/ChartsReferenceLine/ChartsReferenceLine.js +1 -1
- package/esm/ChartsReferenceLine/ChartsXReferenceLine.js +14 -9
- package/esm/ChartsReferenceLine/ChartsYReferenceLine.js +14 -9
- package/esm/ChartsReferenceLine/common.d.ts +3 -1
- package/esm/ChartsReferenceLine/common.js +2 -0
- package/esm/ChartsTooltip/ChartsTooltipContainer.js +20 -2
- package/esm/ChartsXAxis/getVisibleLabels.js +45 -25
- package/esm/Gauge/Gauge.js +2 -9
- package/esm/Gauge/GaugeReferenceArc.d.ts +4 -1
- package/esm/Gauge/GaugeReferenceArc.js +11 -2
- package/esm/Gauge/GaugeValueArc.d.ts +4 -1
- package/esm/Gauge/GaugeValueArc.js +16 -8
- package/esm/Gauge/GaugeValueText.js +3 -1
- package/esm/LineChart/LineChart.js +8 -0
- package/esm/LineChart/LineChart.plugins.d.ts +2 -1
- package/esm/LineChart/LineChart.plugins.js +2 -1
- package/esm/LineChart/useLineChartProps.js +4 -2
- package/esm/ScatterChart/ScatterChart.js +8 -0
- package/esm/ScatterChart/ScatterChart.plugins.d.ts +2 -1
- package/esm/ScatterChart/ScatterChart.plugins.js +2 -1
- package/esm/ScatterChart/seriesConfig/seriesProcessor.js +1 -1
- package/esm/ScatterChart/useScatterChartProps.js +5 -3
- package/esm/SparkLineChart/SparkLineChart.js +8 -0
- package/esm/hooks/index.d.ts +2 -1
- package/esm/hooks/index.js +2 -1
- package/esm/hooks/useBrush.d.ts +18 -0
- package/esm/hooks/useBrush.js +16 -0
- package/esm/index.d.ts +2 -1
- package/esm/index.js +2 -1
- package/esm/internals/Flatbush.d.ts +63 -0
- package/esm/internals/Flatbush.js +468 -0
- package/esm/internals/domUtils.d.ts +9 -4
- package/esm/internals/domUtils.js +115 -52
- package/esm/internals/index.d.ts +1 -0
- package/esm/internals/index.js +1 -0
- package/esm/internals/plugins/allPlugins.d.ts +4 -3
- package/esm/internals/plugins/allPlugins.js +2 -1
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +16 -10
- package/esm/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +2 -2
- package/esm/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/index.js +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +109 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +75 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +72 -0
- package/esm/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.js +1 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +6 -2
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +19 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +41 -0
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
- package/esm/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +4 -1
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +5 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +33 -0
- package/esm/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +40 -81
- package/esm/internals/plugins/utils/selectors.d.ts +1 -1
- package/esm/locales/elGR.js +97 -99
- package/esm/models/seriesType/scatter.d.ts +2 -0
- package/esm/tests/constants.js +1 -0
- package/esm/themeAugmentation/components.d.ts +3 -0
- package/esm/themeAugmentation/overrides.d.ts +2 -0
- package/hooks/index.d.ts +2 -1
- package/hooks/index.js +12 -0
- package/hooks/useBrush.d.ts +18 -0
- package/hooks/useBrush.js +21 -0
- package/index.d.ts +2 -1
- package/index.js +13 -1
- package/internals/Flatbush.d.ts +63 -0
- package/internals/Flatbush.js +477 -0
- package/internals/domUtils.d.ts +9 -4
- package/internals/domUtils.js +119 -54
- package/internals/index.d.ts +1 -0
- package/internals/index.js +12 -0
- package/internals/plugins/allPlugins.d.ts +4 -3
- package/internals/plugins/allPlugins.js +2 -1
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.js +16 -10
- package/internals/plugins/corePlugins/useChartInteractionListener/useChartInteractionListener.types.d.ts +2 -2
- package/internals/plugins/featurePlugins/useChartBrush/index.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartBrush/index.js +38 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.d.ts +3 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.js +117 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.d.ts +82 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.selectors.js +82 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.d.ts +72 -0
- package/internals/plugins/featurePlugins/useChartBrush/useChartBrush.types.js +5 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/createZoomLookup.js +3 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeAxis.js +2 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.d.ts +2 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/defaultizeZoom.js +8 -3
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.d.ts +6 -2
- package/internals/plugins/featurePlugins/useChartCartesianAxis/getAxisValue.js +3 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxis.types.d.ts +3 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.d.ts +19 -0
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianAxisRendering.selectors.js +43 -1
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.d.ts +4 -4
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianHighlight.selectors.js +13 -6
- package/internals/plugins/featurePlugins/useChartCartesianAxis/useChartCartesianInteraction.selectors.js +4 -1
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.d.ts +5 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/findClosestPoints.js +39 -0
- package/internals/plugins/featurePlugins/useChartClosestPoint/useChartClosestPoint.js +39 -80
- package/internals/plugins/utils/selectors.d.ts +1 -1
- package/locales/elGR.js +97 -99
- package/models/seriesType/scatter.d.ts +2 -0
- package/package.json +5 -4
- package/tests/constants.js +7 -0
- package/themeAugmentation/components.d.ts +3 -0
- package/themeAugmentation/overrides.d.ts +2 -0
|
@@ -21,12 +21,17 @@ var _jsxRuntime = require("react/jsx-runtime");
|
|
|
21
21
|
const getTextParams = ({
|
|
22
22
|
left,
|
|
23
23
|
width,
|
|
24
|
-
|
|
24
|
+
spacing,
|
|
25
|
+
position,
|
|
25
26
|
labelAlign = 'middle'
|
|
26
27
|
}) => {
|
|
28
|
+
const defaultSpacingOtherAxis = labelAlign === 'middle' ? _common.DEFAULT_SPACING_MIDDLE_OTHER_AXIS : _common.DEFAULT_SPACING;
|
|
29
|
+
const spacingX = (typeof spacing === 'object' ? spacing.x : defaultSpacingOtherAxis) ?? defaultSpacingOtherAxis;
|
|
30
|
+
const spacingY = (typeof spacing === 'object' ? spacing.y : spacing) ?? _common.DEFAULT_SPACING;
|
|
27
31
|
switch (labelAlign) {
|
|
28
32
|
case 'start':
|
|
29
33
|
return {
|
|
34
|
+
y: position - spacingY,
|
|
30
35
|
x: left + spacingX,
|
|
31
36
|
style: {
|
|
32
37
|
dominantBaseline: 'auto',
|
|
@@ -35,6 +40,7 @@ const getTextParams = ({
|
|
|
35
40
|
};
|
|
36
41
|
case 'end':
|
|
37
42
|
return {
|
|
43
|
+
y: position - spacingY,
|
|
38
44
|
x: left + width - spacingX,
|
|
39
45
|
style: {
|
|
40
46
|
dominantBaseline: 'auto',
|
|
@@ -43,7 +49,8 @@ const getTextParams = ({
|
|
|
43
49
|
};
|
|
44
50
|
default:
|
|
45
51
|
return {
|
|
46
|
-
|
|
52
|
+
y: position - spacingY,
|
|
53
|
+
x: left + width / 2 + spacingX,
|
|
47
54
|
style: {
|
|
48
55
|
dominantBaseline: 'auto',
|
|
49
56
|
textAnchor: 'middle'
|
|
@@ -62,9 +69,9 @@ function ChartsYReferenceLine(props) {
|
|
|
62
69
|
const {
|
|
63
70
|
y,
|
|
64
71
|
label = '',
|
|
65
|
-
spacing
|
|
72
|
+
spacing,
|
|
66
73
|
classes: inClasses,
|
|
67
|
-
labelAlign,
|
|
74
|
+
labelAlign = 'middle',
|
|
68
75
|
lineStyle,
|
|
69
76
|
labelStyle,
|
|
70
77
|
axisId
|
|
@@ -83,16 +90,14 @@ function ChartsYReferenceLine(props) {
|
|
|
83
90
|
}
|
|
84
91
|
const d = `M ${left} ${yPosition} l ${width} 0`;
|
|
85
92
|
const classes = getYReferenceLineClasses(inClasses);
|
|
86
|
-
const spacingX = typeof spacing === 'object' ? spacing.x ?? 0 : spacing;
|
|
87
|
-
const spacingY = typeof spacing === 'object' ? spacing.y ?? 0 : spacing;
|
|
88
93
|
const textParams = (0, _extends2.default)({
|
|
89
|
-
y: yPosition - spacingY,
|
|
90
94
|
text: label,
|
|
91
95
|
fontSize: 12
|
|
92
96
|
}, getTextParams({
|
|
93
97
|
left,
|
|
94
98
|
width,
|
|
95
|
-
|
|
99
|
+
spacing,
|
|
100
|
+
position: yPosition,
|
|
96
101
|
labelAlign
|
|
97
102
|
}), {
|
|
98
103
|
className: classes.label
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ChartsReferenceLineClasses } from "./chartsReferenceLineClasses.js";
|
|
2
2
|
import { ChartsTextStyle } from "../ChartsText/index.js";
|
|
3
3
|
import { AxisId } from "../models/axis.js";
|
|
4
|
+
export declare const DEFAULT_SPACING = 5;
|
|
5
|
+
export declare const DEFAULT_SPACING_MIDDLE_OTHER_AXIS = 0;
|
|
4
6
|
export type CommonChartsReferenceLineProps = {
|
|
5
7
|
/**
|
|
6
8
|
* The alignment if the label is in the chart drawing area.
|
|
@@ -14,7 +16,7 @@ export type CommonChartsReferenceLineProps = {
|
|
|
14
16
|
/**
|
|
15
17
|
* Additional space around the label in px.
|
|
16
18
|
* Can be a number or an object `{ x, y }` to distinguish space with the reference line and space with axes.
|
|
17
|
-
* @default 5
|
|
19
|
+
* @default { x: 0, y: 5 } on a horizontal line and { x: 5, y: 0 } on a vertical line.
|
|
18
20
|
*/
|
|
19
21
|
spacing?: number | {
|
|
20
22
|
x?: number;
|
|
@@ -4,10 +4,12 @@ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefau
|
|
|
4
4
|
Object.defineProperty(exports, "__esModule", {
|
|
5
5
|
value: true
|
|
6
6
|
});
|
|
7
|
-
exports.ReferenceLineRoot = void 0;
|
|
7
|
+
exports.ReferenceLineRoot = exports.DEFAULT_SPACING_MIDDLE_OTHER_AXIS = exports.DEFAULT_SPACING = void 0;
|
|
8
8
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
9
|
var _styles = require("@mui/material/styles");
|
|
10
10
|
var _chartsReferenceLineClasses = require("./chartsReferenceLineClasses");
|
|
11
|
+
const DEFAULT_SPACING = exports.DEFAULT_SPACING = 5;
|
|
12
|
+
const DEFAULT_SPACING_MIDDLE_OTHER_AXIS = exports.DEFAULT_SPACING_MIDDLE_OTHER_AXIS = 0;
|
|
11
13
|
const ReferenceLineRoot = exports.ReferenceLineRoot = (0, _styles.styled)('g')(({
|
|
12
14
|
theme
|
|
13
15
|
}) => ({
|
|
@@ -26,9 +26,11 @@ var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useCha
|
|
|
26
26
|
var _useChartPolarInteraction = require("../internals/plugins/featurePlugins/useChartPolarAxis/useChartPolarInteraction.selectors");
|
|
27
27
|
var _useAxisSystem = require("../hooks/useAxisSystem");
|
|
28
28
|
var _hooks = require("../hooks");
|
|
29
|
+
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
30
|
+
var _selectors = require("../internals/plugins/utils/selectors");
|
|
29
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
30
32
|
const _excluded = ["trigger", "classes", "children"];
|
|
31
|
-
const
|
|
33
|
+
const selectorReturnFalse = () => false;
|
|
32
34
|
const ChartsTooltipRoot = (0, _styles.styled)(_Popper.default, {
|
|
33
35
|
name: 'MuiChartsTooltip',
|
|
34
36
|
slot: 'Root'
|
|
@@ -38,6 +40,21 @@ const ChartsTooltipRoot = (0, _styles.styled)(_Popper.default, {
|
|
|
38
40
|
pointerEvents: 'none',
|
|
39
41
|
zIndex: theme.zIndex.modal
|
|
40
42
|
}));
|
|
43
|
+
const selectorSelectIsOpenSelector = (0, _selectors.createSelector)([_useChartBrush.selectorBrushShouldPreventTooltip, (_, trigger) => trigger, (_, __, axisSystem) => axisSystem], (shouldPreventBecauseOfBrush, trigger, axisSystem) => {
|
|
44
|
+
if (shouldPreventBecauseOfBrush) {
|
|
45
|
+
return selectorReturnFalse;
|
|
46
|
+
}
|
|
47
|
+
if (trigger === 'item') {
|
|
48
|
+
return _useChartInteraction.selectorChartsInteractionItemIsDefined;
|
|
49
|
+
}
|
|
50
|
+
if (axisSystem === 'polar') {
|
|
51
|
+
return _useChartPolarInteraction.selectorChartsInteractionPolarAxisTooltip;
|
|
52
|
+
}
|
|
53
|
+
if (axisSystem === 'cartesian') {
|
|
54
|
+
return _useChartCartesianAxis.selectorChartsInteractionAxisTooltip;
|
|
55
|
+
}
|
|
56
|
+
return selectorReturnFalse;
|
|
57
|
+
});
|
|
41
58
|
|
|
42
59
|
/**
|
|
43
60
|
* Demos:
|
|
@@ -70,7 +87,8 @@ function ChartsTooltipContainer(inProps) {
|
|
|
70
87
|
}));
|
|
71
88
|
const axisSystem = (0, _useAxisSystem.useAxisSystem)();
|
|
72
89
|
const store = (0, _useStore.useStore)();
|
|
73
|
-
const
|
|
90
|
+
const isOpenSelector = (0, _useSelector.useSelector)(store, selectorSelectIsOpenSelector, [trigger, axisSystem]);
|
|
91
|
+
const isOpen = (0, _useSelector.useSelector)(store, isOpenSelector);
|
|
74
92
|
React.useEffect(() => {
|
|
75
93
|
const element = svgRef.current;
|
|
76
94
|
if (element === null) {
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
});
|
|
7
7
|
exports.getVisibleLabels = getVisibleLabels;
|
|
8
8
|
var _geometry = require("../internals/geometry");
|
|
9
|
-
var
|
|
9
|
+
var _domUtils = require("../internals/domUtils");
|
|
10
10
|
/* Returns a set of indices of the tick labels that should be visible. */
|
|
11
11
|
function getVisibleLabels(xTicks, {
|
|
12
12
|
tickLabelStyle: style,
|
|
@@ -16,23 +16,6 @@ function getVisibleLabels(xTicks, {
|
|
|
16
16
|
isMounted,
|
|
17
17
|
isXInside
|
|
18
18
|
}) {
|
|
19
|
-
const getTickLabelSize = tick => {
|
|
20
|
-
if (!isMounted || tick.formattedValue === undefined) {
|
|
21
|
-
return {
|
|
22
|
-
width: 0,
|
|
23
|
-
height: 0
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
const tickSizes = (0, _getWordsByLines.getWordsByLines)({
|
|
27
|
-
style,
|
|
28
|
-
needsComputation: true,
|
|
29
|
-
text: tick.formattedValue
|
|
30
|
-
});
|
|
31
|
-
return {
|
|
32
|
-
width: Math.max(...tickSizes.map(size => size.width)),
|
|
33
|
-
height: Math.max(tickSizes.length * tickSizes[0].height)
|
|
34
|
-
};
|
|
35
|
-
};
|
|
36
19
|
if (typeof tickLabelInterval === 'function') {
|
|
37
20
|
return new Set(xTicks.filter((item, index) => tickLabelInterval(item.value, index)));
|
|
38
21
|
}
|
|
@@ -40,7 +23,7 @@ function getVisibleLabels(xTicks, {
|
|
|
40
23
|
// Filter label to avoid overlap
|
|
41
24
|
let previousTextLimit = 0;
|
|
42
25
|
const direction = reverse ? -1 : 1;
|
|
43
|
-
|
|
26
|
+
const candidateTickLabels = xTicks.filter(item => {
|
|
44
27
|
const {
|
|
45
28
|
offset,
|
|
46
29
|
labelOffset,
|
|
@@ -50,18 +33,25 @@ function getVisibleLabels(xTicks, {
|
|
|
50
33
|
return false;
|
|
51
34
|
}
|
|
52
35
|
const textPosition = offset + labelOffset;
|
|
36
|
+
return isXInside(textPosition);
|
|
37
|
+
});
|
|
38
|
+
const sizeMap = measureTickLabels(candidateTickLabels, style);
|
|
39
|
+
return new Set(candidateTickLabels.filter((item, labelIndex) => {
|
|
40
|
+
const {
|
|
41
|
+
offset,
|
|
42
|
+
labelOffset
|
|
43
|
+
} = item;
|
|
44
|
+
const textPosition = offset + labelOffset;
|
|
53
45
|
if (labelIndex > 0 && direction * textPosition < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
54
46
|
return false;
|
|
55
47
|
}
|
|
56
|
-
if (!isXInside(textPosition)) {
|
|
57
|
-
return false;
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/* Measuring text width is expensive, so we need to delay it as much as possible to improve performance. */
|
|
61
48
|
const {
|
|
62
49
|
width,
|
|
63
50
|
height
|
|
64
|
-
} = getTickLabelSize(item)
|
|
51
|
+
} = isMounted ? getTickLabelSize(sizeMap, item) : {
|
|
52
|
+
width: 0,
|
|
53
|
+
height: 0
|
|
54
|
+
};
|
|
65
55
|
const distance = (0, _geometry.getMinXTranslation)(width, height, style?.angle);
|
|
66
56
|
const currentTextLimit = textPosition - direction * distance / 2;
|
|
67
57
|
if (labelIndex > 0 && direction * currentTextLimit < direction * (previousTextLimit + tickLabelMinGap)) {
|
|
@@ -72,4 +62,34 @@ function getVisibleLabels(xTicks, {
|
|
|
72
62
|
previousTextLimit = textPosition + direction * distance / 2;
|
|
73
63
|
return true;
|
|
74
64
|
}));
|
|
65
|
+
}
|
|
66
|
+
function getTickLabelSize(sizeMap, tick) {
|
|
67
|
+
if (tick.formattedValue === undefined) {
|
|
68
|
+
return {
|
|
69
|
+
width: 0,
|
|
70
|
+
height: 0
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
let width = 0;
|
|
74
|
+
let height = 0;
|
|
75
|
+
for (const line of tick.formattedValue.split('\n')) {
|
|
76
|
+
const lineSize = sizeMap.get(line);
|
|
77
|
+
if (lineSize) {
|
|
78
|
+
width = Math.max(width, lineSize.width);
|
|
79
|
+
height += lineSize.height;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
width,
|
|
84
|
+
height
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function measureTickLabels(ticks, style) {
|
|
88
|
+
const strings = new Set();
|
|
89
|
+
for (const tick of ticks) {
|
|
90
|
+
if (tick.formattedValue) {
|
|
91
|
+
tick.formattedValue.split('\n').forEach(line => strings.add(line));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
return (0, _domUtils.batchMeasureStrings)(strings, style);
|
|
75
95
|
}
|
package/Gauge/Gauge.js
CHANGED
|
@@ -25,10 +25,7 @@ const useUtilityClasses = props => {
|
|
|
25
25
|
classes
|
|
26
26
|
} = props;
|
|
27
27
|
const slots = {
|
|
28
|
-
root: ['root']
|
|
29
|
-
valueArc: ['valueArc'],
|
|
30
|
-
referenceArc: ['referenceArc'],
|
|
31
|
-
valueText: ['valueText']
|
|
28
|
+
root: ['root']
|
|
32
29
|
};
|
|
33
30
|
return (0, _composeClasses.default)(slots, _gaugeClasses.getGaugeUtilityClass, classes);
|
|
34
31
|
};
|
|
@@ -44,13 +41,9 @@ const Gauge = exports.Gauge = /*#__PURE__*/React.forwardRef(function Gauge(props
|
|
|
44
41
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_GaugeContainer.GaugeContainer, (0, _extends2.default)({}, other, {
|
|
45
42
|
className: (0, _clsx.default)(classes.root, className),
|
|
46
43
|
ref: ref,
|
|
47
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GaugeReferenceArc.GaugeReferenceArc, {
|
|
48
|
-
className: classes.referenceArc
|
|
49
|
-
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GaugeValueArc.GaugeValueArc, {
|
|
50
|
-
className: classes.valueArc,
|
|
44
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_GaugeReferenceArc.GaugeReferenceArc, {}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GaugeValueArc.GaugeValueArc, {
|
|
51
45
|
skipAnimation: skipAnimation
|
|
52
46
|
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_GaugeValueText.GaugeValueText, {
|
|
53
|
-
className: classes.valueText,
|
|
54
47
|
text: text
|
|
55
48
|
}), children]
|
|
56
49
|
}));
|
|
@@ -1,18 +1,22 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
'use client';
|
|
3
3
|
|
|
4
|
-
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
5
4
|
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
|
|
5
|
+
var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard").default;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", {
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.GaugeReferenceArc = GaugeReferenceArc;
|
|
10
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
12
|
var React = _interopRequireWildcard(require("react"));
|
|
12
13
|
var _d3Shape = require("@mui/x-charts-vendor/d3-shape");
|
|
13
14
|
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
16
|
var _GaugeProvider = require("./GaugeProvider");
|
|
17
|
+
var _gaugeClasses = require("./gaugeClasses");
|
|
15
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["className"];
|
|
16
20
|
const StyledPath = (0, _styles.styled)('path', {
|
|
17
21
|
name: 'MuiGauge',
|
|
18
22
|
slot: 'ReferenceArc'
|
|
@@ -21,7 +25,11 @@ const StyledPath = (0, _styles.styled)('path', {
|
|
|
21
25
|
}) => ({
|
|
22
26
|
fill: (theme.vars || theme).palette.divider
|
|
23
27
|
}));
|
|
24
|
-
function GaugeReferenceArc(
|
|
28
|
+
function GaugeReferenceArc(_ref) {
|
|
29
|
+
let {
|
|
30
|
+
className
|
|
31
|
+
} = _ref,
|
|
32
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
25
33
|
const {
|
|
26
34
|
startAngle,
|
|
27
35
|
endAngle,
|
|
@@ -32,6 +40,7 @@ function GaugeReferenceArc(props) {
|
|
|
32
40
|
cy
|
|
33
41
|
} = (0, _GaugeProvider.useGaugeState)();
|
|
34
42
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)(StyledPath, (0, _extends2.default)({
|
|
43
|
+
className: (0, _clsx.default)(_gaugeClasses.gaugeClasses.referenceArc, className),
|
|
35
44
|
transform: `translate(${cx}, ${cy})`,
|
|
36
45
|
d: (0, _d3Shape.arc)().cornerRadius(cornerRadius)({
|
|
37
46
|
startAngle,
|
|
@@ -39,5 +48,5 @@ function GaugeReferenceArc(props) {
|
|
|
39
48
|
innerRadius,
|
|
40
49
|
outerRadius
|
|
41
50
|
})
|
|
42
|
-
},
|
|
51
|
+
}, other));
|
|
43
52
|
}
|
package/Gauge/GaugeValueArc.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
declare function GaugeValueArc(
|
|
2
|
+
declare function GaugeValueArc({
|
|
3
|
+
className,
|
|
4
|
+
...other
|
|
5
|
+
}: React.ComponentProps<'path'> & {
|
|
3
6
|
skipAnimation?: boolean;
|
|
4
7
|
}): React.JSX.Element | null;
|
|
5
8
|
declare namespace GaugeValueArc {
|
package/Gauge/GaugeValueArc.js
CHANGED
|
@@ -7,25 +7,32 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
value: true
|
|
8
8
|
});
|
|
9
9
|
exports.GaugeValueArc = GaugeValueArc;
|
|
10
|
-
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
11
10
|
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
11
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
14
|
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
15
16
|
var _useSkipAnimation = require("../hooks/useSkipAnimation");
|
|
16
17
|
var _useAnimateGaugeValueArc = require("../hooks/animation/useAnimateGaugeValueArc");
|
|
17
18
|
var _GaugeProvider = require("./GaugeProvider");
|
|
19
|
+
var _gaugeClasses = require("./gaugeClasses");
|
|
18
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
-
const _excluded = ["
|
|
21
|
+
const _excluded = ["className"],
|
|
22
|
+
_excluded2 = ["cx", "cy", "startAngle", "endAngle", "cornerRadius", "innerRadius", "outerRadius", "skipAnimation"];
|
|
20
23
|
const StyledPath = (0, _styles.styled)('path', {
|
|
21
24
|
name: 'MuiGauge',
|
|
22
|
-
slot: '
|
|
25
|
+
slot: 'ValueArc'
|
|
23
26
|
})(({
|
|
24
27
|
theme
|
|
25
28
|
}) => ({
|
|
26
29
|
fill: (theme.vars || theme).palette.primary.main
|
|
27
30
|
}));
|
|
28
|
-
function GaugeValueArc(
|
|
31
|
+
function GaugeValueArc(_ref) {
|
|
32
|
+
let {
|
|
33
|
+
className
|
|
34
|
+
} = _ref,
|
|
35
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
29
36
|
const {
|
|
30
37
|
value,
|
|
31
38
|
valueMin,
|
|
@@ -42,7 +49,8 @@ function GaugeValueArc(props) {
|
|
|
42
49
|
return null;
|
|
43
50
|
}
|
|
44
51
|
const valueAngle = startAngle + (value - valueMin) / (valueMax - valueMin) * (endAngle - startAngle);
|
|
45
|
-
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedGaugeValueArc, (0, _extends2.default)({},
|
|
52
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(AnimatedGaugeValueArc, (0, _extends2.default)({}, other, {
|
|
53
|
+
className: (0, _clsx.default)(_gaugeClasses.gaugeClasses.valueArc, className),
|
|
46
54
|
cx: cx,
|
|
47
55
|
cy: cy,
|
|
48
56
|
startAngle: startAngle,
|
|
@@ -59,7 +67,7 @@ process.env.NODE_ENV !== "production" ? GaugeValueArc.propTypes = {
|
|
|
59
67
|
// ----------------------------------------------------------------------
|
|
60
68
|
skipAnimation: _propTypes.default.bool
|
|
61
69
|
} : void 0;
|
|
62
|
-
function AnimatedGaugeValueArc(
|
|
70
|
+
function AnimatedGaugeValueArc(_ref2) {
|
|
63
71
|
let {
|
|
64
72
|
cx,
|
|
65
73
|
cy,
|
|
@@ -69,8 +77,8 @@ function AnimatedGaugeValueArc(_ref) {
|
|
|
69
77
|
innerRadius,
|
|
70
78
|
outerRadius,
|
|
71
79
|
skipAnimation: inSkipAnimation
|
|
72
|
-
} =
|
|
73
|
-
other = (0, _objectWithoutPropertiesLoose2.default)(
|
|
80
|
+
} = _ref2,
|
|
81
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(_ref2, _excluded2);
|
|
74
82
|
const skipAnimation = (0, _useSkipAnimation.useSkipAnimation)(inSkipAnimation);
|
|
75
83
|
const animatedProps = (0, _useAnimateGaugeValueArc.useAnimateGaugeValueArc)({
|
|
76
84
|
startAngle,
|
package/Gauge/GaugeValueText.js
CHANGED
|
@@ -11,8 +11,10 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _clsx = _interopRequireDefault(require("clsx"));
|
|
14
15
|
var _GaugeProvider = require("./GaugeProvider");
|
|
15
16
|
var _ChartsText = require("../ChartsText");
|
|
17
|
+
var _gaugeClasses = require("./gaugeClasses");
|
|
16
18
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
19
|
const _excluded = ["text", "className"];
|
|
18
20
|
function defaultFormatter({
|
|
@@ -42,7 +44,7 @@ function GaugeValueText(props) {
|
|
|
42
44
|
return null;
|
|
43
45
|
}
|
|
44
46
|
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
45
|
-
className: className,
|
|
47
|
+
className: (0, _clsx.default)(_gaugeClasses.gaugeClasses.valueText, className),
|
|
46
48
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsText.ChartsText, (0, _extends2.default)({
|
|
47
49
|
x: cx,
|
|
48
50
|
y: cy,
|
package/LineChart/LineChart.js
CHANGED
|
@@ -97,6 +97,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
97
97
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
98
98
|
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
99
99
|
}),
|
|
100
|
+
/**
|
|
101
|
+
* Configuration for the brush interaction.
|
|
102
|
+
*/
|
|
103
|
+
brushConfig: _propTypes.default.shape({
|
|
104
|
+
enabled: _propTypes.default.bool,
|
|
105
|
+
preventHighlight: _propTypes.default.bool,
|
|
106
|
+
preventTooltip: _propTypes.default.bool
|
|
107
|
+
}),
|
|
100
108
|
children: _propTypes.default.node,
|
|
101
109
|
className: _propTypes.default.string,
|
|
102
110
|
/**
|
|
@@ -4,5 +4,6 @@ import { UseChartInteractionSignature } from "../internals/plugins/featurePlugin
|
|
|
4
4
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
5
|
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
6
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
7
|
-
|
|
7
|
+
import { UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
8
|
+
export type LineChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
8
9
|
export declare const LINE_CHART_PLUGINS: ConvertSignaturesIntoPlugins<LineChartPluginSignatures>;
|
|
@@ -9,4 +9,5 @@ var _useChartCartesianAxis = require("../internals/plugins/featurePlugins/useCha
|
|
|
9
9
|
var _useChartInteraction = require("../internals/plugins/featurePlugins/useChartInteraction");
|
|
10
10
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
11
11
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
12
|
-
|
|
12
|
+
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
13
|
+
const LINE_CHART_PLUGINS = exports.LINE_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
|
@@ -13,7 +13,7 @@ var React = _interopRequireWildcard(require("react"));
|
|
|
13
13
|
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
14
14
|
var _constants = require("../constants");
|
|
15
15
|
var _LineChart = require("./LineChart.plugins");
|
|
16
|
-
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar"];
|
|
16
|
+
const _excluded = ["xAxis", "yAxis", "series", "width", "height", "margin", "colors", "dataset", "sx", "onAreaClick", "onLineClick", "onMarkClick", "axisHighlight", "disableLineItemHighlight", "hideLegend", "grid", "children", "slots", "slotProps", "skipAnimation", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar", "brushConfig"];
|
|
17
17
|
/**
|
|
18
18
|
* A helper function that extracts LineChartProps from the input props
|
|
19
19
|
* and returns an object with props for the children components of LineChart.
|
|
@@ -45,7 +45,8 @@ const useLineChartProps = props => {
|
|
|
45
45
|
loading,
|
|
46
46
|
highlightedItem,
|
|
47
47
|
onHighlightChange,
|
|
48
|
-
className
|
|
48
|
+
className,
|
|
49
|
+
brushConfig
|
|
49
50
|
} = props,
|
|
50
51
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
51
52
|
const id = (0, _useId.default)();
|
|
@@ -74,6 +75,7 @@ const useLineChartProps = props => {
|
|
|
74
75
|
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
75
76
|
className,
|
|
76
77
|
skipAnimation,
|
|
78
|
+
brushConfig,
|
|
77
79
|
plugins: _LineChart.LINE_CHART_PLUGINS
|
|
78
80
|
});
|
|
79
81
|
const gridProps = {
|
|
@@ -87,6 +87,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
87
87
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
88
88
|
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
89
89
|
}),
|
|
90
|
+
/**
|
|
91
|
+
* Configuration for the brush interaction.
|
|
92
|
+
*/
|
|
93
|
+
brushConfig: _propTypes.default.shape({
|
|
94
|
+
enabled: _propTypes.default.bool,
|
|
95
|
+
preventHighlight: _propTypes.default.bool,
|
|
96
|
+
preventTooltip: _propTypes.default.bool
|
|
97
|
+
}),
|
|
90
98
|
children: _propTypes.default.node,
|
|
91
99
|
className: _propTypes.default.string,
|
|
92
100
|
/**
|
|
@@ -5,5 +5,6 @@ import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/
|
|
|
5
5
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
6
6
|
import { UseChartClosestPointSignature } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
7
7
|
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
8
|
-
|
|
8
|
+
import { UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
9
|
+
export type ScatterChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature];
|
|
9
10
|
export declare const SCATTER_CHART_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartPluginSignatures>;
|
|
@@ -10,4 +10,5 @@ var _useChartInteraction = require("../internals/plugins/featurePlugins/useChart
|
|
|
10
10
|
var _useChartHighlight = require("../internals/plugins/featurePlugins/useChartHighlight");
|
|
11
11
|
var _useChartClosestPoint = require("../internals/plugins/featurePlugins/useChartClosestPoint");
|
|
12
12
|
var _useChartKeyboardNavigation = require("../internals/plugins/featurePlugins/useChartKeyboardNavigation");
|
|
13
|
-
|
|
13
|
+
var _useChartBrush = require("../internals/plugins/featurePlugins/useChartBrush");
|
|
14
|
+
const SCATTER_CHART_PLUGINS = exports.SCATTER_CHART_PLUGINS = [_useChartZAxis.useChartZAxis, _useChartBrush.useChartBrush, _useChartCartesianAxis.useChartCartesianAxis, _useChartInteraction.useChartInteraction, _useChartHighlight.useChartHighlight, _useChartClosestPoint.useChartClosestPoint, _useChartKeyboardNavigation.useChartKeyboardNavigation];
|
|
@@ -12,7 +12,7 @@ const seriesProcessor = ({
|
|
|
12
12
|
}, dataset) => {
|
|
13
13
|
const completeSeries = Object.fromEntries(Object.entries(series).map(([seriesId, seriesData]) => {
|
|
14
14
|
const datasetKeys = seriesData?.datasetKeys;
|
|
15
|
-
const missingKeys = ['x', 'y'
|
|
15
|
+
const missingKeys = ['x', 'y'].filter(key => typeof datasetKeys?.[key] !== 'string');
|
|
16
16
|
if (seriesData?.datasetKeys && missingKeys.length > 0) {
|
|
17
17
|
throw new Error([`MUI X Charts: scatter series with id='${seriesId}' has incomplete datasetKeys.`, `Properties ${missingKeys.map(key => `"${key}"`).join(', ')} are missing.`].join('\n'));
|
|
18
18
|
}
|
|
@@ -11,7 +11,7 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _ScatterChart = require("./ScatterChart.plugins");
|
|
14
|
-
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar", "renderer"];
|
|
14
|
+
const _excluded = ["xAxis", "yAxis", "zAxis", "series", "axisHighlight", "voronoiMaxRadius", "disableVoronoi", "hideLegend", "width", "height", "margin", "colors", "sx", "grid", "onItemClick", "children", "slots", "slotProps", "loading", "highlightedItem", "onHighlightChange", "className", "showToolbar", "renderer", "brushConfig"];
|
|
15
15
|
/**
|
|
16
16
|
* A helper function that extracts ScatterChartProps from the input props
|
|
17
17
|
* and returns an object with props for the children components of ScatterChart.
|
|
@@ -42,7 +42,8 @@ const useScatterChartProps = props => {
|
|
|
42
42
|
highlightedItem,
|
|
43
43
|
onHighlightChange,
|
|
44
44
|
className,
|
|
45
|
-
renderer
|
|
45
|
+
renderer,
|
|
46
|
+
brushConfig
|
|
46
47
|
} = props,
|
|
47
48
|
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
48
49
|
const seriesWithDefault = React.useMemo(() => series.map(s => (0, _extends2.default)({
|
|
@@ -66,7 +67,8 @@ const useScatterChartProps = props => {
|
|
|
66
67
|
className,
|
|
67
68
|
plugins: _ScatterChart.SCATTER_CHART_PLUGINS,
|
|
68
69
|
slots,
|
|
69
|
-
slotProps
|
|
70
|
+
slotProps,
|
|
71
|
+
brushConfig
|
|
70
72
|
});
|
|
71
73
|
const chartsAxisProps = {
|
|
72
74
|
slots,
|
|
@@ -186,6 +186,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
186
186
|
* @default 0
|
|
187
187
|
*/
|
|
188
188
|
baseline: _propTypes.default.oneOfType([_propTypes.default.oneOf(['max', 'min']), _propTypes.default.number]),
|
|
189
|
+
/**
|
|
190
|
+
* Configuration for the brush interaction.
|
|
191
|
+
*/
|
|
192
|
+
brushConfig: _propTypes.default.shape({
|
|
193
|
+
enabled: _propTypes.default.bool,
|
|
194
|
+
preventHighlight: _propTypes.default.bool,
|
|
195
|
+
preventTooltip: _propTypes.default.bool
|
|
196
|
+
}),
|
|
189
197
|
children: _propTypes.default.node,
|
|
190
198
|
className: _propTypes.default.string,
|
|
191
199
|
/**
|
package/esm/BarChart/BarChart.js
CHANGED
|
@@ -94,6 +94,14 @@ process.env.NODE_ENV !== "production" ? BarChart.propTypes = {
|
|
|
94
94
|
* Defines the border radius of the bar element.
|
|
95
95
|
*/
|
|
96
96
|
borderRadius: PropTypes.number,
|
|
97
|
+
/**
|
|
98
|
+
* Configuration for the brush interaction.
|
|
99
|
+
*/
|
|
100
|
+
brushConfig: PropTypes.shape({
|
|
101
|
+
enabled: PropTypes.bool,
|
|
102
|
+
preventHighlight: PropTypes.bool,
|
|
103
|
+
preventTooltip: PropTypes.bool
|
|
104
|
+
}),
|
|
97
105
|
children: PropTypes.node,
|
|
98
106
|
className: PropTypes.string,
|
|
99
107
|
/**
|
|
@@ -4,5 +4,6 @@ import { UseChartInteractionSignature } from "../internals/plugins/featurePlugin
|
|
|
4
4
|
import { UseChartHighlightSignature } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
5
|
import { UseChartKeyboardNavigationSignature } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
6
|
import { ConvertSignaturesIntoPlugins } from "../internals/plugins/models/helpers.js";
|
|
7
|
-
|
|
7
|
+
import { UseChartBrushSignature } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
8
|
+
export type BarChartPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature];
|
|
8
9
|
export declare const BAR_CHART_PLUGINS: ConvertSignaturesIntoPlugins<BarChartPluginSignatures>;
|
|
@@ -3,4 +3,5 @@ import { useChartCartesianAxis } from "../internals/plugins/featurePlugins/useCh
|
|
|
3
3
|
import { useChartInteraction } from "../internals/plugins/featurePlugins/useChartInteraction/index.js";
|
|
4
4
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
5
|
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
6
|
-
|
|
6
|
+
import { useChartBrush } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
7
|
+
export const BAR_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation];
|