@mui/x-charts-pro 8.14.1 → 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 +107 -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/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/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
|
@@ -125,6 +125,14 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
125
125
|
* Defines the border radius of the bar element.
|
|
126
126
|
*/
|
|
127
127
|
borderRadius: _propTypes.default.number,
|
|
128
|
+
/**
|
|
129
|
+
* Configuration for the brush interaction.
|
|
130
|
+
*/
|
|
131
|
+
brushConfig: _propTypes.default.shape({
|
|
132
|
+
enabled: _propTypes.default.bool,
|
|
133
|
+
preventHighlight: _propTypes.default.bool,
|
|
134
|
+
preventTooltip: _propTypes.default.bool
|
|
135
|
+
}),
|
|
128
136
|
children: _propTypes.default.node,
|
|
129
137
|
className: _propTypes.default.string,
|
|
130
138
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
1
|
+
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, 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 BarChartProPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
4
|
+
export type BarChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
5
5
|
export declare const BAR_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<BarChartProPluginSignatures>;
|
|
@@ -7,4 +7,4 @@ exports.BAR_CHART_PRO_PLUGINS = void 0;
|
|
|
7
7
|
var _internals = require("@mui/x-charts/internals");
|
|
8
8
|
var _useChartProExport = require("../internals/plugins/useChartProExport");
|
|
9
9
|
var _useChartProZoom = require("../internals/plugins/useChartProZoom");
|
|
10
|
-
const BAR_CHART_PRO_PLUGINS = exports.BAR_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _internals.useChartKeyboardNavigation, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
|
|
10
|
+
const BAR_CHART_PRO_PLUGINS = exports.BAR_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _internals.useChartKeyboardNavigation, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
|
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,113 @@
|
|
|
5
5
|
All notable changes to this project will be documented in this file.
|
|
6
6
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
7
7
|
|
|
8
|
+
## 8.15.0
|
|
9
|
+
|
|
10
|
+
_Oct 23, 2025_
|
|
11
|
+
|
|
12
|
+
We'd like to extend a big thank you to the 14 contributors who made this release possible. Here are some highlights ✨:
|
|
13
|
+
|
|
14
|
+
- 🖌️ Add new [`brush` charts interaction](https://mui.com/x/react-charts/brush/) for building custom behavior.
|
|
15
|
+

|
|
16
|
+
- ⚡️ Performance improvements for large bar charts
|
|
17
|
+
- 🤖 Data Grid AI assistant can now [visualize the query results](https://mui.com/x/react-data-grid/ai-assistant/#data-visualization) by controlling the chart integration settings
|
|
18
|
+
- 📦 DataGrid uses an internal MUI fork of ExcelJS that does not depend on vulnerable versions of NPM packages
|
|
19
|
+
- 🐞 Bugfixes
|
|
20
|
+
- 📚 Documentation improvements
|
|
21
|
+
|
|
22
|
+
Special thanks go out to the community members for their valuable contributions:
|
|
23
|
+
@ZagrebaAlex
|
|
24
|
+
|
|
25
|
+
The following are all team members who have contributed to this release:
|
|
26
|
+
@alexfauquette, @bernardobelchior, @cherniavskii, @flaviendelangle, @Janpot, @JCQuintas, @KenanYusuf, @prakhargupta1, @rita-codes, @siriwatknp, @arminmeh, @brijeshb42, @noraleonte
|
|
27
|
+
|
|
28
|
+
### Data Grid
|
|
29
|
+
|
|
30
|
+
#### `@mui/x-data-grid@8.15.0`
|
|
31
|
+
|
|
32
|
+
- [DataGrid] Fix `dataSource.fetchRows` API's return type (#20068) @arminmeh
|
|
33
|
+
|
|
34
|
+
#### `@mui/x-data-grid-pro@8.15.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
35
|
+
|
|
36
|
+
Same changes as in `@mui/x-data-grid@8.15.0`, plus:
|
|
37
|
+
|
|
38
|
+
- [DataGridPro] Keep children in the tree after parent row is re-fetched with the data source (#19934) @arminmeh
|
|
39
|
+
- [DataGridPro] Support scroll shadows customization (#19982) @KenanYusuf
|
|
40
|
+
|
|
41
|
+
#### `@mui/x-data-grid-premium@8.15.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
42
|
+
|
|
43
|
+
Same changes as in `@mui/x-data-grid-pro@8.15.0`, plus:
|
|
44
|
+
|
|
45
|
+
- [DataGridPremium] Use ExcelJS fork (#19796) @cherniavskii
|
|
46
|
+
- [DataGridPremium] Support data visualization in AI Assistant (#19831) @arminmeh
|
|
47
|
+
|
|
48
|
+
### Date and Time Pickers
|
|
49
|
+
|
|
50
|
+
#### `@mui/x-date-pickers@8.15.0`
|
|
51
|
+
|
|
52
|
+
Internal changes.
|
|
53
|
+
|
|
54
|
+
#### `@mui/x-date-pickers-pro@8.15.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
55
|
+
|
|
56
|
+
Same changes as in `@mui/x-date-pickers@8.15.0`.
|
|
57
|
+
|
|
58
|
+
### Charts
|
|
59
|
+
|
|
60
|
+
#### `@mui/x-charts@8.15.0`
|
|
61
|
+
|
|
62
|
+
- [charts] Add `ChartsBrushOverlay` and allow brush configuration (#19956) @JCQuintas
|
|
63
|
+
- [charts] Add `getStringSize` benchmark. Remove benchmarks from built package. (#19995) @bernardobelchior
|
|
64
|
+
- [charts] Batch string size measurement (#19994) @bernardobelchior
|
|
65
|
+
- [charts] Fix console issue (#20025) @JCQuintas
|
|
66
|
+
- [charts] Fix is[ZoomFeature]Enabled type (#20058) @alexfauquette
|
|
67
|
+
- [charts] Fix reference line middle spacing (#20004) @JCQuintas
|
|
68
|
+
- [charts] Improve `getStringSize` and `batchMeasureStrings` performance (#19996) @bernardobelchior
|
|
69
|
+
- [charts] Improve deep export script (#20007) @JCQuintas
|
|
70
|
+
- [charts] Improve string measurement benchmarks (#19999) @bernardobelchior
|
|
71
|
+
- [charts] Measure string sizes using SVG elements (#19981) @bernardobelchior
|
|
72
|
+
- [l10n] Improve Greek (gr-GR) locale (#20060) @ZagrebaAlex
|
|
73
|
+
|
|
74
|
+
#### `@mui/x-charts-pro@8.15.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
75
|
+
|
|
76
|
+
Same changes as in `@mui/x-charts@8.15.0`, plus:
|
|
77
|
+
|
|
78
|
+
- [charts-pro] Fix pan with `axis.reverse` (#20031) @JCQuintas
|
|
79
|
+
|
|
80
|
+
#### `@mui/x-charts-premium@8.15.0` [](https://mui.com/r/x-premium-svg-link 'Premium plan')
|
|
81
|
+
|
|
82
|
+
Same changes as in `@mui/x-charts-pro@8.15.0`.
|
|
83
|
+
|
|
84
|
+
### Tree View
|
|
85
|
+
|
|
86
|
+
#### `@mui/x-tree-view@8.15.0`
|
|
87
|
+
|
|
88
|
+
- [tree view] Multi character type-ahead (#19942) @noraleonte
|
|
89
|
+
|
|
90
|
+
#### `@mui/x-tree-view-pro@8.15.0` [](https://mui.com/r/x-pro-svg-link 'Pro plan')
|
|
91
|
+
|
|
92
|
+
Same changes as in `@mui/x-tree-view@8.15.0`.
|
|
93
|
+
|
|
94
|
+
### Codemod
|
|
95
|
+
|
|
96
|
+
#### `@mui/x-codemod@8.14.0`
|
|
97
|
+
|
|
98
|
+
Internal changes.
|
|
99
|
+
|
|
100
|
+
### Docs
|
|
101
|
+
|
|
102
|
+
- [docs] Add overview section for scatter chart and heatmap (#19888) @prakhargupta1
|
|
103
|
+
- [docs] Add charts bell curve example (#20003) @JCQuintas
|
|
104
|
+
- [docs] Add grouped multiple fields for Data Grid row grouping recipe (#19964) @siriwatknp
|
|
105
|
+
- [docs] Add Data Grid loading state recipe (#19958) @siriwatknp
|
|
106
|
+
|
|
107
|
+
### Core
|
|
108
|
+
|
|
109
|
+
- [code-infra] Remove @mui/monorepo usage for react versioning (#19894) @Janpot
|
|
110
|
+
- [code-infra] Remove invalid `environment: 'browser'` from vitest browser config (#19993) @bernardobelchior
|
|
111
|
+
- [code-infra] Remove unused babel aliases (#19987) @Janpot
|
|
112
|
+
- [code-infra] Turn on all testing-library eslint rules (#19946) @brijeshb42
|
|
113
|
+
- [docs-infra] Fix broken hash link (#20062) @Janpot
|
|
114
|
+
|
|
8
115
|
## 8.14.1
|
|
9
116
|
|
|
10
117
|
_Oct 16, 2025_
|
|
@@ -18,7 +18,7 @@ var _material = require("../internals/material");
|
|
|
18
18
|
var _allPlugins = require("../internals/plugins/allPlugins");
|
|
19
19
|
var _useChartDataProviderProProps = require("./useChartDataProviderProProps");
|
|
20
20
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
const releaseInfo = "
|
|
21
|
+
const releaseInfo = "MTc2MTE3NzYwMDAwMA==";
|
|
22
22
|
const packageIdentifier = 'x-charts-pro';
|
|
23
23
|
/**
|
|
24
24
|
* Orchestrates the data providers for the chart components and hooks.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@mui/x-charts/ChartsBrushOverlay';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartsBrushOverlay = require("@mui/x-charts/ChartsBrushOverlay");
|
|
7
|
+
Object.keys(_ChartsBrushOverlay).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartsBrushOverlay[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartsBrushOverlay[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -117,6 +117,14 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
117
117
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
118
118
|
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
119
119
|
}),
|
|
120
|
+
/**
|
|
121
|
+
* Configuration for the brush interaction.
|
|
122
|
+
*/
|
|
123
|
+
brushConfig: _propTypes.default.shape({
|
|
124
|
+
enabled: _propTypes.default.bool,
|
|
125
|
+
preventHighlight: _propTypes.default.bool,
|
|
126
|
+
preventTooltip: _propTypes.default.bool
|
|
127
|
+
}),
|
|
120
128
|
children: _propTypes.default.node,
|
|
121
129
|
className: _propTypes.default.string,
|
|
122
130
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
1
|
+
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, 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 LineChartProPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
4
|
+
export type LineChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
5
5
|
export declare const LINE_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<LineChartProPluginSignatures>;
|
|
@@ -7,4 +7,4 @@ exports.LINE_CHART_PRO_PLUGINS = void 0;
|
|
|
7
7
|
var _internals = require("@mui/x-charts/internals");
|
|
8
8
|
var _useChartProExport = require("../internals/plugins/useChartProExport");
|
|
9
9
|
var _useChartProZoom = require("../internals/plugins/useChartProZoom");
|
|
10
|
-
const LINE_CHART_PRO_PLUGINS = exports.LINE_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _internals.useChartKeyboardNavigation, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
|
|
10
|
+
const LINE_CHART_PRO_PLUGINS = exports.LINE_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _internals.useChartKeyboardNavigation, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
|
|
@@ -111,6 +111,14 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
111
111
|
x: _propTypes.default.oneOf(['band', 'line', 'none']),
|
|
112
112
|
y: _propTypes.default.oneOf(['band', 'line', 'none'])
|
|
113
113
|
}),
|
|
114
|
+
/**
|
|
115
|
+
* Configuration for the brush interaction.
|
|
116
|
+
*/
|
|
117
|
+
brushConfig: _propTypes.default.shape({
|
|
118
|
+
enabled: _propTypes.default.bool,
|
|
119
|
+
preventHighlight: _propTypes.default.bool,
|
|
120
|
+
preventTooltip: _propTypes.default.bool
|
|
121
|
+
}),
|
|
114
122
|
children: _propTypes.default.node,
|
|
115
123
|
className: _propTypes.default.string,
|
|
116
124
|
/**
|
|
@@ -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>;
|
|
@@ -7,4 +7,4 @@ exports.SCATTER_CHART_PRO_PLUGINS = void 0;
|
|
|
7
7
|
var _internals = require("@mui/x-charts/internals");
|
|
8
8
|
var _useChartProExport = require("../internals/plugins/useChartProExport");
|
|
9
9
|
var _useChartProZoom = require("../internals/plugins/useChartProZoom");
|
|
10
|
-
const SCATTER_CHART_PRO_PLUGINS = exports.SCATTER_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _internals.useChartClosestPoint, _internals.useChartKeyboardNavigation, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
|
|
10
|
+
const SCATTER_CHART_PRO_PLUGINS = exports.SCATTER_CHART_PRO_PLUGINS = [_internals.useChartZAxis, _internals.useChartBrush, _internals.useChartCartesianAxis, _internals.useChartInteraction, _internals.useChartHighlight, _internals.useChartClosestPoint, _internals.useChartKeyboardNavigation, _useChartProZoom.useChartProZoom, _useChartProExport.useChartProExport];
|
|
@@ -118,6 +118,14 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
118
118
|
* Defines the border radius of the bar element.
|
|
119
119
|
*/
|
|
120
120
|
borderRadius: PropTypes.number,
|
|
121
|
+
/**
|
|
122
|
+
* Configuration for the brush interaction.
|
|
123
|
+
*/
|
|
124
|
+
brushConfig: PropTypes.shape({
|
|
125
|
+
enabled: PropTypes.bool,
|
|
126
|
+
preventHighlight: PropTypes.bool,
|
|
127
|
+
preventTooltip: PropTypes.bool
|
|
128
|
+
}),
|
|
121
129
|
children: PropTypes.node,
|
|
122
130
|
className: PropTypes.string,
|
|
123
131
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
1
|
+
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, 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 BarChartProPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
4
|
+
export type BarChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'bar'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
5
5
|
export declare const BAR_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<BarChartProPluginSignatures>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation } from '@mui/x-charts/internals';
|
|
1
|
+
import { useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, 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 BAR_CHART_PRO_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation, useChartProZoom, useChartProExport];
|
|
4
|
+
export const BAR_CHART_PRO_PLUGINS = [useChartZAxis, useChartBrush, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation, useChartProZoom, useChartProExport];
|
|
@@ -11,7 +11,7 @@ import { defaultSlotsMaterial } from "../internals/material/index.js";
|
|
|
11
11
|
import { DEFAULT_PLUGINS } from "../internals/plugins/allPlugins.js";
|
|
12
12
|
import { useChartDataProviderProProps } from "./useChartDataProviderProProps.js";
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
-
const releaseInfo = "
|
|
14
|
+
const releaseInfo = "MTc2MTE3NzYwMDAwMA==";
|
|
15
15
|
const packageIdentifier = 'x-charts-pro';
|
|
16
16
|
/**
|
|
17
17
|
* Orchestrates the data providers for the chart components and hooks.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@mui/x-charts/ChartsBrushOverlay';
|
|
@@ -110,6 +110,14 @@ process.env.NODE_ENV !== "production" ? LineChartPro.propTypes = {
|
|
|
110
110
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
111
111
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
112
112
|
}),
|
|
113
|
+
/**
|
|
114
|
+
* Configuration for the brush interaction.
|
|
115
|
+
*/
|
|
116
|
+
brushConfig: PropTypes.shape({
|
|
117
|
+
enabled: PropTypes.bool,
|
|
118
|
+
preventHighlight: PropTypes.bool,
|
|
119
|
+
preventTooltip: PropTypes.bool
|
|
120
|
+
}),
|
|
113
121
|
children: PropTypes.node,
|
|
114
122
|
className: PropTypes.string,
|
|
115
123
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, ConvertSignaturesIntoPlugins } from '@mui/x-charts/internals';
|
|
1
|
+
import { UseChartZAxisSignature, UseChartCartesianAxisSignature, UseChartInteractionSignature, UseChartHighlightSignature, 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 LineChartProPluginSignatures = [UseChartZAxisSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
4
|
+
export type LineChartProPluginSignatures = [UseChartZAxisSignature, UseChartBrushSignature, UseChartCartesianAxisSignature<'line'>, UseChartInteractionSignature, UseChartHighlightSignature, UseChartKeyboardNavigationSignature, UseChartProZoomSignature, UseChartProExportSignature];
|
|
5
5
|
export declare const LINE_CHART_PRO_PLUGINS: ConvertSignaturesIntoPlugins<LineChartProPluginSignatures>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation } from '@mui/x-charts/internals';
|
|
1
|
+
import { useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, 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 LINE_CHART_PRO_PLUGINS = [useChartZAxis, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation, useChartProZoom, useChartProExport];
|
|
4
|
+
export const LINE_CHART_PRO_PLUGINS = [useChartZAxis, useChartBrush, useChartCartesianAxis, useChartInteraction, useChartHighlight, useChartKeyboardNavigation, useChartProZoom, useChartProExport];
|
|
@@ -104,6 +104,14 @@ process.env.NODE_ENV !== "production" ? ScatterChartPro.propTypes = {
|
|
|
104
104
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
105
105
|
y: PropTypes.oneOf(['band', 'line', 'none'])
|
|
106
106
|
}),
|
|
107
|
+
/**
|
|
108
|
+
* Configuration for the brush interaction.
|
|
109
|
+
*/
|
|
110
|
+
brushConfig: PropTypes.shape({
|
|
111
|
+
enabled: PropTypes.bool,
|
|
112
|
+
preventHighlight: PropTypes.bool,
|
|
113
|
+
preventTooltip: PropTypes.bool
|
|
114
|
+
}),
|
|
107
115
|
children: PropTypes.node,
|
|
108
116
|
className: PropTypes.string,
|
|
109
117
|
/**
|
|
@@ -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": "8.
|
|
35
|
-
"@mui/x-charts
|
|
36
|
-
"@mui/x-internal-gestures": "0.3.
|
|
34
|
+
"@mui/x-charts-vendor": "8.15.0",
|
|
35
|
+
"@mui/x-charts": "8.15.0",
|
|
36
|
+
"@mui/x-internal-gestures": "0.3.4",
|
|
37
37
|
"@mui/x-internals": "8.14.0",
|
|
38
|
-
"@mui/x-license": "8.
|
|
38
|
+
"@mui/x-license": "8.15.0"
|
|
39
39
|
},
|
|
40
40
|
"peerDependencies": {
|
|
41
41
|
"@emotion/react": "^11.9.0",
|