@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
|
@@ -1,10 +1,14 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["className"];
|
|
4
6
|
import * as React from 'react';
|
|
5
7
|
import { arc as d3Arc } from '@mui/x-charts-vendor/d3-shape';
|
|
6
8
|
import { styled } from '@mui/material/styles';
|
|
9
|
+
import clsx from 'clsx';
|
|
7
10
|
import { useGaugeState } from "./GaugeProvider.js";
|
|
11
|
+
import { gaugeClasses } from "./gaugeClasses.js";
|
|
8
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
13
|
const StyledPath = styled('path', {
|
|
10
14
|
name: 'MuiGauge',
|
|
@@ -14,7 +18,11 @@ const StyledPath = styled('path', {
|
|
|
14
18
|
}) => ({
|
|
15
19
|
fill: (theme.vars || theme).palette.divider
|
|
16
20
|
}));
|
|
17
|
-
export function GaugeReferenceArc(
|
|
21
|
+
export function GaugeReferenceArc(_ref) {
|
|
22
|
+
let {
|
|
23
|
+
className
|
|
24
|
+
} = _ref,
|
|
25
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
18
26
|
const {
|
|
19
27
|
startAngle,
|
|
20
28
|
endAngle,
|
|
@@ -25,6 +33,7 @@ export function GaugeReferenceArc(props) {
|
|
|
25
33
|
cy
|
|
26
34
|
} = useGaugeState();
|
|
27
35
|
return /*#__PURE__*/_jsx(StyledPath, _extends({
|
|
36
|
+
className: clsx(gaugeClasses.referenceArc, className),
|
|
28
37
|
transform: `translate(${cx}, ${cy})`,
|
|
29
38
|
d: d3Arc().cornerRadius(cornerRadius)({
|
|
30
39
|
startAngle,
|
|
@@ -32,5 +41,5 @@ export function GaugeReferenceArc(props) {
|
|
|
32
41
|
innerRadius,
|
|
33
42
|
outerRadius
|
|
34
43
|
})
|
|
35
|
-
},
|
|
44
|
+
}, other));
|
|
36
45
|
}
|
|
@@ -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 {
|
|
@@ -1,24 +1,31 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
|
|
4
|
+
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
+
const _excluded = ["className"],
|
|
6
|
+
_excluded2 = ["cx", "cy", "startAngle", "endAngle", "cornerRadius", "innerRadius", "outerRadius", "skipAnimation"];
|
|
6
7
|
import * as React from 'react';
|
|
7
8
|
import PropTypes from 'prop-types';
|
|
8
9
|
import { styled } from '@mui/material/styles';
|
|
10
|
+
import clsx from 'clsx';
|
|
9
11
|
import { useSkipAnimation } from "../hooks/useSkipAnimation.js";
|
|
10
12
|
import { useAnimateGaugeValueArc } from "../hooks/animation/useAnimateGaugeValueArc.js";
|
|
11
13
|
import { useGaugeState } from "./GaugeProvider.js";
|
|
14
|
+
import { gaugeClasses } from "./gaugeClasses.js";
|
|
12
15
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
16
|
const StyledPath = styled('path', {
|
|
14
17
|
name: 'MuiGauge',
|
|
15
|
-
slot: '
|
|
18
|
+
slot: 'ValueArc'
|
|
16
19
|
})(({
|
|
17
20
|
theme
|
|
18
21
|
}) => ({
|
|
19
22
|
fill: (theme.vars || theme).palette.primary.main
|
|
20
23
|
}));
|
|
21
|
-
function GaugeValueArc(
|
|
24
|
+
function GaugeValueArc(_ref) {
|
|
25
|
+
let {
|
|
26
|
+
className
|
|
27
|
+
} = _ref,
|
|
28
|
+
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
22
29
|
const {
|
|
23
30
|
value,
|
|
24
31
|
valueMin,
|
|
@@ -35,7 +42,8 @@ function GaugeValueArc(props) {
|
|
|
35
42
|
return null;
|
|
36
43
|
}
|
|
37
44
|
const valueAngle = startAngle + (value - valueMin) / (valueMax - valueMin) * (endAngle - startAngle);
|
|
38
|
-
return /*#__PURE__*/_jsx(AnimatedGaugeValueArc, _extends({},
|
|
45
|
+
return /*#__PURE__*/_jsx(AnimatedGaugeValueArc, _extends({}, other, {
|
|
46
|
+
className: clsx(gaugeClasses.valueArc, className),
|
|
39
47
|
cx: cx,
|
|
40
48
|
cy: cy,
|
|
41
49
|
startAngle: startAngle,
|
|
@@ -53,7 +61,7 @@ process.env.NODE_ENV !== "production" ? GaugeValueArc.propTypes = {
|
|
|
53
61
|
skipAnimation: PropTypes.bool
|
|
54
62
|
} : void 0;
|
|
55
63
|
export { GaugeValueArc };
|
|
56
|
-
function AnimatedGaugeValueArc(
|
|
64
|
+
function AnimatedGaugeValueArc(_ref2) {
|
|
57
65
|
let {
|
|
58
66
|
cx,
|
|
59
67
|
cy,
|
|
@@ -63,8 +71,8 @@ function AnimatedGaugeValueArc(_ref) {
|
|
|
63
71
|
innerRadius,
|
|
64
72
|
outerRadius,
|
|
65
73
|
skipAnimation: inSkipAnimation
|
|
66
|
-
} =
|
|
67
|
-
other = _objectWithoutPropertiesLoose(
|
|
74
|
+
} = _ref2,
|
|
75
|
+
other = _objectWithoutPropertiesLoose(_ref2, _excluded2);
|
|
68
76
|
const skipAnimation = useSkipAnimation(inSkipAnimation);
|
|
69
77
|
const animatedProps = useAnimateGaugeValueArc({
|
|
70
78
|
startAngle,
|
|
@@ -5,8 +5,10 @@ import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWith
|
|
|
5
5
|
const _excluded = ["text", "className"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import clsx from 'clsx';
|
|
8
9
|
import { useGaugeState } from "./GaugeProvider.js";
|
|
9
10
|
import { ChartsText } from "../ChartsText/index.js";
|
|
11
|
+
import { gaugeClasses } from "./gaugeClasses.js";
|
|
10
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
11
13
|
function defaultFormatter({
|
|
12
14
|
value
|
|
@@ -35,7 +37,7 @@ function GaugeValueText(props) {
|
|
|
35
37
|
return null;
|
|
36
38
|
}
|
|
37
39
|
return /*#__PURE__*/_jsx("g", {
|
|
38
|
-
className: className,
|
|
40
|
+
className: clsx(gaugeClasses.valueText, className),
|
|
39
41
|
children: /*#__PURE__*/_jsx(ChartsText, _extends({
|
|
40
42
|
x: cx,
|
|
41
43
|
y: cy,
|
|
@@ -90,6 +90,14 @@ process.env.NODE_ENV !== "production" ? LineChart.propTypes = {
|
|
|
90
90
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
91
91
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
92
92
|
}),
|
|
93
|
+
/**
|
|
94
|
+
* Configuration for the brush interaction.
|
|
95
|
+
*/
|
|
96
|
+
brushConfig: PropTypes.shape({
|
|
97
|
+
enabled: PropTypes.bool,
|
|
98
|
+
preventHighlight: PropTypes.bool,
|
|
99
|
+
preventTooltip: PropTypes.bool
|
|
100
|
+
}),
|
|
93
101
|
children: PropTypes.node,
|
|
94
102
|
className: PropTypes.string,
|
|
95
103
|
/**
|
|
@@ -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>;
|
|
@@ -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 LINE_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation];
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
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"];
|
|
5
|
+
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"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import useId from '@mui/utils/useId';
|
|
8
8
|
import { DEFAULT_X_AXIS_KEY } from "../constants/index.js";
|
|
@@ -39,7 +39,8 @@ export const useLineChartProps = props => {
|
|
|
39
39
|
loading,
|
|
40
40
|
highlightedItem,
|
|
41
41
|
onHighlightChange,
|
|
42
|
-
className
|
|
42
|
+
className,
|
|
43
|
+
brushConfig
|
|
43
44
|
} = props,
|
|
44
45
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
45
46
|
const id = useId();
|
|
@@ -68,6 +69,7 @@ export const useLineChartProps = props => {
|
|
|
68
69
|
disableAxisListener: slotProps?.tooltip?.trigger !== 'axis' && axisHighlight?.x === 'none' && axisHighlight?.y === 'none',
|
|
69
70
|
className,
|
|
70
71
|
skipAnimation,
|
|
72
|
+
brushConfig,
|
|
71
73
|
plugins: LINE_CHART_PLUGINS
|
|
72
74
|
});
|
|
73
75
|
const gridProps = {
|
|
@@ -80,6 +80,14 @@ process.env.NODE_ENV !== "production" ? ScatterChart.propTypes = {
|
|
|
80
80
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
81
81
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
82
82
|
}),
|
|
83
|
+
/**
|
|
84
|
+
* Configuration for the brush interaction.
|
|
85
|
+
*/
|
|
86
|
+
brushConfig: PropTypes.shape({
|
|
87
|
+
enabled: PropTypes.bool,
|
|
88
|
+
preventHighlight: PropTypes.bool,
|
|
89
|
+
preventTooltip: PropTypes.bool
|
|
90
|
+
}),
|
|
83
91
|
children: PropTypes.node,
|
|
84
92
|
className: PropTypes.string,
|
|
85
93
|
/**
|
|
@@ -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>;
|
|
@@ -4,4 +4,5 @@ import { useChartInteraction } from "../internals/plugins/featurePlugins/useChar
|
|
|
4
4
|
import { useChartHighlight } from "../internals/plugins/featurePlugins/useChartHighlight/index.js";
|
|
5
5
|
import { useChartClosestPoint } from "../internals/plugins/featurePlugins/useChartClosestPoint/index.js";
|
|
6
6
|
import { useChartKeyboardNavigation } from "../internals/plugins/featurePlugins/useChartKeyboardNavigation/index.js";
|
|
7
|
-
|
|
7
|
+
import { useChartBrush } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
8
|
+
export const SCATTER_CHART_PLUGINS = [useChartZAxis, useChartBrush, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation];
|
|
@@ -5,7 +5,7 @@ const seriesProcessor = ({
|
|
|
5
5
|
}, dataset) => {
|
|
6
6
|
const completeSeries = Object.fromEntries(Object.entries(series).map(([seriesId, seriesData]) => {
|
|
7
7
|
const datasetKeys = seriesData?.datasetKeys;
|
|
8
|
-
const missingKeys = ['x', 'y'
|
|
8
|
+
const missingKeys = ['x', 'y'].filter(key => typeof datasetKeys?.[key] !== 'string');
|
|
9
9
|
if (seriesData?.datasetKeys && missingKeys.length > 0) {
|
|
10
10
|
throw new Error([`MUI X Charts: scatter series with id='${seriesId}' has incomplete datasetKeys.`, `Properties ${missingKeys.map(key => `"${key}"`).join(', ')} are missing.`].join('\n'));
|
|
11
11
|
}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
5
|
-
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"];
|
|
5
|
+
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"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import { SCATTER_CHART_PLUGINS } from "./ScatterChart.plugins.js";
|
|
8
8
|
/**
|
|
@@ -35,7 +35,8 @@ export const useScatterChartProps = props => {
|
|
|
35
35
|
highlightedItem,
|
|
36
36
|
onHighlightChange,
|
|
37
37
|
className,
|
|
38
|
-
renderer
|
|
38
|
+
renderer,
|
|
39
|
+
brushConfig
|
|
39
40
|
} = props,
|
|
40
41
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
41
42
|
const seriesWithDefault = React.useMemo(() => series.map(s => _extends({
|
|
@@ -59,7 +60,8 @@ export const useScatterChartProps = props => {
|
|
|
59
60
|
className,
|
|
60
61
|
plugins: SCATTER_CHART_PLUGINS,
|
|
61
62
|
slots,
|
|
62
|
-
slotProps
|
|
63
|
+
slotProps,
|
|
64
|
+
brushConfig
|
|
63
65
|
});
|
|
64
66
|
const chartsAxisProps = {
|
|
65
67
|
slots,
|
|
@@ -179,6 +179,14 @@ process.env.NODE_ENV !== "production" ? SparkLineChart.propTypes = {
|
|
|
179
179
|
* @default 0
|
|
180
180
|
*/
|
|
181
181
|
baseline: PropTypes.oneOfType([PropTypes.oneOf(['max', 'min']), PropTypes.number]),
|
|
182
|
+
/**
|
|
183
|
+
* Configuration for the brush interaction.
|
|
184
|
+
*/
|
|
185
|
+
brushConfig: PropTypes.shape({
|
|
186
|
+
enabled: PropTypes.bool,
|
|
187
|
+
preventHighlight: PropTypes.bool,
|
|
188
|
+
preventTooltip: PropTypes.bool
|
|
189
|
+
}),
|
|
182
190
|
children: PropTypes.node,
|
|
183
191
|
className: PropTypes.string,
|
|
184
192
|
/**
|
package/esm/hooks/index.d.ts
CHANGED
|
@@ -17,4 +17,5 @@ export * from "./useLegend.js";
|
|
|
17
17
|
export { useChartGradientId, useChartGradientIdObjectBound } from "./useChartGradientId.js";
|
|
18
18
|
export * from "./animation/index.js";
|
|
19
19
|
export * from "./useChartRootRef.js";
|
|
20
|
-
export * from "./useChartsLocalization.js";
|
|
20
|
+
export * from "./useChartsLocalization.js";
|
|
21
|
+
export * from "./useBrush.js";
|
package/esm/hooks/index.js
CHANGED
|
@@ -17,4 +17,5 @@ export * from "./useLegend.js";
|
|
|
17
17
|
export { useChartGradientId, useChartGradientIdObjectBound } from "./useChartGradientId.js";
|
|
18
18
|
export * from "./animation/index.js";
|
|
19
19
|
export * from "./useChartRootRef.js";
|
|
20
|
-
export * from "./useChartsLocalization.js";
|
|
20
|
+
export * from "./useChartsLocalization.js";
|
|
21
|
+
export * from "./useBrush.js";
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get the current brush state.
|
|
3
|
+
*
|
|
4
|
+
* - `start` is the starting point of the brush selection.
|
|
5
|
+
* - `current` is the current point of the brush selection.
|
|
6
|
+
*
|
|
7
|
+
* @returns `{ start, current }` - The brush state.
|
|
8
|
+
*/
|
|
9
|
+
export declare function useBrush(): {
|
|
10
|
+
start: {
|
|
11
|
+
x: number;
|
|
12
|
+
y: number;
|
|
13
|
+
};
|
|
14
|
+
current: {
|
|
15
|
+
x: number;
|
|
16
|
+
y: number;
|
|
17
|
+
};
|
|
18
|
+
} | null;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { selectorBrushState } from "../internals/plugins/featurePlugins/useChartBrush/index.js";
|
|
2
|
+
import { useSelector } from "../internals/store/useSelector.js";
|
|
3
|
+
import { useStore } from "../internals/store/useStore.js";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Get the current brush state.
|
|
7
|
+
*
|
|
8
|
+
* - `start` is the starting point of the brush selection.
|
|
9
|
+
* - `current` is the current point of the brush selection.
|
|
10
|
+
*
|
|
11
|
+
* @returns `{ start, current }` - The brush state.
|
|
12
|
+
*/
|
|
13
|
+
export function useBrush() {
|
|
14
|
+
const store = useStore();
|
|
15
|
+
return useSelector(store, selectorBrushState);
|
|
16
|
+
}
|
package/esm/index.d.ts
CHANGED
|
@@ -28,4 +28,5 @@ export { ChartContainer } from "./ChartContainer/index.js";
|
|
|
28
28
|
export type { ChartContainerProps } from "./ChartContainer/index.js";
|
|
29
29
|
export * from "./ChartDataProvider/index.js";
|
|
30
30
|
export * from "./Toolbar/index.js";
|
|
31
|
-
export * from "./ChartsWrapper/index.js";
|
|
31
|
+
export * from "./ChartsWrapper/index.js";
|
|
32
|
+
export * from "./ChartsBrushOverlay/index.js";
|
package/esm/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @mui/x-charts v8.
|
|
2
|
+
* @mui/x-charts v8.15.0
|
|
3
3
|
*
|
|
4
4
|
* @license MIT
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
@@ -35,6 +35,7 @@ export { ChartContainer } from "./ChartContainer/index.js";
|
|
|
35
35
|
export * from "./ChartDataProvider/index.js";
|
|
36
36
|
export * from "./Toolbar/index.js";
|
|
37
37
|
export * from "./ChartsWrapper/index.js";
|
|
38
|
+
export * from "./ChartsBrushOverlay/index.js";
|
|
38
39
|
|
|
39
40
|
// Locales should be imported from `@mui/x-charts/locales`
|
|
40
41
|
// export * from './locales';
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import FlatQueue from 'flatqueue';
|
|
2
|
+
type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor;
|
|
3
|
+
export declare class Flatbush {
|
|
4
|
+
_queue: FlatQueue<number>;
|
|
5
|
+
_boxes: TypedArrayConstructor;
|
|
6
|
+
_indices: Uint16Array | Uint32Array;
|
|
7
|
+
data: ArrayBufferLike;
|
|
8
|
+
numItems: number;
|
|
9
|
+
nodeSize: number;
|
|
10
|
+
_levelBounds: number[];
|
|
11
|
+
byteOffset: number;
|
|
12
|
+
/**
|
|
13
|
+
* Recreate a Flatbush index from raw `ArrayBuffer` or `SharedArrayBuffer` data.
|
|
14
|
+
* @param {ArrayBufferLike} data
|
|
15
|
+
* @param {number} [byteOffset=0] byte offset to the start of the Flatbush buffer in the referenced ArrayBuffer.
|
|
16
|
+
* @returns {Flatbush} index
|
|
17
|
+
*/
|
|
18
|
+
static from(data: any, byteOffset?: number): Flatbush;
|
|
19
|
+
/**
|
|
20
|
+
* Create a Flatbush index that will hold a given number of items.
|
|
21
|
+
* @param {number} numItems
|
|
22
|
+
* @param {number} [nodeSize=16] Size of the tree node (16 by default).
|
|
23
|
+
* @param {TypedArrayConstructor} [ArrayType=Float64Array] The array type used for coordinates storage (`Float64Array` by default).
|
|
24
|
+
* @param {ArrayBufferConstructor | SharedArrayBufferConstructor} [ArrayBufferType=ArrayBuffer] The array buffer type used to store data (`ArrayBuffer` by default).
|
|
25
|
+
* @param {ArrayBufferLike} [data] (Only used internally)
|
|
26
|
+
* @param {number} [byteOffset=0] (Only used internally)
|
|
27
|
+
*/
|
|
28
|
+
constructor(numItems: number, nodeSize?: number, ArrayType?: TypedArrayConstructor, ArrayBufferType?: ArrayBufferConstructor | SharedArrayBufferConstructor, data?: ArrayBufferLike, byteOffset?: number);
|
|
29
|
+
/**
|
|
30
|
+
* Add a given rectangle to the index.
|
|
31
|
+
* @param {number} minX
|
|
32
|
+
* @param {number} minY
|
|
33
|
+
* @param {number} maxX
|
|
34
|
+
* @param {number} maxY
|
|
35
|
+
* @returns {number} A zero-based, incremental number that represents the newly added rectangle.
|
|
36
|
+
*/
|
|
37
|
+
add(minX: any, minY: any, maxX?: any, maxY?: any): number;
|
|
38
|
+
/** Perform indexing of the added rectangles. */
|
|
39
|
+
finish(): void;
|
|
40
|
+
/**
|
|
41
|
+
* Search the index by a bounding box.
|
|
42
|
+
* @param {number} minX
|
|
43
|
+
* @param {number} minY
|
|
44
|
+
* @param {number} maxX
|
|
45
|
+
* @param {number} maxY
|
|
46
|
+
* @param {(index: number) => boolean} [filterFn] An optional function for filtering the results.
|
|
47
|
+
* @returns {number[]} An array containing the index, the x coordinate and the y coordinate of the points intersecting or touching the given bounding box.
|
|
48
|
+
*/
|
|
49
|
+
search(minX: number, minY: number, maxX: number, maxY: number, filterFn?: (index: number) => boolean): number[];
|
|
50
|
+
/**
|
|
51
|
+
* Search items in order of distance from the given point.
|
|
52
|
+
* @param x
|
|
53
|
+
* @param y
|
|
54
|
+
* @param [maxResults=Infinity]
|
|
55
|
+
* @param maxDistSq
|
|
56
|
+
* @param [filterFn] An optional function for filtering the results.
|
|
57
|
+
* @param [sqDistFn] An optional function to calculate squared distance from the point to the item.
|
|
58
|
+
* @returns {number[]} An array of indices of items found.
|
|
59
|
+
*/
|
|
60
|
+
neighbors(x: any, y: any, maxResults?: number, maxDistSq?: number, filterFn?: (index: number) => boolean, sqDistFn?: typeof sqDist): number[];
|
|
61
|
+
}
|
|
62
|
+
declare function sqDist(dx: number, dy: number): number;
|
|
63
|
+
export {};
|