@mui/x-charts-pro 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/BarChartPro/BarChartPro.js +8 -0
- package/BarChartPro/BarChartPro.plugins.d.ts +2 -2
- package/BarChartPro/BarChartPro.plugins.js +1 -1
- package/CHANGELOG.md +202 -0
- package/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/ChartsBrushOverlay/index.d.ts +1 -0
- package/ChartsBrushOverlay/index.js +16 -0
- package/LineChartPro/LineChartPro.js +8 -0
- package/LineChartPro/LineChartPro.plugins.d.ts +2 -2
- package/LineChartPro/LineChartPro.plugins.js +1 -1
- package/SankeyChart/SankeyChart.d.ts +1 -1
- package/SankeyChart/SankeyChart.js +30 -0
- package/SankeyChart/SankeyChart.plugins.d.ts +3 -2
- package/SankeyChart/SankeyChart.plugins.js +2 -1
- package/SankeyChart/SankeyLinkElement.d.ts +1 -1
- package/SankeyChart/SankeyLinkElement.js +15 -2
- package/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/SankeyChart/SankeyNodeElement.js +16 -1
- package/SankeyChart/SankeyPlot.js +13 -1
- package/SankeyChart/plugins/index.d.ts +3 -0
- package/SankeyChart/plugins/index.js +49 -0
- package/SankeyChart/plugins/useSankeyHighlight.d.ts +7 -0
- package/SankeyChart/plugins/useSankeyHighlight.js +76 -0
- package/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +68 -0
- package/SankeyChart/plugins/useSankeyHighlight.selectors.js +126 -0
- package/SankeyChart/plugins/useSankeyHighlight.types.d.ts +55 -0
- package/SankeyChart/plugins/useSankeyHighlight.types.js +5 -0
- package/SankeyChart/sankey.highlight.types.d.ts +42 -0
- package/SankeyChart/sankey.highlight.types.js +6 -0
- package/SankeyChart/sankey.types.d.ts +3 -2
- package/SankeyChart/sankeyClasses.d.ts +1 -1
- package/SankeyChart/useSankeyChartProps.js +5 -5
- package/ScatterChartPro/ScatterChartPro.js +8 -0
- package/ScatterChartPro/ScatterChartPro.plugins.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.plugins.js +1 -1
- package/esm/BarChartPro/BarChartPro.js +8 -0
- package/esm/BarChartPro/BarChartPro.plugins.d.ts +2 -2
- package/esm/BarChartPro/BarChartPro.plugins.js +2 -2
- package/esm/ChartDataProviderPro/ChartDataProviderPro.js +1 -1
- package/esm/ChartsBrushOverlay/index.d.ts +1 -0
- package/esm/ChartsBrushOverlay/index.js +2 -0
- package/esm/LineChartPro/LineChartPro.js +8 -0
- package/esm/LineChartPro/LineChartPro.plugins.d.ts +2 -2
- package/esm/LineChartPro/LineChartPro.plugins.js +2 -2
- package/esm/SankeyChart/SankeyChart.d.ts +1 -1
- package/esm/SankeyChart/SankeyChart.js +30 -0
- package/esm/SankeyChart/SankeyChart.plugins.d.ts +3 -2
- package/esm/SankeyChart/SankeyChart.plugins.js +3 -4
- package/esm/SankeyChart/SankeyLinkElement.d.ts +1 -1
- package/esm/SankeyChart/SankeyLinkElement.js +16 -3
- package/esm/SankeyChart/SankeyNodeElement.d.ts +1 -1
- package/esm/SankeyChart/SankeyNodeElement.js +17 -2
- package/esm/SankeyChart/SankeyPlot.js +15 -3
- package/esm/SankeyChart/plugins/index.d.ts +3 -0
- package/esm/SankeyChart/plugins/index.js +3 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.d.ts +7 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.js +68 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.d.ts +68 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.selectors.js +120 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.types.d.ts +55 -0
- package/esm/SankeyChart/plugins/useSankeyHighlight.types.js +1 -0
- package/esm/SankeyChart/sankey.highlight.types.d.ts +42 -0
- package/esm/SankeyChart/sankey.highlight.types.js +3 -0
- package/esm/SankeyChart/sankey.types.d.ts +3 -2
- package/esm/SankeyChart/sankeyClasses.d.ts +1 -1
- package/esm/SankeyChart/useSankeyChartProps.js +5 -5
- package/esm/ScatterChartPro/ScatterChartPro.js +8 -0
- package/esm/ScatterChartPro/ScatterChartPro.plugins.d.ts +2 -2
- package/esm/ScatterChartPro/ScatterChartPro.plugins.js +2 -2
- package/esm/index.js +1 -1
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +1 -1
- package/esm/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +1 -1
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoom.utils.d.ts +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoom.utils.js +8 -5
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +2 -2
- package/esm/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +2 -2
- package/esm/tests/constants.js +1 -0
- package/index.js +1 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnDrag.js +1 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnPressAndDrag.js +1 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoom.utils.d.ts +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoom.utils.js +8 -5
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnPinch.js +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnTapAndDrag.js +2 -2
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +2 -2
- package/package.json +5 -5
- package/tests/constants.js +7 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
1
|
+
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseChartBrushSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
2
2
|
import { UseChartProExportSignature } from "../internals/plugins/useChartProExport/index.js";
|
|
3
3
|
import { UseChartProZoomSignature } from "../internals/plugins/useChartProZoom/index.js";
|
|
4
|
-
export type ScatterChartProPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
4
|
+
export type ScatterChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'scatter'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartClosestPointSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
5
5
|
export declare const SCATTER_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<ScatterChartProPluginSignatures>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation } from '@mui/x-charts/internals';
|
|
1
|
+
import { useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation, useChartBrush } from '@mui/x-charts/internals';
|
|
2
2
|
import { useChartProExport } from "../internals/plugins/useChartProExport/index.js";
|
|
3
3
|
import { useChartProZoom } from "../internals/plugins/useChartProZoom/index.js";
|
|
4
|
-
export const SCATTER_CHART_PRO_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation, useChartProZoom, useChartProExport];
|
|
4
|
+
export const SCATTER_CHART_PRO_PLUGINS = [useChartZAxis, useChartBrush, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartClosestPoint, useChartKeyboardNavigation, useChartProZoom, useChartProExport];
|
package/esm/index.js
CHANGED
|
@@ -14,7 +14,7 @@ export const usePanOnDrag = ({
|
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
15
|
const startRef = React.useRef(null);
|
|
16
16
|
const config = useSelector(store, selectorPanInteractionConfig, ['drag']);
|
|
17
|
-
const isPanOnDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && config || false, [optionsLookup, config]);
|
|
17
|
+
const isPanOnDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && Boolean(config) || false, [optionsLookup, config]);
|
|
18
18
|
React.useEffect(() => {
|
|
19
19
|
if (!isPanOnDragEnabled) {
|
|
20
20
|
return;
|
|
@@ -14,7 +14,7 @@ export const usePanOnPressAndDrag = ({
|
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
15
|
const startRef = React.useRef(null);
|
|
16
16
|
const config = useSelector(store, selectorPanInteractionConfig, ['pressAndDrag']);
|
|
17
|
-
const isPanOnPressAndDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && config || false, [optionsLookup, config]);
|
|
17
|
+
const isPanOnPressAndDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && Boolean(config) || false, [optionsLookup, config]);
|
|
18
18
|
React.useEffect(() => {
|
|
19
19
|
if (!isPanOnPressAndDragEnabled) {
|
|
20
20
|
return;
|
|
@@ -26,7 +26,7 @@ export declare function getHorizontalCenterRatio(point: {
|
|
|
26
26
|
}, area: {
|
|
27
27
|
left: number;
|
|
28
28
|
width: number;
|
|
29
|
-
}): number;
|
|
29
|
+
}, reverse?: boolean): number;
|
|
30
30
|
/**
|
|
31
31
|
* Get the ratio of the point in the vertical center of the area.
|
|
32
32
|
*/
|
|
@@ -36,7 +36,7 @@ export declare function getVerticalCenterRatio(point: {
|
|
|
36
36
|
}, area: {
|
|
37
37
|
top: number;
|
|
38
38
|
height: number;
|
|
39
|
-
}): number;
|
|
39
|
+
}, reverse?: boolean): number;
|
|
40
40
|
/**
|
|
41
41
|
* Translate the zoom data by a given movement.
|
|
42
42
|
*/
|
|
@@ -80,23 +80,25 @@ export function getWheelScaleRatio(event, step) {
|
|
|
80
80
|
/**
|
|
81
81
|
* Get the ratio of the point in the horizontal center of the area.
|
|
82
82
|
*/
|
|
83
|
-
export function getHorizontalCenterRatio(point, area) {
|
|
83
|
+
export function getHorizontalCenterRatio(point, area, reverse = false) {
|
|
84
84
|
const {
|
|
85
85
|
left,
|
|
86
86
|
width
|
|
87
87
|
} = area;
|
|
88
|
-
|
|
88
|
+
const ratio = (point.x - left) / width;
|
|
89
|
+
return reverse ? 1 - ratio : ratio;
|
|
89
90
|
}
|
|
90
91
|
|
|
91
92
|
/**
|
|
92
93
|
* Get the ratio of the point in the vertical center of the area.
|
|
93
94
|
*/
|
|
94
|
-
export function getVerticalCenterRatio(point, area) {
|
|
95
|
+
export function getVerticalCenterRatio(point, area, reverse = false) {
|
|
95
96
|
const {
|
|
96
97
|
top,
|
|
97
98
|
height
|
|
98
99
|
} = area;
|
|
99
|
-
|
|
100
|
+
const ratio = (top - point.y) / height + 1;
|
|
101
|
+
return reverse ? 1 - ratio : ratio;
|
|
100
102
|
}
|
|
101
103
|
|
|
102
104
|
/**
|
|
@@ -113,7 +115,8 @@ export function translateZoom(initialZoomData, movement, drawingArea, optionsLoo
|
|
|
113
115
|
const span = max - min;
|
|
114
116
|
const MIN_PERCENT = options.minStart;
|
|
115
117
|
const MAX_PERCENT = options.maxEnd;
|
|
116
|
-
const
|
|
118
|
+
const rawDisplacement = options.axisDirection === 'x' ? movement.x : movement.y;
|
|
119
|
+
const displacement = options.reverse ? -rawDisplacement : rawDisplacement;
|
|
117
120
|
const dimension = options.axisDirection === 'x' ? drawingArea.width : drawingArea.height;
|
|
118
121
|
let newMinPercent = min - displacement / dimension * span;
|
|
119
122
|
let newMaxPercent = max - displacement / dimension * span;
|
|
@@ -13,7 +13,7 @@ export const useZoomOnPinch = ({
|
|
|
13
13
|
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
15
|
const config = useSelector(store, selectorZoomInteractionConfig, ['pinch']);
|
|
16
|
-
const isZoomOnPinchEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && config || false, [optionsLookup, config]);
|
|
16
|
+
const isZoomOnPinchEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && Boolean(config) || false, [optionsLookup, config]);
|
|
17
17
|
React.useEffect(() => {
|
|
18
18
|
if (!isZoomOnPinchEnabled) {
|
|
19
19
|
return;
|
|
@@ -46,7 +46,7 @@ export const useZoomOnPinch = ({
|
|
|
46
46
|
clientX: event.detail.centroid.x,
|
|
47
47
|
clientY: event.detail.centroid.y
|
|
48
48
|
});
|
|
49
|
-
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
49
|
+
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea, option.reverse) : getVerticalCenterRatio(point, drawingArea, option.reverse);
|
|
50
50
|
const [newMinRange, newMaxRange] = zoomAtPoint(centerRatio, scaleRatio, zoom, option);
|
|
51
51
|
if (!isSpanValid(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
52
52
|
return zoom;
|
|
@@ -13,7 +13,7 @@ export const useZoomOnTapAndDrag = ({
|
|
|
13
13
|
const drawingArea = useSelector(store, selectorChartDrawingArea);
|
|
14
14
|
const optionsLookup = useSelector(store, selectorChartZoomOptionsLookup);
|
|
15
15
|
const config = useSelector(store, selectorZoomInteractionConfig, ['tapAndDrag']);
|
|
16
|
-
const isZoomOnTapAndDragEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && config || false, [optionsLookup, config]);
|
|
16
|
+
const isZoomOnTapAndDragEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && Boolean(config) || false, [optionsLookup, config]);
|
|
17
17
|
React.useEffect(() => {
|
|
18
18
|
if (!isZoomOnTapAndDragEnabled) {
|
|
19
19
|
return;
|
|
@@ -51,7 +51,7 @@ export const useZoomOnTapAndDrag = ({
|
|
|
51
51
|
clientX: event.detail.initialCentroid.x,
|
|
52
52
|
clientY: event.detail.initialCentroid.y
|
|
53
53
|
});
|
|
54
|
-
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
54
|
+
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea, option.reverse) : getVerticalCenterRatio(point, drawingArea, option.reverse);
|
|
55
55
|
const [newMinRange, newMaxRange] = zoomAtPoint(centerRatio, scaleRatio, zoom, option);
|
|
56
56
|
if (!isSpanValid(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
57
57
|
return zoom;
|
|
@@ -15,7 +15,7 @@ export const useZoomOnWheel = ({
|
|
|
15
15
|
const startedOutsideRef = React.useRef(false);
|
|
16
16
|
const startedOutsideTimeoutRef = React.useRef(null);
|
|
17
17
|
const config = useSelector(store, selectorZoomInteractionConfig, ['wheel']);
|
|
18
|
-
const isZoomOnWheelEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && config || false, [optionsLookup, config]);
|
|
18
|
+
const isZoomOnWheelEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && Boolean(config) || false, [optionsLookup, config]);
|
|
19
19
|
React.useEffect(() => {
|
|
20
20
|
if (!isZoomOnWheelEnabled) {
|
|
21
21
|
return;
|
|
@@ -59,7 +59,7 @@ export const useZoomOnWheel = ({
|
|
|
59
59
|
if (!option) {
|
|
60
60
|
return zoom;
|
|
61
61
|
}
|
|
62
|
-
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea) : getVerticalCenterRatio(point, drawingArea);
|
|
62
|
+
const centerRatio = option.axisDirection === 'x' ? getHorizontalCenterRatio(point, drawingArea, option.reverse) : getVerticalCenterRatio(point, drawingArea, option.reverse);
|
|
63
63
|
const {
|
|
64
64
|
scaleRatio,
|
|
65
65
|
isZoomIn
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export const CHART_SELECTOR = 'svg:not([aria-hidden="true"])';
|
package/index.js
CHANGED
|
@@ -20,7 +20,7 @@ const usePanOnDrag = ({
|
|
|
20
20
|
const optionsLookup = (0, _internals.useSelector)(store, _internals.selectorChartZoomOptionsLookup);
|
|
21
21
|
const startRef = React.useRef(null);
|
|
22
22
|
const config = (0, _internals.useSelector)(store, _ZoomInteractionConfig.selectorPanInteractionConfig, ['drag']);
|
|
23
|
-
const isPanOnDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && config || false, [optionsLookup, config]);
|
|
23
|
+
const isPanOnDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && Boolean(config) || false, [optionsLookup, config]);
|
|
24
24
|
React.useEffect(() => {
|
|
25
25
|
if (!isPanOnDragEnabled) {
|
|
26
26
|
return;
|
|
@@ -20,7 +20,7 @@ const usePanOnPressAndDrag = ({
|
|
|
20
20
|
const optionsLookup = (0, _internals.useSelector)(store, _internals.selectorChartZoomOptionsLookup);
|
|
21
21
|
const startRef = React.useRef(null);
|
|
22
22
|
const config = (0, _internals.useSelector)(store, _ZoomInteractionConfig.selectorPanInteractionConfig, ['pressAndDrag']);
|
|
23
|
-
const isPanOnPressAndDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && config || false, [optionsLookup, config]);
|
|
23
|
+
const isPanOnPressAndDragEnabled = React.useMemo(() => Object.values(optionsLookup).some(v => v.panning) && Boolean(config) || false, [optionsLookup, config]);
|
|
24
24
|
React.useEffect(() => {
|
|
25
25
|
if (!isPanOnPressAndDragEnabled) {
|
|
26
26
|
return;
|
|
@@ -26,7 +26,7 @@ export declare function getHorizontalCenterRatio(point: {
|
|
|
26
26
|
}, area: {
|
|
27
27
|
left: number;
|
|
28
28
|
width: number;
|
|
29
|
-
}): number;
|
|
29
|
+
}, reverse?: boolean): number;
|
|
30
30
|
/**
|
|
31
31
|
* Get the ratio of the point in the vertical center of the area.
|
|
32
32
|
*/
|
|
@@ -36,7 +36,7 @@ export declare function getVerticalCenterRatio(point: {
|
|
|
36
36
|
}, area: {
|
|
37
37
|
top: number;
|
|
38
38
|
height: number;
|
|
39
|
-
}): number;
|
|
39
|
+
}, reverse?: boolean): number;
|
|
40
40
|
/**
|
|
41
41
|
* Translate the zoom data by a given movement.
|
|
42
42
|
*/
|
|
@@ -93,23 +93,25 @@ function getWheelScaleRatio(event, step) {
|
|
|
93
93
|
/**
|
|
94
94
|
* Get the ratio of the point in the horizontal center of the area.
|
|
95
95
|
*/
|
|
96
|
-
function getHorizontalCenterRatio(point, area) {
|
|
96
|
+
function getHorizontalCenterRatio(point, area, reverse = false) {
|
|
97
97
|
const {
|
|
98
98
|
left,
|
|
99
99
|
width
|
|
100
100
|
} = area;
|
|
101
|
-
|
|
101
|
+
const ratio = (point.x - left) / width;
|
|
102
|
+
return reverse ? 1 - ratio : ratio;
|
|
102
103
|
}
|
|
103
104
|
|
|
104
105
|
/**
|
|
105
106
|
* Get the ratio of the point in the vertical center of the area.
|
|
106
107
|
*/
|
|
107
|
-
function getVerticalCenterRatio(point, area) {
|
|
108
|
+
function getVerticalCenterRatio(point, area, reverse = false) {
|
|
108
109
|
const {
|
|
109
110
|
top,
|
|
110
111
|
height
|
|
111
112
|
} = area;
|
|
112
|
-
|
|
113
|
+
const ratio = (top - point.y) / height + 1;
|
|
114
|
+
return reverse ? 1 - ratio : ratio;
|
|
113
115
|
}
|
|
114
116
|
|
|
115
117
|
/**
|
|
@@ -126,7 +128,8 @@ function translateZoom(initialZoomData, movement, drawingArea, optionsLookup) {
|
|
|
126
128
|
const span = max - min;
|
|
127
129
|
const MIN_PERCENT = options.minStart;
|
|
128
130
|
const MAX_PERCENT = options.maxEnd;
|
|
129
|
-
const
|
|
131
|
+
const rawDisplacement = options.axisDirection === 'x' ? movement.x : movement.y;
|
|
132
|
+
const displacement = options.reverse ? -rawDisplacement : rawDisplacement;
|
|
130
133
|
const dimension = options.axisDirection === 'x' ? drawingArea.width : drawingArea.height;
|
|
131
134
|
let newMinPercent = min - displacement / dimension * span;
|
|
132
135
|
let newMaxPercent = max - displacement / dimension * span;
|
|
@@ -19,7 +19,7 @@ const useZoomOnPinch = ({
|
|
|
19
19
|
const drawingArea = (0, _internals.useSelector)(store, _internals.selectorChartDrawingArea);
|
|
20
20
|
const optionsLookup = (0, _internals.useSelector)(store, _internals.selectorChartZoomOptionsLookup);
|
|
21
21
|
const config = (0, _internals.useSelector)(store, _ZoomInteractionConfig.selectorZoomInteractionConfig, ['pinch']);
|
|
22
|
-
const isZoomOnPinchEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && config || false, [optionsLookup, config]);
|
|
22
|
+
const isZoomOnPinchEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && Boolean(config) || false, [optionsLookup, config]);
|
|
23
23
|
React.useEffect(() => {
|
|
24
24
|
if (!isZoomOnPinchEnabled) {
|
|
25
25
|
return;
|
|
@@ -52,7 +52,7 @@ const useZoomOnPinch = ({
|
|
|
52
52
|
clientX: event.detail.centroid.x,
|
|
53
53
|
clientY: event.detail.centroid.y
|
|
54
54
|
});
|
|
55
|
-
const centerRatio = option.axisDirection === 'x' ? (0, _useZoom.getHorizontalCenterRatio)(point, drawingArea) : (0, _useZoom.getVerticalCenterRatio)(point, drawingArea);
|
|
55
|
+
const centerRatio = option.axisDirection === 'x' ? (0, _useZoom.getHorizontalCenterRatio)(point, drawingArea, option.reverse) : (0, _useZoom.getVerticalCenterRatio)(point, drawingArea, option.reverse);
|
|
56
56
|
const [newMinRange, newMaxRange] = (0, _useZoom.zoomAtPoint)(centerRatio, scaleRatio, zoom, option);
|
|
57
57
|
if (!(0, _useZoom.isSpanValid)(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
58
58
|
return zoom;
|
|
@@ -19,7 +19,7 @@ const useZoomOnTapAndDrag = ({
|
|
|
19
19
|
const drawingArea = (0, _internals.useSelector)(store, _internals.selectorChartDrawingArea);
|
|
20
20
|
const optionsLookup = (0, _internals.useSelector)(store, _internals.selectorChartZoomOptionsLookup);
|
|
21
21
|
const config = (0, _internals.useSelector)(store, _ZoomInteractionConfig.selectorZoomInteractionConfig, ['tapAndDrag']);
|
|
22
|
-
const isZoomOnTapAndDragEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && config || false, [optionsLookup, config]);
|
|
22
|
+
const isZoomOnTapAndDragEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && Boolean(config) || false, [optionsLookup, config]);
|
|
23
23
|
React.useEffect(() => {
|
|
24
24
|
if (!isZoomOnTapAndDragEnabled) {
|
|
25
25
|
return;
|
|
@@ -57,7 +57,7 @@ const useZoomOnTapAndDrag = ({
|
|
|
57
57
|
clientX: event.detail.initialCentroid.x,
|
|
58
58
|
clientY: event.detail.initialCentroid.y
|
|
59
59
|
});
|
|
60
|
-
const centerRatio = option.axisDirection === 'x' ? (0, _useZoom.getHorizontalCenterRatio)(point, drawingArea) : (0, _useZoom.getVerticalCenterRatio)(point, drawingArea);
|
|
60
|
+
const centerRatio = option.axisDirection === 'x' ? (0, _useZoom.getHorizontalCenterRatio)(point, drawingArea, option.reverse) : (0, _useZoom.getVerticalCenterRatio)(point, drawingArea, option.reverse);
|
|
61
61
|
const [newMinRange, newMaxRange] = (0, _useZoom.zoomAtPoint)(centerRatio, scaleRatio, zoom, option);
|
|
62
62
|
if (!(0, _useZoom.isSpanValid)(newMinRange, newMaxRange, isZoomIn, option)) {
|
|
63
63
|
return zoom;
|
|
@@ -21,7 +21,7 @@ const useZoomOnWheel = ({
|
|
|
21
21
|
const startedOutsideRef = React.useRef(false);
|
|
22
22
|
const startedOutsideTimeoutRef = React.useRef(null);
|
|
23
23
|
const config = (0, _internals.useSelector)(store, _ZoomInteractionConfig.selectorZoomInteractionConfig, ['wheel']);
|
|
24
|
-
const isZoomOnWheelEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && config || false, [optionsLookup, config]);
|
|
24
|
+
const isZoomOnWheelEnabled = React.useMemo(() => Object.keys(optionsLookup).length > 0 && Boolean(config) || false, [optionsLookup, config]);
|
|
25
25
|
React.useEffect(() => {
|
|
26
26
|
if (!isZoomOnWheelEnabled) {
|
|
27
27
|
return;
|
|
@@ -65,7 +65,7 @@ const useZoomOnWheel = ({
|
|
|
65
65
|
if (!option) {
|
|
66
66
|
return zoom;
|
|
67
67
|
}
|
|
68
|
-
const centerRatio = option.axisDirection === 'x' ? (0, _useZoom.getHorizontalCenterRatio)(point, drawingArea) : (0, _useZoom.getVerticalCenterRatio)(point, drawingArea);
|
|
68
|
+
const centerRatio = option.axisDirection === 'x' ? (0, _useZoom.getHorizontalCenterRatio)(point, drawingArea, option.reverse) : (0, _useZoom.getVerticalCenterRatio)(point, drawingArea, option.reverse);
|
|
69
69
|
const {
|
|
70
70
|
scaleRatio,
|
|
71
71
|
isZoomIn
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mui/x-charts-pro",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.15.0",
|
|
4
4
|
"author": "MUI Team",
|
|
5
5
|
"description": "The Pro plan edition of the MUI X Charts components.",
|
|
6
6
|
"license": "SEE LICENSE IN LICENSE",
|
|
@@ -31,11 +31,11 @@
|
|
|
31
31
|
"@mui/utils": "^7.3.3",
|
|
32
32
|
"clsx": "^2.1.1",
|
|
33
33
|
"prop-types": "^15.8.1",
|
|
34
|
-
"@mui/x-charts-vendor": "8.
|
|
35
|
-
"@mui/x-charts": "8.
|
|
34
|
+
"@mui/x-charts-vendor": "8.15.0",
|
|
35
|
+
"@mui/x-charts": "8.15.0",
|
|
36
|
+
"@mui/x-internal-gestures": "0.3.4",
|
|
36
37
|
"@mui/x-internals": "8.14.0",
|
|
37
|
-
"@mui/x-
|
|
38
|
-
"@mui/x-license": "8.14.0"
|
|
38
|
+
"@mui/x-license": "8.15.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@emotion/react": "^11.9.0",
|