@mui/x-charts-pro 8.0.0-alpha.6 → 8.0.0-alpha.8
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.d.ts +2 -2
- package/BarChartPro/BarChartPro.js +68 -23
- package/CHANGELOG.md +242 -1
- package/ChartContainerPro/ChartContainerPro.d.ts +32 -4
- package/ChartContainerPro/ChartContainerPro.js +53 -18
- package/ChartContainerPro/useChartContainerProProps.d.ts +5 -5
- package/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/Heatmap/Heatmap.js +28 -2
- package/Heatmap/HeatmapTooltip.js +6 -4
- package/Heatmap/extremums.d.ts +2 -2
- package/Heatmap/formatter.d.ts +2 -2
- package/Heatmap/formatter.js +2 -1
- package/Heatmap/plugin.d.ts +2 -2
- package/Heatmap/plugin.js +1 -2
- package/LineChartPro/LineChartPro.d.ts +2 -2
- package/LineChartPro/LineChartPro.js +73 -32
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.js +46 -28
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/zoom/index.d.ts +1 -0
- package/hooks/zoom/index.js +1 -0
- package/hooks/zoom/useIsZoomInteracting.d.ts +6 -0
- package/hooks/zoom/useIsZoomInteracting.js +14 -0
- package/index.d.ts +0 -1
- package/index.js +2 -5
- package/internals/plugins/allPlugins.d.ts +10 -0
- package/internals/plugins/allPlugins.js +5 -0
- package/internals/plugins/useChartProZoom/defaultizeZoom.d.ts +2 -0
- package/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
- package/internals/plugins/useChartProZoom/index.d.ts +3 -0
- package/internals/plugins/useChartProZoom/index.js +3 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.d.ts +3 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.js +324 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +149 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +54 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.utils.d.ts +45 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
- package/internals/plugins/useChartProZoom/zoom.types.d.ts +53 -0
- package/internals/utils/releaseInfo.js +1 -1
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/modern/BarChartPro/BarChartPro.js +68 -23
- package/modern/ChartContainerPro/ChartContainerPro.js +53 -18
- package/modern/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/modern/Heatmap/Heatmap.js +28 -2
- package/modern/Heatmap/HeatmapTooltip.js +6 -4
- package/modern/Heatmap/formatter.js +2 -1
- package/modern/Heatmap/plugin.js +1 -2
- package/modern/LineChartPro/LineChartPro.js +73 -32
- package/modern/ScatterChartPro/ScatterChartPro.js +46 -28
- package/modern/hooks/index.js +2 -1
- package/modern/hooks/zoom/index.js +1 -0
- package/modern/hooks/zoom/useIsZoomInteracting.js +14 -0
- package/modern/index.js +2 -5
- package/modern/internals/plugins/allPlugins.js +5 -0
- package/modern/internals/plugins/useChartProZoom/defaultizeZoom.js +25 -0
- package/modern/internals/plugins/useChartProZoom/index.js +3 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.js +324 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +6 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.types.js +1 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.utils.js +126 -0
- package/modern/internals/plugins/useChartProZoom/zoom.types.js +1 -0
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/modern/models/index.js +2 -1
- package/node/BarChartPro/BarChartPro.js +67 -22
- package/node/ChartContainerPro/ChartContainerPro.js +53 -18
- package/node/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/node/Heatmap/Heatmap.js +28 -2
- package/node/Heatmap/HeatmapTooltip.js +4 -2
- package/node/Heatmap/formatter.js +2 -1
- package/node/Heatmap/plugin.js +1 -2
- package/node/LineChartPro/LineChartPro.js +72 -31
- package/node/ScatterChartPro/ScatterChartPro.js +44 -26
- package/node/hooks/index.js +16 -1
- package/node/{context/CartesianProviderPro → hooks/zoom}/index.js +4 -4
- package/node/hooks/zoom/useIsZoomInteracting.js +19 -0
- package/node/index.js +1 -12
- package/node/internals/plugins/allPlugins.js +11 -0
- package/node/internals/plugins/useChartProZoom/defaultizeZoom.js +33 -0
- package/node/internals/plugins/useChartProZoom/index.js +38 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.js +331 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +13 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.utils.js +140 -0
- package/node/internals/plugins/useChartProZoom/zoom.types.js +5 -0
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +5 -5
- package/typeOverloads/modules.d.ts +8 -1
- package/context/CartesianProviderPro/CartesianProviderPro.d.ts +0 -6
- package/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
- package/context/CartesianProviderPro/createAxisFilterMapper.d.ts +0 -13
- package/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
- package/context/CartesianProviderPro/index.d.ts +0 -1
- package/context/CartesianProviderPro/index.js +0 -1
- package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +0 -7
- package/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -50
- package/context/ChartDataProviderPro/index.d.ts +0 -1
- package/context/ChartDataProviderPro/index.js +0 -1
- package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +0 -14
- package/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
- package/context/ZoomProvider/Zoom.types.d.ts +0 -144
- package/context/ZoomProvider/ZoomContext.d.ts +0 -4
- package/context/ZoomProvider/ZoomContext.js +0 -16
- package/context/ZoomProvider/ZoomProvider.d.ts +0 -3
- package/context/ZoomProvider/ZoomProvider.js +0 -56
- package/context/ZoomProvider/ZoomSetup.d.ts +0 -9
- package/context/ZoomProvider/ZoomSetup.js +0 -16
- package/context/ZoomProvider/defaultizeZoom.d.ts +0 -2
- package/context/ZoomProvider/defaultizeZoom.js +0 -32
- package/context/ZoomProvider/index.d.ts +0 -3
- package/context/ZoomProvider/index.js +0 -3
- package/context/ZoomProvider/initializeZoomData.d.ts +0 -6
- package/context/ZoomProvider/initializeZoomData.js +0 -13
- package/context/ZoomProvider/useSetupPan.d.ts +0 -1
- package/context/ZoomProvider/useSetupPan.js +0 -106
- package/context/ZoomProvider/useSetupZoom.d.ts +0 -1
- package/context/ZoomProvider/useSetupZoom.js +0 -274
- package/context/ZoomProvider/useZoom.d.ts +0 -7
- package/context/ZoomProvider/useZoom.js +0 -19
- package/context/index.d.ts +0 -3
- package/context/index.js +0 -5
- package/context/package.json +0 -6
- package/modern/context/CartesianProviderPro/CartesianProviderPro.js +0 -89
- package/modern/context/CartesianProviderPro/createAxisFilterMapper.js +0 -60
- package/modern/context/CartesianProviderPro/index.js +0 -1
- package/modern/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -50
- package/modern/context/ChartDataProviderPro/index.js +0 -1
- package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -43
- package/modern/context/ZoomProvider/ZoomContext.js +0 -16
- package/modern/context/ZoomProvider/ZoomProvider.js +0 -56
- package/modern/context/ZoomProvider/ZoomSetup.js +0 -16
- package/modern/context/ZoomProvider/defaultizeZoom.js +0 -32
- package/modern/context/ZoomProvider/index.js +0 -3
- package/modern/context/ZoomProvider/initializeZoomData.js +0 -13
- package/modern/context/ZoomProvider/useSetupPan.js +0 -106
- package/modern/context/ZoomProvider/useSetupZoom.js +0 -274
- package/modern/context/ZoomProvider/useZoom.js +0 -19
- package/modern/context/index.js +0 -5
- package/node/context/CartesianProviderPro/CartesianProviderPro.js +0 -95
- package/node/context/CartesianProviderPro/createAxisFilterMapper.js +0 -68
- package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +0 -56
- package/node/context/ChartDataProviderPro/index.js +0 -16
- package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +0 -50
- package/node/context/ZoomProvider/ZoomContext.js +0 -23
- package/node/context/ZoomProvider/ZoomProvider.js +0 -63
- package/node/context/ZoomProvider/ZoomSetup.js +0 -20
- package/node/context/ZoomProvider/defaultizeZoom.js +0 -40
- package/node/context/ZoomProvider/index.js +0 -38
- package/node/context/ZoomProvider/initializeZoomData.js +0 -20
- package/node/context/ZoomProvider/useSetupPan.js +0 -114
- package/node/context/ZoomProvider/useSetupZoom.js +0 -281
- package/node/context/ZoomProvider/useZoom.js +0 -25
- package/node/context/index.js +0 -27
- /package/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
- /package/{modern/context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/zoom.types.js} +0 -0
- /package/node/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
|
@@ -0,0 +1,126 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Helper to get the range (in percents of a reference range) corresponding to a given scale.
|
|
3
|
+
* @param centerRatio {number} The ratio of the point that should not move between the previous and next range.
|
|
4
|
+
* @param scaleRatio {number} The target scale ratio.
|
|
5
|
+
* @returns The range to display.
|
|
6
|
+
*/
|
|
7
|
+
export const zoomAtPoint = (centerRatio, scaleRatio, currentZoomData, options) => {
|
|
8
|
+
const MIN_RANGE = options.minStart;
|
|
9
|
+
const MAX_RANGE = options.maxEnd;
|
|
10
|
+
const MIN_ALLOWED_SPAN = options.minSpan;
|
|
11
|
+
const minRange = currentZoomData.start;
|
|
12
|
+
const maxRange = currentZoomData.end;
|
|
13
|
+
const point = minRange + centerRatio * (maxRange - minRange);
|
|
14
|
+
let newMinRange = (minRange + point * (scaleRatio - 1)) / scaleRatio;
|
|
15
|
+
let newMaxRange = (maxRange + point * (scaleRatio - 1)) / scaleRatio;
|
|
16
|
+
let minSpillover = 0;
|
|
17
|
+
let maxSpillover = 0;
|
|
18
|
+
if (newMinRange < MIN_RANGE) {
|
|
19
|
+
minSpillover = Math.abs(newMinRange);
|
|
20
|
+
newMinRange = MIN_RANGE;
|
|
21
|
+
}
|
|
22
|
+
if (newMaxRange > MAX_RANGE) {
|
|
23
|
+
maxSpillover = Math.abs(newMaxRange - MAX_RANGE);
|
|
24
|
+
newMaxRange = MAX_RANGE;
|
|
25
|
+
}
|
|
26
|
+
if (minSpillover > 0 && maxSpillover > 0) {
|
|
27
|
+
return [MIN_RANGE, MAX_RANGE];
|
|
28
|
+
}
|
|
29
|
+
newMaxRange += minSpillover;
|
|
30
|
+
newMinRange -= maxSpillover;
|
|
31
|
+
newMinRange = Math.min(MAX_RANGE - MIN_ALLOWED_SPAN, Math.max(MIN_RANGE, newMinRange));
|
|
32
|
+
newMaxRange = Math.max(MIN_ALLOWED_SPAN, Math.min(MAX_RANGE, newMaxRange));
|
|
33
|
+
return [newMinRange, newMaxRange];
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Checks if the new span is valid.
|
|
38
|
+
*/
|
|
39
|
+
export function isSpanValid(minRange, maxRange, isZoomIn, option) {
|
|
40
|
+
const newSpanPercent = maxRange - minRange;
|
|
41
|
+
if (isZoomIn && newSpanPercent < option.minSpan || !isZoomIn && newSpanPercent > option.maxSpan) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
if (minRange < option.minStart || maxRange > option.maxEnd) {
|
|
45
|
+
return false;
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
}
|
|
49
|
+
function getMultiplier(event) {
|
|
50
|
+
const ctrlMultiplier = event.ctrlKey ? 3 : 1;
|
|
51
|
+
|
|
52
|
+
// DeltaMode: 0 is pixel, 1 is line, 2 is page
|
|
53
|
+
// This is defined by the browser.
|
|
54
|
+
if (event.deltaMode === 1) {
|
|
55
|
+
return 1 * ctrlMultiplier;
|
|
56
|
+
}
|
|
57
|
+
if (event.deltaMode) {
|
|
58
|
+
return 10 * ctrlMultiplier;
|
|
59
|
+
}
|
|
60
|
+
return 0.2 * ctrlMultiplier;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* Get the scale ratio and if it's a zoom in or out from a wheel event.
|
|
65
|
+
*/
|
|
66
|
+
export function getWheelScaleRatio(event, step) {
|
|
67
|
+
const deltaY = -event.deltaY;
|
|
68
|
+
const multiplier = getMultiplier(event);
|
|
69
|
+
const scaledStep = step * multiplier * deltaY / 1000;
|
|
70
|
+
// Clamp the scale ratio between 0.1 and 1.9 so that the zoom is not too big or too small.
|
|
71
|
+
const scaleRatio = Math.min(Math.max(1 + scaledStep, 0.1), 1.9);
|
|
72
|
+
const isZoomIn = deltaY > 0;
|
|
73
|
+
return {
|
|
74
|
+
scaleRatio,
|
|
75
|
+
isZoomIn
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* Get the scale ratio and if it's a zoom in or out from a pinch gesture.
|
|
81
|
+
*/
|
|
82
|
+
export function getPinchScaleRatio(curDiff, prevDiff, step) {
|
|
83
|
+
const scaledStep = step / 1000;
|
|
84
|
+
let scaleRatio = 0;
|
|
85
|
+
let isZoomIn = false;
|
|
86
|
+
const hasMoved = prevDiff > 0;
|
|
87
|
+
if (hasMoved && curDiff > prevDiff) {
|
|
88
|
+
// The distance between the two pointers has increased
|
|
89
|
+
scaleRatio = 1 + scaledStep;
|
|
90
|
+
isZoomIn = true;
|
|
91
|
+
}
|
|
92
|
+
if (hasMoved && curDiff < prevDiff) {
|
|
93
|
+
// The distance between the two pointers has decreased
|
|
94
|
+
scaleRatio = 1 - scaledStep;
|
|
95
|
+
isZoomIn = false;
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
scaleRatio,
|
|
99
|
+
isZoomIn
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
export function getDiff(eventCache) {
|
|
103
|
+
const [firstEvent, secondEvent] = eventCache;
|
|
104
|
+
return Math.hypot(firstEvent.pageX - secondEvent.pageX, firstEvent.pageY - secondEvent.pageY);
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
/**
|
|
108
|
+
* Get the ratio of the point in the horizontal center of the area.
|
|
109
|
+
*/
|
|
110
|
+
export function getHorizontalCenterRatio(point, area) {
|
|
111
|
+
const {
|
|
112
|
+
left,
|
|
113
|
+
width
|
|
114
|
+
} = area;
|
|
115
|
+
return (point.x - left) / width;
|
|
116
|
+
}
|
|
117
|
+
export function preventDefault(event) {
|
|
118
|
+
event.preventDefault();
|
|
119
|
+
}
|
|
120
|
+
export function getVerticalCenterRatio(point, area) {
|
|
121
|
+
const {
|
|
122
|
+
top,
|
|
123
|
+
height
|
|
124
|
+
} = area;
|
|
125
|
+
return (point.y - top) / height * -1 + 1;
|
|
126
|
+
}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
export interface ZoomOptions {
|
|
2
|
+
/**
|
|
3
|
+
* The starting percentage of the zoom range. In the range of 0 to 100.
|
|
4
|
+
*
|
|
5
|
+
* @default 0
|
|
6
|
+
*/
|
|
7
|
+
minStart?: number;
|
|
8
|
+
/**
|
|
9
|
+
* The ending percentage of the zoom range. In the range of 0 to 100.
|
|
10
|
+
*
|
|
11
|
+
* @default 100
|
|
12
|
+
*/
|
|
13
|
+
maxEnd?: number;
|
|
14
|
+
/**
|
|
15
|
+
* The step size of the zooming function. Defines the granularity of the zoom.
|
|
16
|
+
*
|
|
17
|
+
* @default 5
|
|
18
|
+
*/
|
|
19
|
+
step?: number;
|
|
20
|
+
/**
|
|
21
|
+
* Restricts the minimum span size in the range of 0 to 100.
|
|
22
|
+
*
|
|
23
|
+
* If the span size is smaller than the minSpan, the span will be resized to the minSpan.
|
|
24
|
+
*
|
|
25
|
+
* @default 10
|
|
26
|
+
*/
|
|
27
|
+
minSpan?: number;
|
|
28
|
+
/**
|
|
29
|
+
* Restricts the maximum span size in the range of 0 to 100.
|
|
30
|
+
*
|
|
31
|
+
* If the span size is larger than the maxSpan, the span will be resized to the maxSpan.
|
|
32
|
+
*
|
|
33
|
+
* @default 100
|
|
34
|
+
*/
|
|
35
|
+
maxSpan?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Set to `false` to disable panning. Useful when you want to pan programmatically,
|
|
38
|
+
* or to show only a specific section of the chart.
|
|
39
|
+
*
|
|
40
|
+
* @default true
|
|
41
|
+
*/
|
|
42
|
+
panning?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Defines how to filter the axis data when it is outside of the zoomed range of this axis.
|
|
45
|
+
*
|
|
46
|
+
* - `keep`: The data outside the zoomed range is kept. And the other axes will stay the same.
|
|
47
|
+
* - `discard`: The data outside the zoomed range is discarded for the other axes.
|
|
48
|
+
* The other axes will be adjusted to fit the zoomed range.
|
|
49
|
+
*
|
|
50
|
+
* @default 'keep'
|
|
51
|
+
*/
|
|
52
|
+
filterMode?: 'discard' | 'keep';
|
|
53
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import ponyfillGlobal from '@mui/utils/ponyfillGlobal';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczNjk4MjAwMDAwMA==";
|
|
4
4
|
if (process.env.NODE_ENV !== 'production') {
|
|
5
5
|
// A simple hack to set the value in the test environment (has no build step).
|
|
6
6
|
// eslint-disable-next-line no-useless-concat
|
package/models/index.d.ts
CHANGED
package/models/index.js
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export * from "./seriesType/index.js";
|
|
1
|
+
export * from "./seriesType/index.js";
|
|
2
|
+
export {};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
5
|
-
const _excluded = ["
|
|
5
|
+
const _excluded = ["initialZoom", "onZoomChange", "apiRef"];
|
|
6
6
|
import * as React from 'react';
|
|
7
7
|
import PropTypes from 'prop-types';
|
|
8
8
|
import { useThemeProps } from '@mui/material/styles';
|
|
@@ -15,15 +15,14 @@ import { ChartsLegend } from '@mui/x-charts/ChartsLegend';
|
|
|
15
15
|
import { ChartsAxisHighlight } from '@mui/x-charts/ChartsAxisHighlight';
|
|
16
16
|
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
17
17
|
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
18
|
-
import { useBarChartProps } from '@mui/x-charts/internals';
|
|
19
|
-
import {
|
|
20
|
-
import {
|
|
21
|
-
import {
|
|
18
|
+
import { useBarChartProps, ChartsWrapper } from '@mui/x-charts/internals';
|
|
19
|
+
import { ChartDataProvider } from '@mui/x-charts/context';
|
|
20
|
+
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
21
|
+
import { useIsZoomInteracting } from "../hooks/zoom/index.js";
|
|
22
|
+
import { useChartContainerProProps } from "../ChartContainerPro/useChartContainerProProps.js";
|
|
22
23
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
23
24
|
function BarChartPlotZoom(props) {
|
|
24
|
-
const
|
|
25
|
-
isInteracting
|
|
26
|
-
} = useZoom();
|
|
25
|
+
const isInteracting = useIsZoomInteracting();
|
|
27
26
|
return /*#__PURE__*/_jsx(BarPlot, _extends({}, props, {
|
|
28
27
|
skipAnimation: isInteracting || undefined
|
|
29
28
|
}));
|
|
@@ -84,11 +83,13 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
|
|
|
84
83
|
name: 'MuiBarChartPro'
|
|
85
84
|
});
|
|
86
85
|
const {
|
|
87
|
-
|
|
88
|
-
onZoomChange
|
|
86
|
+
initialZoom,
|
|
87
|
+
onZoomChange,
|
|
88
|
+
apiRef
|
|
89
89
|
} = props,
|
|
90
90
|
other = _objectWithoutPropertiesLoose(props, _excluded);
|
|
91
91
|
const {
|
|
92
|
+
chartsWrapperProps,
|
|
92
93
|
chartContainerProps,
|
|
93
94
|
barPlotProps,
|
|
94
95
|
axisClickHandlerProps,
|
|
@@ -101,15 +102,24 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
|
|
|
101
102
|
legendProps,
|
|
102
103
|
children
|
|
103
104
|
} = useBarChartProps(other);
|
|
105
|
+
const {
|
|
106
|
+
chartDataProviderProProps,
|
|
107
|
+
chartsSurfaceProps
|
|
108
|
+
} = useChartContainerProProps(_extends({}, chartContainerProps, {
|
|
109
|
+
apiRef
|
|
110
|
+
}), ref);
|
|
104
111
|
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
105
|
-
return /*#__PURE__*/
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
zoom: zoom,
|
|
112
|
+
return /*#__PURE__*/_jsx(ChartDataProvider, _extends({}, chartDataProviderProProps, {
|
|
113
|
+
apiRef: apiRef,
|
|
114
|
+
initialZoom: initialZoom,
|
|
109
115
|
onZoomChange: onZoomChange,
|
|
110
|
-
children:
|
|
111
|
-
children: [/*#__PURE__*/_jsx(
|
|
112
|
-
|
|
116
|
+
children: /*#__PURE__*/_jsxs(ChartsWrapper, _extends({}, chartsWrapperProps, {
|
|
117
|
+
children: [!props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), /*#__PURE__*/_jsxs(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
118
|
+
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
119
|
+
children: [/*#__PURE__*/_jsx(BarChartPlotZoom, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
120
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), children]
|
|
121
|
+
}))]
|
|
122
|
+
}))
|
|
113
123
|
}));
|
|
114
124
|
});
|
|
115
125
|
process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
@@ -117,6 +127,11 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
117
127
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
118
128
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
119
129
|
// ----------------------------------------------------------------------
|
|
130
|
+
apiRef: PropTypes.shape({
|
|
131
|
+
current: PropTypes.shape({
|
|
132
|
+
setZoomData: PropTypes.func.isRequired
|
|
133
|
+
})
|
|
134
|
+
}),
|
|
120
135
|
/**
|
|
121
136
|
* The configuration of axes highlight.
|
|
122
137
|
* Default is set to 'band' in the bar direction.
|
|
@@ -185,6 +200,19 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
185
200
|
dataIndex: PropTypes.number,
|
|
186
201
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
187
202
|
}),
|
|
203
|
+
/**
|
|
204
|
+
* This prop is used to help implement the accessibility logic.
|
|
205
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
206
|
+
*/
|
|
207
|
+
id: PropTypes.string,
|
|
208
|
+
/**
|
|
209
|
+
* The list of zoom data related to each axis.
|
|
210
|
+
*/
|
|
211
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
212
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
213
|
+
end: PropTypes.number.isRequired,
|
|
214
|
+
start: PropTypes.number.isRequired
|
|
215
|
+
})),
|
|
188
216
|
/**
|
|
189
217
|
* The direction of the bar elements.
|
|
190
218
|
* @default 'vertical'
|
|
@@ -205,7 +233,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
205
233
|
* The margin between the SVG and the drawing area.
|
|
206
234
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
207
235
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
208
|
-
* @default object Depends on the charts type.
|
|
209
236
|
*/
|
|
210
237
|
margin: PropTypes.shape({
|
|
211
238
|
bottom: PropTypes.number,
|
|
@@ -265,6 +292,7 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
265
292
|
*/
|
|
266
293
|
slots: PropTypes.object,
|
|
267
294
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
295
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
268
296
|
title: PropTypes.string,
|
|
269
297
|
/**
|
|
270
298
|
* Indicate which axis to display the top of the charts.
|
|
@@ -399,12 +427,29 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
399
427
|
}), PropTypes.bool])
|
|
400
428
|
})),
|
|
401
429
|
/**
|
|
402
|
-
* The
|
|
430
|
+
* The configuration of the z-axes.
|
|
403
431
|
*/
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
432
|
+
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
433
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
434
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
435
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
436
|
+
unknownColor: PropTypes.string,
|
|
437
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
438
|
+
}), PropTypes.shape({
|
|
439
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
440
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
441
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
442
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
443
|
+
}), PropTypes.shape({
|
|
444
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
445
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
446
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
447
|
+
})]),
|
|
448
|
+
data: PropTypes.array,
|
|
449
|
+
dataKey: PropTypes.string,
|
|
450
|
+
id: PropTypes.string,
|
|
451
|
+
max: PropTypes.number,
|
|
452
|
+
min: PropTypes.number
|
|
408
453
|
}))
|
|
409
454
|
} : void 0;
|
|
410
455
|
export { BarChartPro };
|
|
@@ -4,19 +4,46 @@ import _extends from "@babel/runtime/helpers/esm/extends";
|
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { Watermark } from '@mui/x-license/Watermark';
|
|
7
|
+
import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
|
|
7
8
|
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
9
|
+
import { ChartDataProvider } from '@mui/x-charts/context';
|
|
8
10
|
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
9
|
-
import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
|
|
10
11
|
import { useChartContainerProProps } from "./useChartContainerProProps.js";
|
|
11
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
const releaseInfo = getReleaseInfo();
|
|
13
|
-
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
17
|
+
*
|
|
18
|
+
* This is a combination of both the `ChartDataProvider` and `ChartsSurface` components.
|
|
19
|
+
*
|
|
20
|
+
* Demos:
|
|
21
|
+
*
|
|
22
|
+
* - [Composition](http://localhost:3001/x/react-charts/composition/)
|
|
23
|
+
*
|
|
24
|
+
* API:
|
|
25
|
+
*
|
|
26
|
+
* - [ChartContainer API](https://mui.com/x/api/charts/chart-container/)
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```jsx
|
|
30
|
+
* <ChartContainerPro
|
|
31
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
32
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
33
|
+
* >
|
|
34
|
+
* <BarPlot />
|
|
35
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
36
|
+
* </ChartContainerPro>
|
|
37
|
+
* ```
|
|
38
|
+
*/
|
|
39
|
+
const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainerProInner(props, ref) {
|
|
14
40
|
const {
|
|
15
41
|
chartDataProviderProProps,
|
|
16
42
|
children,
|
|
17
43
|
chartsSurfaceProps
|
|
18
44
|
} = useChartContainerProProps(props, ref);
|
|
19
|
-
|
|
45
|
+
useLicenseVerifier('x-charts-pro', releaseInfo);
|
|
46
|
+
return /*#__PURE__*/_jsxs(ChartDataProvider, _extends({}, chartDataProviderProProps, {
|
|
20
47
|
children: [/*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
21
48
|
children: children
|
|
22
49
|
})), /*#__PURE__*/_jsx(Watermark, {
|
|
@@ -25,11 +52,19 @@ const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainerP
|
|
|
25
52
|
})]
|
|
26
53
|
}));
|
|
27
54
|
});
|
|
55
|
+
|
|
56
|
+
// @ts-ignore
|
|
57
|
+
|
|
28
58
|
process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
29
59
|
// ----------------------------- Warning --------------------------------
|
|
30
60
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
31
61
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
32
62
|
// ----------------------------------------------------------------------
|
|
63
|
+
apiRef: PropTypes.shape({
|
|
64
|
+
current: PropTypes.shape({
|
|
65
|
+
setZoomData: PropTypes.func.isRequired
|
|
66
|
+
})
|
|
67
|
+
}),
|
|
33
68
|
children: PropTypes.node,
|
|
34
69
|
className: PropTypes.string,
|
|
35
70
|
/**
|
|
@@ -59,11 +94,23 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
|
59
94
|
dataIndex: PropTypes.number,
|
|
60
95
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
61
96
|
}),
|
|
97
|
+
/**
|
|
98
|
+
* This prop is used to help implement the accessibility logic.
|
|
99
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
100
|
+
*/
|
|
101
|
+
id: PropTypes.string,
|
|
102
|
+
/**
|
|
103
|
+
* The list of zoom data related to each axis.
|
|
104
|
+
*/
|
|
105
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
106
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
107
|
+
end: PropTypes.number.isRequired,
|
|
108
|
+
start: PropTypes.number.isRequired
|
|
109
|
+
})),
|
|
62
110
|
/**
|
|
63
111
|
* The margin between the SVG and the drawing area.
|
|
64
112
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
65
113
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
66
|
-
* @default object Depends on the charts type.
|
|
67
114
|
*/
|
|
68
115
|
margin: PropTypes.shape({
|
|
69
116
|
bottom: PropTypes.number,
|
|
@@ -83,23 +130,19 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
|
83
130
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
84
131
|
*/
|
|
85
132
|
onZoomChange: PropTypes.func,
|
|
86
|
-
/**
|
|
87
|
-
* An array of plugins defining how to preprocess data.
|
|
88
|
-
* If not provided, the container supports line, bar, scatter and pie charts.
|
|
89
|
-
*/
|
|
90
|
-
plugins: PropTypes.arrayOf(PropTypes.object),
|
|
91
133
|
/**
|
|
92
134
|
* The array of series to display.
|
|
93
135
|
* Each type of series has its own specificity.
|
|
94
136
|
* Please refer to the appropriate docs page to learn more about it.
|
|
95
137
|
*/
|
|
96
|
-
series: PropTypes.arrayOf(PropTypes.object)
|
|
138
|
+
series: PropTypes.arrayOf(PropTypes.object),
|
|
97
139
|
/**
|
|
98
140
|
* If `true`, animations are skipped.
|
|
99
141
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
100
142
|
*/
|
|
101
143
|
skipAnimation: PropTypes.bool,
|
|
102
144
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
145
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
103
146
|
title: PropTypes.string,
|
|
104
147
|
/**
|
|
105
148
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -251,14 +294,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
|
251
294
|
id: PropTypes.string,
|
|
252
295
|
max: PropTypes.number,
|
|
253
296
|
min: PropTypes.number
|
|
254
|
-
})),
|
|
255
|
-
/**
|
|
256
|
-
* The list of zoom data related to each axis.
|
|
257
|
-
*/
|
|
258
|
-
zoom: PropTypes.arrayOf(PropTypes.shape({
|
|
259
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
260
|
-
end: PropTypes.number.isRequired,
|
|
261
|
-
start: PropTypes.number.isRequired
|
|
262
297
|
}))
|
|
263
298
|
} : void 0;
|
|
264
299
|
export { ChartContainerPro };
|
|
@@ -2,16 +2,19 @@
|
|
|
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 = ["
|
|
5
|
+
const _excluded = ["initialZoom", "onZoomChange", "plugins", "apiRef"];
|
|
6
6
|
import { useChartContainerProps } from '@mui/x-charts/internals';
|
|
7
|
+
import { ALL_PLUGINS } from "../internals/plugins/allPlugins.js";
|
|
7
8
|
export const useChartContainerProProps = (props, ref) => {
|
|
8
9
|
const {
|
|
9
|
-
|
|
10
|
-
onZoomChange
|
|
10
|
+
initialZoom,
|
|
11
|
+
onZoomChange,
|
|
12
|
+
plugins,
|
|
13
|
+
apiRef
|
|
11
14
|
} = props,
|
|
12
15
|
baseProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
13
16
|
const chartDataProviderProProps = {
|
|
14
|
-
|
|
17
|
+
initialZoom,
|
|
15
18
|
onZoomChange
|
|
16
19
|
};
|
|
17
20
|
const {
|
|
@@ -20,7 +23,10 @@ export const useChartContainerProProps = (props, ref) => {
|
|
|
20
23
|
children
|
|
21
24
|
} = useChartContainerProps(baseProps, ref);
|
|
22
25
|
return {
|
|
23
|
-
chartDataProviderProProps: _extends({}, chartDataProviderProps, chartDataProviderProProps
|
|
26
|
+
chartDataProviderProProps: _extends({}, chartDataProviderProps, chartDataProviderProProps, {
|
|
27
|
+
apiRef,
|
|
28
|
+
plugins: plugins ?? ALL_PLUGINS
|
|
29
|
+
}),
|
|
24
30
|
chartsSurfaceProps,
|
|
25
31
|
children
|
|
26
32
|
};
|
|
@@ -17,6 +17,9 @@ import { HeatmapTooltip } from "./HeatmapTooltip.js";
|
|
|
17
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
18
18
|
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
19
19
|
const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
20
|
+
const seriesConfig = {
|
|
21
|
+
heatmap: heatmapPlugin
|
|
22
|
+
};
|
|
20
23
|
const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
21
24
|
const props = useThemeProps({
|
|
22
25
|
props: inProps,
|
|
@@ -66,7 +69,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
66
69
|
const Tooltip = props.slots?.tooltip ?? HeatmapTooltip;
|
|
67
70
|
return /*#__PURE__*/_jsxs(ChartContainerPro, {
|
|
68
71
|
ref: ref,
|
|
69
|
-
|
|
72
|
+
seriesConfig: seriesConfig,
|
|
70
73
|
series: series.map(s => _extends({
|
|
71
74
|
type: 'heatmap'
|
|
72
75
|
}, s)),
|
|
@@ -111,6 +114,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
111
114
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
112
115
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
113
116
|
// ----------------------------------------------------------------------
|
|
117
|
+
apiRef: PropTypes.shape({
|
|
118
|
+
current: PropTypes.shape({
|
|
119
|
+
setZoomData: PropTypes.func.isRequired
|
|
120
|
+
})
|
|
121
|
+
}),
|
|
114
122
|
/**
|
|
115
123
|
* Indicate which axis to display the bottom of the charts.
|
|
116
124
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
@@ -146,6 +154,19 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
146
154
|
dataIndex: PropTypes.number,
|
|
147
155
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
148
156
|
}),
|
|
157
|
+
/**
|
|
158
|
+
* This prop is used to help implement the accessibility logic.
|
|
159
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
160
|
+
*/
|
|
161
|
+
id: PropTypes.string,
|
|
162
|
+
/**
|
|
163
|
+
* The list of zoom data related to each axis.
|
|
164
|
+
*/
|
|
165
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
166
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
167
|
+
end: PropTypes.number.isRequired,
|
|
168
|
+
start: PropTypes.number.isRequired
|
|
169
|
+
})),
|
|
149
170
|
/**
|
|
150
171
|
* Indicate which axis to display the left of the charts.
|
|
151
172
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -161,7 +182,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
161
182
|
* The margin between the SVG and the drawing area.
|
|
162
183
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
163
184
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
164
|
-
* @default object Depends on the charts type.
|
|
165
185
|
*/
|
|
166
186
|
margin: PropTypes.shape({
|
|
167
187
|
bottom: PropTypes.number,
|
|
@@ -193,6 +213,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
193
213
|
* An array of [[HeatmapSeriesType]] objects.
|
|
194
214
|
*/
|
|
195
215
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
216
|
+
/**
|
|
217
|
+
* The configuration helpers used to compute attributes according to the serries type.
|
|
218
|
+
* @ignore Unstable props for internal usage.
|
|
219
|
+
*/
|
|
220
|
+
seriesConfig: PropTypes.object,
|
|
196
221
|
/**
|
|
197
222
|
* The props used for each component slot.
|
|
198
223
|
* @default {}
|
|
@@ -204,6 +229,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
204
229
|
*/
|
|
205
230
|
slots: PropTypes.object,
|
|
206
231
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
232
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
207
233
|
title: PropTypes.string,
|
|
208
234
|
/**
|
|
209
235
|
* The configuration of the tooltip.
|
|
@@ -6,9 +6,9 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import clsx from 'clsx';
|
|
7
7
|
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
-
import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell,
|
|
9
|
+
import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
|
|
10
10
|
import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
|
|
11
|
-
import { getLabel } from '@mui/x-charts/internals';
|
|
11
|
+
import { getLabel, ChartsLabelMark } from '@mui/x-charts/internals';
|
|
12
12
|
import { useHeatmapSeries } from "../hooks/useSeries.js";
|
|
13
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -47,7 +47,8 @@ function DefaultHeatmapTooltipContent(props) {
|
|
|
47
47
|
const {
|
|
48
48
|
color,
|
|
49
49
|
value,
|
|
50
|
-
identifier
|
|
50
|
+
identifier,
|
|
51
|
+
markType
|
|
51
52
|
} = tooltipData;
|
|
52
53
|
const [xIndex, yIndex] = value;
|
|
53
54
|
const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
|
|
@@ -80,7 +81,8 @@ function DefaultHeatmapTooltipContent(props) {
|
|
|
80
81
|
className: classes?.row,
|
|
81
82
|
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
82
83
|
className: clsx(classes?.markCell, classes?.cell),
|
|
83
|
-
children: /*#__PURE__*/_jsx(
|
|
84
|
+
children: /*#__PURE__*/_jsx(ChartsLabelMark, {
|
|
85
|
+
type: markType,
|
|
84
86
|
color: color,
|
|
85
87
|
className: classes?.mark
|
|
86
88
|
})
|
package/modern/Heatmap/plugin.js
CHANGED
|
@@ -2,8 +2,7 @@ import { getBaseExtremum } from "./extremums.js";
|
|
|
2
2
|
import formatter from "./formatter.js";
|
|
3
3
|
import getColor from "./getColor.js";
|
|
4
4
|
export const plugin = {
|
|
5
|
-
|
|
6
|
-
seriesFormatter: formatter,
|
|
5
|
+
seriesProcessor: formatter,
|
|
7
6
|
colorProcessor: getColor,
|
|
8
7
|
xExtremumGetter: getBaseExtremum,
|
|
9
8
|
yExtremumGetter: getBaseExtremum
|