@mui/x-charts-pro 9.0.0 → 9.0.2
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 +20 -1
- package/BarChartPro/BarChartPro.mjs +20 -1
- package/CHANGELOG.md +215 -6891
- package/ChartsDataProviderPro/ChartsDataProviderPro.js +2 -2
- package/ChartsDataProviderPro/ChartsDataProviderPro.mjs +2 -2
- package/ChartsRadialDataProvider/index.d.mts +1 -0
- package/ChartsRadialDataProvider/index.d.ts +1 -0
- package/ChartsRadialDataProvider/index.js +16 -0
- package/ChartsRadialDataProvider/index.mjs +2 -0
- package/ChartsRadialGrid/index.d.mts +1 -0
- package/ChartsRadialGrid/index.d.ts +1 -0
- package/ChartsRadialGrid/index.js +16 -0
- package/ChartsRadialGrid/index.mjs +2 -0
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.js +1 -0
- package/ChartsToolbarPro/ChartsToolbarImageExportTrigger.mjs +1 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.js +1 -0
- package/ChartsToolbarPro/ChartsToolbarPrintExportTrigger.mjs +1 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.mts +30 -0
- package/ChartsToolbarPro/ChartsToolbarPro.d.ts +30 -0
- package/ChartsToolbarPro/ChartsToolbarPro.js +66 -17
- package/ChartsToolbarPro/ChartsToolbarPro.mjs +66 -17
- package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.d.mts +41 -0
- package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.d.ts +41 -0
- package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.js +156 -0
- package/ChartsToolbarPro/ChartsToolbarRangeButtonTrigger.mjs +150 -0
- package/ChartsToolbarPro/ChartsToolbarZoomInTrigger.js +1 -1
- package/ChartsToolbarPro/ChartsToolbarZoomInTrigger.mjs +1 -1
- package/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.js +1 -1
- package/ChartsToolbarPro/ChartsToolbarZoomOutTrigger.mjs +1 -1
- package/ChartsToolbarPro/index.d.mts +1 -0
- package/ChartsToolbarPro/index.d.ts +1 -0
- package/ChartsToolbarPro/index.js +11 -0
- package/ChartsToolbarPro/index.mjs +1 -0
- package/ChartsToolbarPro/rangeButtonValueToZoom.d.mts +66 -0
- package/ChartsToolbarPro/rangeButtonValueToZoom.d.ts +66 -0
- package/ChartsToolbarPro/rangeButtonValueToZoom.js +217 -0
- package/ChartsToolbarPro/rangeButtonValueToZoom.mjs +212 -0
- package/Heatmap/Heatmap.js +4 -1
- package/Heatmap/Heatmap.mjs +4 -1
- package/LineChartPro/LineChartPro.js +20 -1
- package/LineChartPro/LineChartPro.mjs +20 -1
- package/ScatterChartPro/ScatterChartPro.js +20 -1
- package/ScatterChartPro/ScatterChartPro.mjs +20 -1
- package/index.js +1 -1
- package/index.mjs +1 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.js +1 -1
- package/internals/plugins/useChartProZoom/gestureHooks/usePanOnWheel.mjs +1 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.js +1 -1
- package/internals/plugins/useChartProZoom/gestureHooks/useZoomOnWheel.mjs +1 -1
- package/internals/plugins/useChartProZoom/useChartProZoom.js +13 -4
- package/internals/plugins/useChartProZoom/useChartProZoom.mjs +13 -4
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.mts +3 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +3 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +4 -3
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.mjs +3 -2
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.mts +10 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +10 -0
- package/models/seriesType/heatmap.d.mts +9 -1
- package/models/seriesType/heatmap.d.ts +9 -1
- package/package.json +45 -17
|
@@ -18,8 +18,8 @@ var _useChartsDataProviderProProps = require("./useChartsDataProviderProProps");
|
|
|
18
18
|
var _ChartsWatermark = require("../internals/ChartsWatermark");
|
|
19
19
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
20
20
|
const packageInfo = {
|
|
21
|
-
releaseDate: "
|
|
22
|
-
version: "9.0.
|
|
21
|
+
releaseDate: "MTc3NjIxMTIwMDAwMA==",
|
|
22
|
+
version: "9.0.2",
|
|
23
23
|
name: 'x-charts-pro'
|
|
24
24
|
};
|
|
25
25
|
const defaultSeriesConfigPro = exports.defaultSeriesConfigPro = _internals.defaultSeriesConfig;
|
|
@@ -11,8 +11,8 @@ import { useChartsDataProviderProProps } from "./useChartsDataProviderProProps.m
|
|
|
11
11
|
import { ChartsWatermark } from "../internals/ChartsWatermark.mjs";
|
|
12
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
13
|
const packageInfo = {
|
|
14
|
-
releaseDate: "
|
|
15
|
-
version: "9.0.
|
|
14
|
+
releaseDate: "MTc3NjIxMTIwMDAwMA==",
|
|
15
|
+
version: "9.0.2",
|
|
16
16
|
name: 'x-charts-pro'
|
|
17
17
|
};
|
|
18
18
|
export const defaultSeriesConfigPro = defaultSeriesConfig;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@mui/x-charts/ChartsRadialDataProvider';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@mui/x-charts/ChartsRadialDataProvider';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartsRadialDataProvider = require("@mui/x-charts/ChartsRadialDataProvider");
|
|
7
|
+
Object.keys(_ChartsRadialDataProvider).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartsRadialDataProvider[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartsRadialDataProvider[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@mui/x-charts/ChartsRadialGrid';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '@mui/x-charts/ChartsRadialGrid';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
var _ChartsRadialGrid = require("@mui/x-charts/ChartsRadialGrid");
|
|
7
|
+
Object.keys(_ChartsRadialGrid).forEach(function (key) {
|
|
8
|
+
if (key === "default" || key === "__esModule") return;
|
|
9
|
+
if (key in exports && exports[key] === _ChartsRadialGrid[key]) return;
|
|
10
|
+
Object.defineProperty(exports, key, {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () {
|
|
13
|
+
return _ChartsRadialGrid[key];
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
});
|
|
@@ -75,6 +75,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarImageExportTrigger.propType
|
|
|
75
75
|
* A function to customize the rendering of the component.
|
|
76
76
|
*/
|
|
77
77
|
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
78
|
+
size: _propTypes.default.oneOf(['large', 'medium', 'small']),
|
|
78
79
|
style: _propTypes.default.object,
|
|
79
80
|
tabIndex: _propTypes.default.number
|
|
80
81
|
} : void 0;
|
|
@@ -67,6 +67,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarImageExportTrigger.propType
|
|
|
67
67
|
* A function to customize the rendering of the component.
|
|
68
68
|
*/
|
|
69
69
|
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
70
|
+
size: PropTypes.oneOf(['large', 'medium', 'small']),
|
|
70
71
|
style: PropTypes.object,
|
|
71
72
|
tabIndex: PropTypes.number
|
|
72
73
|
} : void 0;
|
|
@@ -73,6 +73,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPrintExportTrigger.propType
|
|
|
73
73
|
* A function to customize the rendering of the component.
|
|
74
74
|
*/
|
|
75
75
|
render: _propTypes.default.oneOfType([_propTypes.default.element, _propTypes.default.func]),
|
|
76
|
+
size: _propTypes.default.oneOf(['large', 'medium', 'small']),
|
|
76
77
|
style: _propTypes.default.object,
|
|
77
78
|
tabIndex: _propTypes.default.number
|
|
78
79
|
} : void 0;
|
|
@@ -65,6 +65,7 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPrintExportTrigger.propType
|
|
|
65
65
|
* A function to customize the rendering of the component.
|
|
66
66
|
*/
|
|
67
67
|
render: PropTypes.oneOfType([PropTypes.element, PropTypes.func]),
|
|
68
|
+
size: PropTypes.oneOf(['large', 'medium', 'small']),
|
|
68
69
|
style: PropTypes.object,
|
|
69
70
|
tabIndex: PropTypes.number
|
|
70
71
|
} : void 0;
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import { type ChartsToolbarProps } from '@mui/x-charts/Toolbar';
|
|
2
|
+
import { type AxisId } from '@mui/x-charts/internals';
|
|
3
|
+
import { type RangeButtonValue } from "./rangeButtonValueToZoom.mjs";
|
|
2
4
|
import { type ChartsToolbarPrintExportOptions } from "./ChartsToolbarPrintExportTrigger.mjs";
|
|
3
5
|
import { type ChartsToolbarImageExportOptions } from "./ChartsToolbarImageExportTrigger.mjs";
|
|
6
|
+
export type { RangeButtonFunctionParams } from "./rangeButtonValueToZoom.mjs";
|
|
7
|
+
export interface RangeButtonConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The label displayed on the button (e.g., "1M", "3M", "1Y").
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* The range value.
|
|
14
|
+
*
|
|
15
|
+
* - `{ unit, step }` — A calendar interval from the end of the data (e.g., `{ unit: 'month', step: 3 }` for 3 months).
|
|
16
|
+
* - `[start, end]` — An absolute date range.
|
|
17
|
+
* - `(params) => { start, end }` — A function that receives axis context (`scaleType`, `data`, `domain`) and returns zoom percentages (0-100).
|
|
18
|
+
* - `null` — Resets zoom to show all data.
|
|
19
|
+
*/
|
|
20
|
+
value: RangeButtonValue;
|
|
21
|
+
}
|
|
4
22
|
export interface ChartsToolbarProProps extends ChartsToolbarProps {
|
|
5
23
|
printOptions?: ChartsToolbarPrintExportOptions;
|
|
6
24
|
imageExportOptions?: ChartsToolbarImageExportOptions[];
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for range buttons shown in the toolbar.
|
|
27
|
+
* Each button zooms the chart to a predefined time range from the end of the data.
|
|
28
|
+
*/
|
|
29
|
+
rangeButtons?: RangeButtonConfig[];
|
|
30
|
+
/**
|
|
31
|
+
* The axis ID to apply range buttons to.
|
|
32
|
+
* Defaults to the first x-axis with zoom enabled and a time scale.
|
|
33
|
+
*/
|
|
34
|
+
rangeButtonsAxisId?: AxisId;
|
|
7
35
|
}
|
|
8
36
|
/**
|
|
9
37
|
* The chart toolbar component for the pro package.
|
|
@@ -11,6 +39,8 @@ export interface ChartsToolbarProProps extends ChartsToolbarProps {
|
|
|
11
39
|
declare function ChartsToolbarPro({
|
|
12
40
|
printOptions,
|
|
13
41
|
imageExportOptions: rawImageExportOptions,
|
|
42
|
+
rangeButtons,
|
|
43
|
+
rangeButtonsAxisId,
|
|
14
44
|
...other
|
|
15
45
|
}: ChartsToolbarProProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
46
|
declare namespace ChartsToolbarPro {
|
|
@@ -1,9 +1,37 @@
|
|
|
1
1
|
import { type ChartsToolbarProps } from '@mui/x-charts/Toolbar';
|
|
2
|
+
import { type AxisId } from '@mui/x-charts/internals';
|
|
3
|
+
import { type RangeButtonValue } from "./rangeButtonValueToZoom.js";
|
|
2
4
|
import { type ChartsToolbarPrintExportOptions } from "./ChartsToolbarPrintExportTrigger.js";
|
|
3
5
|
import { type ChartsToolbarImageExportOptions } from "./ChartsToolbarImageExportTrigger.js";
|
|
6
|
+
export type { RangeButtonFunctionParams } from "./rangeButtonValueToZoom.js";
|
|
7
|
+
export interface RangeButtonConfig {
|
|
8
|
+
/**
|
|
9
|
+
* The label displayed on the button (e.g., "1M", "3M", "1Y").
|
|
10
|
+
*/
|
|
11
|
+
label: string;
|
|
12
|
+
/**
|
|
13
|
+
* The range value.
|
|
14
|
+
*
|
|
15
|
+
* - `{ unit, step }` — A calendar interval from the end of the data (e.g., `{ unit: 'month', step: 3 }` for 3 months).
|
|
16
|
+
* - `[start, end]` — An absolute date range.
|
|
17
|
+
* - `(params) => { start, end }` — A function that receives axis context (`scaleType`, `data`, `domain`) and returns zoom percentages (0-100).
|
|
18
|
+
* - `null` — Resets zoom to show all data.
|
|
19
|
+
*/
|
|
20
|
+
value: RangeButtonValue;
|
|
21
|
+
}
|
|
4
22
|
export interface ChartsToolbarProProps extends ChartsToolbarProps {
|
|
5
23
|
printOptions?: ChartsToolbarPrintExportOptions;
|
|
6
24
|
imageExportOptions?: ChartsToolbarImageExportOptions[];
|
|
25
|
+
/**
|
|
26
|
+
* Configuration for range buttons shown in the toolbar.
|
|
27
|
+
* Each button zooms the chart to a predefined time range from the end of the data.
|
|
28
|
+
*/
|
|
29
|
+
rangeButtons?: RangeButtonConfig[];
|
|
30
|
+
/**
|
|
31
|
+
* The axis ID to apply range buttons to.
|
|
32
|
+
* Defaults to the first x-axis with zoom enabled and a time scale.
|
|
33
|
+
*/
|
|
34
|
+
rangeButtonsAxisId?: AxisId;
|
|
7
35
|
}
|
|
8
36
|
/**
|
|
9
37
|
* The chart toolbar component for the pro package.
|
|
@@ -11,6 +39,8 @@ export interface ChartsToolbarProProps extends ChartsToolbarProps {
|
|
|
11
39
|
declare function ChartsToolbarPro({
|
|
12
40
|
printOptions,
|
|
13
41
|
imageExportOptions: rawImageExportOptions,
|
|
42
|
+
rangeButtons,
|
|
43
|
+
rangeButtonsAxisId,
|
|
14
44
|
...other
|
|
15
45
|
}: ChartsToolbarProProps): import("react/jsx-runtime").JSX.Element | null;
|
|
16
46
|
declare namespace ChartsToolbarPro {
|
|
@@ -11,6 +11,8 @@ var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends")
|
|
|
11
11
|
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
12
12
|
var React = _interopRequireWildcard(require("react"));
|
|
13
13
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
14
|
+
var _styles = require("@mui/material/styles");
|
|
15
|
+
var _ToggleButtonGroup = _interopRequireDefault(require("@mui/material/ToggleButtonGroup"));
|
|
14
16
|
var _Toolbar = require("@mui/x-charts/Toolbar");
|
|
15
17
|
var _internals = require("@mui/x-charts/internals");
|
|
16
18
|
var _hooks = require("@mui/x-charts/hooks");
|
|
@@ -20,13 +22,25 @@ var _ChartsMenu = require("./internals/ChartsMenu");
|
|
|
20
22
|
var _useChartProZoom = require("../internals/plugins/useChartProZoom");
|
|
21
23
|
var _ChartsToolbarZoomInTrigger = require("./ChartsToolbarZoomInTrigger");
|
|
22
24
|
var _ChartsToolbarZoomOutTrigger = require("./ChartsToolbarZoomOutTrigger");
|
|
25
|
+
var _ChartsToolbarRangeButtonTrigger = require("./ChartsToolbarRangeButtonTrigger");
|
|
23
26
|
var _ChartsToolbarPrintExportTrigger = require("./ChartsToolbarPrintExportTrigger");
|
|
24
27
|
var _ChartsToolbarImageExportTrigger = require("./ChartsToolbarImageExportTrigger");
|
|
25
28
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
26
|
-
const _excluded = ["printOptions", "imageExportOptions"];
|
|
29
|
+
const _excluded = ["printOptions", "imageExportOptions", "rangeButtons", "rangeButtonsAxisId"];
|
|
27
30
|
const DEFAULT_IMAGE_EXPORT_OPTIONS = [{
|
|
28
31
|
type: 'image/png'
|
|
29
32
|
}];
|
|
33
|
+
const RangeButtonGroup = (0, _styles.styled)(_ToggleButtonGroup.default, {
|
|
34
|
+
name: 'MuiChartsToolbarRangeButtons',
|
|
35
|
+
slot: 'Root'
|
|
36
|
+
})({
|
|
37
|
+
alignSelf: 'stretch',
|
|
38
|
+
'& .MuiToggleButton-root': {
|
|
39
|
+
fontSize: '0.75rem',
|
|
40
|
+
minWidth: 'unset',
|
|
41
|
+
border: 'none'
|
|
42
|
+
}
|
|
43
|
+
});
|
|
30
44
|
|
|
31
45
|
/**
|
|
32
46
|
* The chart toolbar component for the pro package.
|
|
@@ -34,7 +48,9 @@ const DEFAULT_IMAGE_EXPORT_OPTIONS = [{
|
|
|
34
48
|
function ChartsToolbarPro(_ref) {
|
|
35
49
|
let {
|
|
36
50
|
printOptions,
|
|
37
|
-
imageExportOptions: rawImageExportOptions
|
|
51
|
+
imageExportOptions: rawImageExportOptions,
|
|
52
|
+
rangeButtons,
|
|
53
|
+
rangeButtonsAxisId
|
|
38
54
|
} = _ref,
|
|
39
55
|
other = (0, _objectWithoutPropertiesLoose2.default)(_ref, _excluded);
|
|
40
56
|
const {
|
|
@@ -56,29 +72,46 @@ function ChartsToolbarPro(_ref) {
|
|
|
56
72
|
const showExportMenu = !printOptions?.disableToolbarButton || imageExportOptionList.length > 0;
|
|
57
73
|
const children = [];
|
|
58
74
|
if (isZoomEnabled) {
|
|
75
|
+
if (rangeButtons && rangeButtons.length > 0) {
|
|
76
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(RangeButtonGroup, {
|
|
77
|
+
exclusive: true,
|
|
78
|
+
size: "small",
|
|
79
|
+
children: rangeButtons.map(rangeButton => /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsToolbarRangeButtonTrigger.ChartsToolbarRangeButtonTrigger, {
|
|
80
|
+
value: rangeButton.value,
|
|
81
|
+
label: rangeButton.label,
|
|
82
|
+
axisId: rangeButtonsAxisId,
|
|
83
|
+
children: rangeButton.label
|
|
84
|
+
}, rangeButton.label))
|
|
85
|
+
}, "range-buttons"));
|
|
86
|
+
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsToolbarDivider.ChartsToolbarDivider, {}, "range-divider"));
|
|
87
|
+
}
|
|
59
88
|
const Tooltip = slots.baseTooltip;
|
|
60
89
|
const ZoomOutIcon = slots.zoomOutIcon;
|
|
61
90
|
const ZoomInIcon = slots.zoomInIcon;
|
|
62
91
|
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps.baseTooltip, {
|
|
63
92
|
title: localeText.zoomIn,
|
|
64
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
93
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
94
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsToolbarZoomInTrigger.ChartsToolbarZoomInTrigger, {
|
|
95
|
+
render: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toolbar.ToolbarButton, {
|
|
96
|
+
size: "small"
|
|
97
|
+
}),
|
|
98
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ZoomInIcon, (0, _extends2.default)({
|
|
99
|
+
fontSize: "small"
|
|
100
|
+
}, slotProps.zoomInIcon))
|
|
101
|
+
})
|
|
71
102
|
})
|
|
72
103
|
}), "zoom-in"));
|
|
73
104
|
children.push(/*#__PURE__*/(0, _jsxRuntime.jsx)(Tooltip, (0, _extends2.default)({}, slotProps.baseTooltip, {
|
|
74
105
|
title: localeText.zoomOut,
|
|
75
|
-
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
106
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
|
|
107
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsToolbarZoomOutTrigger.ChartsToolbarZoomOutTrigger, {
|
|
108
|
+
render: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Toolbar.ToolbarButton, {
|
|
109
|
+
size: "small"
|
|
110
|
+
}),
|
|
111
|
+
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ZoomOutIcon, (0, _extends2.default)({
|
|
112
|
+
fontSize: "small"
|
|
113
|
+
}, slotProps.zoomOutIcon))
|
|
114
|
+
})
|
|
82
115
|
})
|
|
83
116
|
}), "zoom-out"));
|
|
84
117
|
}
|
|
@@ -165,7 +198,23 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPro.propTypes = {
|
|
|
165
198
|
quality: _propTypes.default.number,
|
|
166
199
|
type: _propTypes.default.string.isRequired
|
|
167
200
|
})),
|
|
168
|
-
printOptions: _propTypes.default.object
|
|
201
|
+
printOptions: _propTypes.default.object,
|
|
202
|
+
/**
|
|
203
|
+
* Configuration for range buttons shown in the toolbar.
|
|
204
|
+
* Each button zooms the chart to a predefined time range from the end of the data.
|
|
205
|
+
*/
|
|
206
|
+
rangeButtons: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
207
|
+
label: _propTypes.default.string.isRequired,
|
|
208
|
+
value: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.instanceOf(Date).isRequired), _propTypes.default.func, _propTypes.default.shape({
|
|
209
|
+
step: _propTypes.default.number,
|
|
210
|
+
unit: _propTypes.default.oneOf(['day', 'hour', 'microsecond', 'millisecond', 'minute', 'month', 'second', 'week', 'year']).isRequired
|
|
211
|
+
})])
|
|
212
|
+
})),
|
|
213
|
+
/**
|
|
214
|
+
* The axis ID to apply range buttons to.
|
|
215
|
+
* Defaults to the first x-axis with zoom enabled and a time scale.
|
|
216
|
+
*/
|
|
217
|
+
rangeButtonsAxisId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
169
218
|
} : void 0;
|
|
170
219
|
function isHideMenuKey(key) {
|
|
171
220
|
return key === 'Tab' || key === 'Escape';
|
|
@@ -2,9 +2,11 @@
|
|
|
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 = ["printOptions", "imageExportOptions"];
|
|
5
|
+
const _excluded = ["printOptions", "imageExportOptions", "rangeButtons", "rangeButtonsAxisId"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
|
+
import { styled } from '@mui/material/styles';
|
|
9
|
+
import ToggleButtonGroup from '@mui/material/ToggleButtonGroup';
|
|
8
10
|
import { Toolbar, ToolbarButton } from '@mui/x-charts/Toolbar';
|
|
9
11
|
import { useChartsContext, useChartsSlots } from '@mui/x-charts/internals';
|
|
10
12
|
import { useChartsLocalization } from '@mui/x-charts/hooks';
|
|
@@ -14,12 +16,24 @@ import { ChartsMenu } from "./internals/ChartsMenu.mjs";
|
|
|
14
16
|
import { selectorChartZoomIsEnabled } from "../internals/plugins/useChartProZoom/index.mjs";
|
|
15
17
|
import { ChartsToolbarZoomInTrigger } from "./ChartsToolbarZoomInTrigger.mjs";
|
|
16
18
|
import { ChartsToolbarZoomOutTrigger } from "./ChartsToolbarZoomOutTrigger.mjs";
|
|
19
|
+
import { ChartsToolbarRangeButtonTrigger } from "./ChartsToolbarRangeButtonTrigger.mjs";
|
|
17
20
|
import { ChartsToolbarPrintExportTrigger } from "./ChartsToolbarPrintExportTrigger.mjs";
|
|
18
21
|
import { ChartsToolbarImageExportTrigger } from "./ChartsToolbarImageExportTrigger.mjs";
|
|
19
22
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
20
23
|
const DEFAULT_IMAGE_EXPORT_OPTIONS = [{
|
|
21
24
|
type: 'image/png'
|
|
22
25
|
}];
|
|
26
|
+
const RangeButtonGroup = styled(ToggleButtonGroup, {
|
|
27
|
+
name: 'MuiChartsToolbarRangeButtons',
|
|
28
|
+
slot: 'Root'
|
|
29
|
+
})({
|
|
30
|
+
alignSelf: 'stretch',
|
|
31
|
+
'& .MuiToggleButton-root': {
|
|
32
|
+
fontSize: '0.75rem',
|
|
33
|
+
minWidth: 'unset',
|
|
34
|
+
border: 'none'
|
|
35
|
+
}
|
|
36
|
+
});
|
|
23
37
|
|
|
24
38
|
/**
|
|
25
39
|
* The chart toolbar component for the pro package.
|
|
@@ -27,7 +41,9 @@ const DEFAULT_IMAGE_EXPORT_OPTIONS = [{
|
|
|
27
41
|
function ChartsToolbarPro(_ref) {
|
|
28
42
|
let {
|
|
29
43
|
printOptions,
|
|
30
|
-
imageExportOptions: rawImageExportOptions
|
|
44
|
+
imageExportOptions: rawImageExportOptions,
|
|
45
|
+
rangeButtons,
|
|
46
|
+
rangeButtonsAxisId
|
|
31
47
|
} = _ref,
|
|
32
48
|
other = _objectWithoutPropertiesLoose(_ref, _excluded);
|
|
33
49
|
const {
|
|
@@ -49,29 +65,46 @@ function ChartsToolbarPro(_ref) {
|
|
|
49
65
|
const showExportMenu = !printOptions?.disableToolbarButton || imageExportOptionList.length > 0;
|
|
50
66
|
const children = [];
|
|
51
67
|
if (isZoomEnabled) {
|
|
68
|
+
if (rangeButtons && rangeButtons.length > 0) {
|
|
69
|
+
children.push(/*#__PURE__*/_jsx(RangeButtonGroup, {
|
|
70
|
+
exclusive: true,
|
|
71
|
+
size: "small",
|
|
72
|
+
children: rangeButtons.map(rangeButton => /*#__PURE__*/_jsx(ChartsToolbarRangeButtonTrigger, {
|
|
73
|
+
value: rangeButton.value,
|
|
74
|
+
label: rangeButton.label,
|
|
75
|
+
axisId: rangeButtonsAxisId,
|
|
76
|
+
children: rangeButton.label
|
|
77
|
+
}, rangeButton.label))
|
|
78
|
+
}, "range-buttons"));
|
|
79
|
+
children.push(/*#__PURE__*/_jsx(ChartsToolbarDivider, {}, "range-divider"));
|
|
80
|
+
}
|
|
52
81
|
const Tooltip = slots.baseTooltip;
|
|
53
82
|
const ZoomOutIcon = slots.zoomOutIcon;
|
|
54
83
|
const ZoomInIcon = slots.zoomInIcon;
|
|
55
84
|
children.push(/*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps.baseTooltip, {
|
|
56
85
|
title: localeText.zoomIn,
|
|
57
|
-
children: /*#__PURE__*/_jsx(
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
86
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
87
|
+
children: /*#__PURE__*/_jsx(ChartsToolbarZoomInTrigger, {
|
|
88
|
+
render: /*#__PURE__*/_jsx(ToolbarButton, {
|
|
89
|
+
size: "small"
|
|
90
|
+
}),
|
|
91
|
+
children: /*#__PURE__*/_jsx(ZoomInIcon, _extends({
|
|
92
|
+
fontSize: "small"
|
|
93
|
+
}, slotProps.zoomInIcon))
|
|
94
|
+
})
|
|
64
95
|
})
|
|
65
96
|
}), "zoom-in"));
|
|
66
97
|
children.push(/*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps.baseTooltip, {
|
|
67
98
|
title: localeText.zoomOut,
|
|
68
|
-
children: /*#__PURE__*/_jsx(
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
99
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
100
|
+
children: /*#__PURE__*/_jsx(ChartsToolbarZoomOutTrigger, {
|
|
101
|
+
render: /*#__PURE__*/_jsx(ToolbarButton, {
|
|
102
|
+
size: "small"
|
|
103
|
+
}),
|
|
104
|
+
children: /*#__PURE__*/_jsx(ZoomOutIcon, _extends({
|
|
105
|
+
fontSize: "small"
|
|
106
|
+
}, slotProps.zoomOutIcon))
|
|
107
|
+
})
|
|
75
108
|
})
|
|
76
109
|
}), "zoom-out"));
|
|
77
110
|
}
|
|
@@ -158,7 +191,23 @@ process.env.NODE_ENV !== "production" ? ChartsToolbarPro.propTypes = {
|
|
|
158
191
|
quality: PropTypes.number,
|
|
159
192
|
type: PropTypes.string.isRequired
|
|
160
193
|
})),
|
|
161
|
-
printOptions: PropTypes.object
|
|
194
|
+
printOptions: PropTypes.object,
|
|
195
|
+
/**
|
|
196
|
+
* Configuration for range buttons shown in the toolbar.
|
|
197
|
+
* Each button zooms the chart to a predefined time range from the end of the data.
|
|
198
|
+
*/
|
|
199
|
+
rangeButtons: PropTypes.arrayOf(PropTypes.shape({
|
|
200
|
+
label: PropTypes.string.isRequired,
|
|
201
|
+
value: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.instanceOf(Date).isRequired), PropTypes.func, PropTypes.shape({
|
|
202
|
+
step: PropTypes.number,
|
|
203
|
+
unit: PropTypes.oneOf(['day', 'hour', 'microsecond', 'millisecond', 'minute', 'month', 'second', 'week', 'year']).isRequired
|
|
204
|
+
})])
|
|
205
|
+
})),
|
|
206
|
+
/**
|
|
207
|
+
* The axis ID to apply range buttons to.
|
|
208
|
+
* Defaults to the first x-axis with zoom enabled and a time scale.
|
|
209
|
+
*/
|
|
210
|
+
rangeButtonsAxisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
162
211
|
} : void 0;
|
|
163
212
|
export { ChartsToolbarPro };
|
|
164
213
|
function isHideMenuKey(key) {
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartsSlotProps, type AxisId } from '@mui/x-charts/internals';
|
|
3
|
+
import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
4
|
+
import { type RangeButtonValue } from "./rangeButtonValueToZoom.mjs";
|
|
5
|
+
export interface ChartsToolbarRangeButtonTriggerProps {
|
|
6
|
+
/**
|
|
7
|
+
* A function to customize the rendering of the component.
|
|
8
|
+
*/
|
|
9
|
+
render?: RenderProp<ChartsSlotProps['baseToggleButton']>;
|
|
10
|
+
/**
|
|
11
|
+
* The range value. Specifies how far back from the end of the data to zoom.
|
|
12
|
+
*
|
|
13
|
+
* - `{ unit, step }` — A calendar interval from the end of the data (e.g., `{ unit: 'month', step: 3 }` for 3 months).
|
|
14
|
+
* - `[start, end]` — An absolute date range.
|
|
15
|
+
* - `(params) => { start, end }` — A function that receives axis context (`scaleType`, `data`, `domain`) and returns zoom percentages (0-100).
|
|
16
|
+
* - `null` — Resets zoom to show all data.
|
|
17
|
+
*/
|
|
18
|
+
value: RangeButtonValue;
|
|
19
|
+
/**
|
|
20
|
+
* The axis ID to apply the range to.
|
|
21
|
+
* Defaults to the first x-axis with zoom enabled.
|
|
22
|
+
*/
|
|
23
|
+
axisId?: AxisId;
|
|
24
|
+
/**
|
|
25
|
+
* The label used to identify the button for active-state tracking.
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* The size of the button.
|
|
30
|
+
* @default 'small'
|
|
31
|
+
*/
|
|
32
|
+
size?: 'small' | 'medium' | 'large';
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A button that sets the chart zoom to a predefined range.
|
|
36
|
+
* It renders the `baseToggleButton` slot.
|
|
37
|
+
*/
|
|
38
|
+
declare const ChartsToolbarRangeButtonTrigger: React.ForwardRefExoticComponent<ChartsToolbarRangeButtonTriggerProps & {
|
|
39
|
+
children?: React.ReactNode | undefined;
|
|
40
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
export { ChartsToolbarRangeButtonTrigger };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ChartsSlotProps, type AxisId } from '@mui/x-charts/internals';
|
|
3
|
+
import { type RenderProp } from '@mui/x-internals/useComponentRenderer';
|
|
4
|
+
import { type RangeButtonValue } from "./rangeButtonValueToZoom.js";
|
|
5
|
+
export interface ChartsToolbarRangeButtonTriggerProps {
|
|
6
|
+
/**
|
|
7
|
+
* A function to customize the rendering of the component.
|
|
8
|
+
*/
|
|
9
|
+
render?: RenderProp<ChartsSlotProps['baseToggleButton']>;
|
|
10
|
+
/**
|
|
11
|
+
* The range value. Specifies how far back from the end of the data to zoom.
|
|
12
|
+
*
|
|
13
|
+
* - `{ unit, step }` — A calendar interval from the end of the data (e.g., `{ unit: 'month', step: 3 }` for 3 months).
|
|
14
|
+
* - `[start, end]` — An absolute date range.
|
|
15
|
+
* - `(params) => { start, end }` — A function that receives axis context (`scaleType`, `data`, `domain`) and returns zoom percentages (0-100).
|
|
16
|
+
* - `null` — Resets zoom to show all data.
|
|
17
|
+
*/
|
|
18
|
+
value: RangeButtonValue;
|
|
19
|
+
/**
|
|
20
|
+
* The axis ID to apply the range to.
|
|
21
|
+
* Defaults to the first x-axis with zoom enabled.
|
|
22
|
+
*/
|
|
23
|
+
axisId?: AxisId;
|
|
24
|
+
/**
|
|
25
|
+
* The label used to identify the button for active-state tracking.
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
/**
|
|
29
|
+
* The size of the button.
|
|
30
|
+
* @default 'small'
|
|
31
|
+
*/
|
|
32
|
+
size?: 'small' | 'medium' | 'large';
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* A button that sets the chart zoom to a predefined range.
|
|
36
|
+
* It renders the `baseToggleButton` slot.
|
|
37
|
+
*/
|
|
38
|
+
declare const ChartsToolbarRangeButtonTrigger: React.ForwardRefExoticComponent<ChartsToolbarRangeButtonTriggerProps & {
|
|
39
|
+
children?: React.ReactNode | undefined;
|
|
40
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
41
|
+
export { ChartsToolbarRangeButtonTrigger };
|