@mui/x-charts-pro 8.0.0-alpha.1 → 8.0.0-alpha.10
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 +72 -31
- package/CHANGELOG.md +1903 -231
- package/ChartContainerPro/ChartContainerPro.d.ts +33 -4
- package/ChartContainerPro/ChartContainerPro.js +55 -37
- package/ChartContainerPro/useChartContainerProProps.d.ts +6 -5
- package/ChartContainerPro/useChartContainerProProps.js +11 -7
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +70 -80
- package/{context → ChartDataProviderPro}/package.json +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
- package/Heatmap/Heatmap.js +31 -8
- package/Heatmap/HeatmapItem.js +1 -1
- package/Heatmap/HeatmapTooltip.js +8 -28
- package/Heatmap/extremums.d.ts +2 -2
- package/Heatmap/formatter.d.ts +2 -2
- package/Heatmap/formatter.js +2 -1
- package/Heatmap/heatmapClasses.js +2 -1
- package/Heatmap/plugin.d.ts +2 -2
- package/Heatmap/plugin.js +4 -2
- package/Heatmap/tooltip.d.ts +3 -0
- package/Heatmap/tooltip.js +25 -0
- package/LineChartPro/LineChartPro.d.ts +2 -2
- package/LineChartPro/LineChartPro.js +78 -51
- package/README.md +1 -1
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.js +49 -33
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +2 -1
- package/hooks/useSeries.d.ts +2 -4
- 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 +3 -1
- package/index.js +5 -5
- package/internals/plugins/allPlugins.d.ts +11 -0
- package/internals/plugins/allPlugins.js +5 -0
- package/internals/plugins/useChartProZoom/creatZoomLookup.d.ts +3 -0
- package/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -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 +303 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.d.ts +377 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -0
- package/internals/plugins/useChartProZoom/useChartProZoom.types.d.ts +50 -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 +2 -2
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/modern/BarChartPro/BarChartPro.js +72 -31
- package/modern/ChartContainerPro/ChartContainerPro.js +55 -37
- package/modern/ChartContainerPro/useChartContainerProProps.js +11 -7
- package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +70 -80
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +15 -0
- package/modern/Heatmap/Heatmap.js +31 -8
- package/modern/Heatmap/HeatmapItem.js +1 -1
- package/modern/Heatmap/HeatmapTooltip.js +8 -28
- package/modern/Heatmap/formatter.js +2 -1
- package/modern/Heatmap/heatmapClasses.js +2 -1
- package/modern/Heatmap/plugin.js +4 -2
- package/modern/Heatmap/tooltip.js +25 -0
- package/modern/LineChartPro/LineChartPro.js +78 -51
- package/modern/ScatterChartPro/ScatterChartPro.js +49 -33
- 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 +5 -5
- package/modern/internals/plugins/allPlugins.js +5 -0
- package/modern/internals/plugins/useChartProZoom/creatZoomLookup.js +12 -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 +303 -0
- package/modern/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +10 -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 +2 -2
- package/modern/models/index.js +2 -1
- package/node/BarChartPro/BarChartPro.js +71 -30
- package/node/ChartContainerPro/ChartContainerPro.js +54 -36
- package/node/ChartContainerPro/useChartContainerProProps.js +11 -7
- package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js +67 -77
- package/node/ChartDataProviderPro/useChartDataProviderProProps.js +21 -0
- package/node/Heatmap/Heatmap.js +31 -8
- package/node/Heatmap/HeatmapItem.js +2 -2
- package/node/Heatmap/HeatmapTooltip.js +6 -26
- package/node/Heatmap/formatter.js +2 -1
- package/node/Heatmap/heatmapClasses.js +5 -4
- package/node/Heatmap/plugin.js +4 -2
- package/node/Heatmap/tooltip.js +31 -0
- package/node/LineChartPro/LineChartPro.js +77 -50
- package/node/ScatterChartPro/ScatterChartPro.js +48 -32
- 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 +34 -12
- package/node/internals/plugins/allPlugins.js +11 -0
- package/node/internals/plugins/useChartProZoom/creatZoomLookup.js +19 -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 +310 -0
- package/node/internals/plugins/useChartProZoom/useChartProZoom.selectors.js +18 -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 +4 -3
- package/package.json +6 -6
- 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 -12
- 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 -10
- 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/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/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/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/ChartDataProviderPro → ChartDataProviderPro}/index.d.ts +0 -0
- /package/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
- /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/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
- /package/node/{context/ChartDataProviderPro → ChartDataProviderPro}/index.js +0 -0
- /package/node/{context/ZoomProvider/Zoom.types.js → internals/plugins/useChartProZoom/useChartProZoom.types.js} +0 -0
package/modern/{context/ChartDataProviderPro → ChartDataProviderPro}/ChartDataProviderPro.js
RENAMED
|
@@ -3,50 +3,54 @@
|
|
|
3
3
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
4
|
import * as React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
6
|
+
import { Watermark } from '@mui/x-license/Watermark';
|
|
7
|
+
import { ChartProvider, AnimationProvider } from '@mui/x-charts/internals';
|
|
8
8
|
import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { useChartContainerProProps } from "./useChartDataProviderProProps.js";
|
|
13
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
|
+
import { useChartDataProviderProProps } from "./useChartDataProviderProProps.js";
|
|
10
|
+
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
11
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
12
|
const releaseInfo = getReleaseInfo();
|
|
13
|
+
const packageIdentifier = 'x-charts-pro';
|
|
14
|
+
/**
|
|
15
|
+
* Orchestrates the data providers for the chart components and hooks.
|
|
16
|
+
*
|
|
17
|
+
* Use this component if you have custom HTML components that need to access the chart data.
|
|
18
|
+
*
|
|
19
|
+
* Demos:
|
|
20
|
+
*
|
|
21
|
+
* - [Composition](https://mui.com/x/api/charts/composition/)
|
|
22
|
+
*
|
|
23
|
+
* API:
|
|
24
|
+
*
|
|
25
|
+
* - [ChartDataProviderPro API](https://mui.com/x/api/charts/chart-data-provider/)
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```jsx
|
|
29
|
+
* <ChartDataProviderPro
|
|
30
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
31
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
32
|
+
* >
|
|
33
|
+
* <ChartsSurface>
|
|
34
|
+
* <BarPlot />
|
|
35
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
36
|
+
* </ChartsSurface>
|
|
37
|
+
* {'Custom Legend Component'}
|
|
38
|
+
* </ChartDataProviderPro>
|
|
39
|
+
* ```
|
|
40
|
+
*/
|
|
15
41
|
function ChartDataProviderPro(props) {
|
|
16
42
|
const {
|
|
17
|
-
|
|
18
|
-
drawingAreaProviderProps,
|
|
19
|
-
seriesProviderProps,
|
|
20
|
-
zAxisContextProps,
|
|
21
|
-
highlightedProviderProps,
|
|
22
|
-
cartesianProviderProps,
|
|
23
|
-
sizeProviderProps,
|
|
24
|
-
pluginProviderProps,
|
|
43
|
+
children,
|
|
25
44
|
animationProviderProps,
|
|
26
|
-
|
|
27
|
-
} =
|
|
28
|
-
useLicenseVerifier(
|
|
29
|
-
return /*#__PURE__*/_jsx(
|
|
30
|
-
children: /*#__PURE__*/
|
|
31
|
-
children: /*#__PURE__*/_jsx(
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
children: /*#__PURE__*/_jsx(CartesianProviderPro, _extends({}, cartesianProviderProps, {
|
|
36
|
-
children: /*#__PURE__*/_jsx(ZAxisContextProvider, _extends({}, zAxisContextProps, {
|
|
37
|
-
children: /*#__PURE__*/_jsx(InteractionProvider, {
|
|
38
|
-
children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
|
|
39
|
-
children: /*#__PURE__*/_jsx(SvgRefProvider, {
|
|
40
|
-
children: children
|
|
41
|
-
})
|
|
42
|
-
}))
|
|
43
|
-
})
|
|
44
|
-
}))
|
|
45
|
-
}))
|
|
46
|
-
}))
|
|
47
|
-
}))
|
|
48
|
-
}))
|
|
49
|
-
}))
|
|
45
|
+
chartProviderProps
|
|
46
|
+
} = useChartDataProviderProProps(props);
|
|
47
|
+
useLicenseVerifier(packageIdentifier, releaseInfo);
|
|
48
|
+
return /*#__PURE__*/_jsx(ChartProvider, _extends({}, chartProviderProps, {
|
|
49
|
+
children: /*#__PURE__*/_jsxs(AnimationProvider, _extends({}, animationProviderProps, {
|
|
50
|
+
children: [children, /*#__PURE__*/_jsx(Watermark, {
|
|
51
|
+
packageName: packageIdentifier,
|
|
52
|
+
releaseInfo: releaseInfo
|
|
53
|
+
})]
|
|
50
54
|
}))
|
|
51
55
|
}));
|
|
52
56
|
}
|
|
@@ -55,8 +59,12 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
|
55
59
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
56
60
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
57
61
|
// ----------------------------------------------------------------------
|
|
62
|
+
apiRef: PropTypes.shape({
|
|
63
|
+
current: PropTypes.shape({
|
|
64
|
+
setZoomData: PropTypes.func.isRequired
|
|
65
|
+
})
|
|
66
|
+
}),
|
|
58
67
|
children: PropTypes.node,
|
|
59
|
-
className: PropTypes.string,
|
|
60
68
|
/**
|
|
61
69
|
* Color palette used to colorize multiple series.
|
|
62
70
|
* @default blueberryTwilightPalette
|
|
@@ -66,29 +74,35 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
|
66
74
|
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
67
75
|
*/
|
|
68
76
|
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
69
|
-
desc: PropTypes.string,
|
|
70
|
-
/**
|
|
71
|
-
* If `true`, the charts will not listen to the mouse move event.
|
|
72
|
-
* It might break interactive features, but will improve performance.
|
|
73
|
-
* @default false
|
|
74
|
-
*/
|
|
75
|
-
disableAxisListener: PropTypes.bool,
|
|
76
77
|
/**
|
|
77
|
-
* The height of the chart in px.
|
|
78
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
78
79
|
*/
|
|
79
|
-
height: PropTypes.number
|
|
80
|
+
height: PropTypes.number,
|
|
80
81
|
/**
|
|
81
|
-
* The
|
|
82
|
+
* The highlighted item.
|
|
83
|
+
* Used when the highlight is controlled.
|
|
82
84
|
*/
|
|
83
85
|
highlightedItem: PropTypes.shape({
|
|
84
86
|
dataIndex: PropTypes.number,
|
|
85
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
87
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
86
88
|
}),
|
|
89
|
+
/**
|
|
90
|
+
* This prop is used to help implement the accessibility logic.
|
|
91
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
92
|
+
*/
|
|
93
|
+
id: PropTypes.string,
|
|
94
|
+
/**
|
|
95
|
+
* The list of zoom data related to each axis.
|
|
96
|
+
*/
|
|
97
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
98
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
99
|
+
end: PropTypes.number.isRequired,
|
|
100
|
+
start: PropTypes.number.isRequired
|
|
101
|
+
})),
|
|
87
102
|
/**
|
|
88
103
|
* The margin between the SVG and the drawing area.
|
|
89
104
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
90
105
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
91
|
-
* @default object Depends on the charts type.
|
|
92
106
|
*/
|
|
93
107
|
margin: PropTypes.shape({
|
|
94
108
|
bottom: PropTypes.number,
|
|
@@ -108,34 +122,22 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
|
108
122
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
109
123
|
*/
|
|
110
124
|
onZoomChange: PropTypes.func,
|
|
111
|
-
/**
|
|
112
|
-
* An array of plugins defining how to preprocess data.
|
|
113
|
-
* If not provided, the container supports line, bar, scatter and pie charts.
|
|
114
|
-
*/
|
|
115
|
-
plugins: PropTypes.arrayOf(PropTypes.object),
|
|
116
125
|
/**
|
|
117
126
|
* The array of series to display.
|
|
118
127
|
* Each type of series has its own specificity.
|
|
119
128
|
* Please refer to the appropriate docs page to learn more about it.
|
|
120
129
|
*/
|
|
121
|
-
series: PropTypes.arrayOf(PropTypes.object)
|
|
130
|
+
series: PropTypes.arrayOf(PropTypes.object),
|
|
122
131
|
/**
|
|
123
132
|
* If `true`, animations are skipped.
|
|
124
133
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
125
134
|
*/
|
|
126
135
|
skipAnimation: PropTypes.bool,
|
|
127
|
-
|
|
128
|
-
title: PropTypes.string,
|
|
129
|
-
viewBox: PropTypes.shape({
|
|
130
|
-
height: PropTypes.number,
|
|
131
|
-
width: PropTypes.number,
|
|
132
|
-
x: PropTypes.number,
|
|
133
|
-
y: PropTypes.number
|
|
134
|
-
}),
|
|
136
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
135
137
|
/**
|
|
136
|
-
* The width of the chart in px.
|
|
138
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
137
139
|
*/
|
|
138
|
-
width: PropTypes.number
|
|
140
|
+
width: PropTypes.number,
|
|
139
141
|
/**
|
|
140
142
|
* The configuration of the x-axes.
|
|
141
143
|
* If not provided, a default axis config is used.
|
|
@@ -167,7 +169,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
|
167
169
|
hideTooltip: PropTypes.bool,
|
|
168
170
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
169
171
|
label: PropTypes.string,
|
|
170
|
-
labelFontSize: PropTypes.number,
|
|
171
172
|
labelStyle: PropTypes.object,
|
|
172
173
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
173
174
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -178,7 +179,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
|
178
179
|
slots: PropTypes.object,
|
|
179
180
|
stroke: PropTypes.string,
|
|
180
181
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
181
|
-
tickFontSize: PropTypes.number,
|
|
182
182
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
183
183
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
184
184
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -230,7 +230,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
|
230
230
|
hideTooltip: PropTypes.bool,
|
|
231
231
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
232
232
|
label: PropTypes.string,
|
|
233
|
-
labelFontSize: PropTypes.number,
|
|
234
233
|
labelStyle: PropTypes.object,
|
|
235
234
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
236
235
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -241,7 +240,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
|
241
240
|
slots: PropTypes.object,
|
|
242
241
|
stroke: PropTypes.string,
|
|
243
242
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
244
|
-
tickFontSize: PropTypes.number,
|
|
245
243
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
246
244
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
247
245
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -286,14 +284,6 @@ process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
|
286
284
|
id: PropTypes.string,
|
|
287
285
|
max: PropTypes.number,
|
|
288
286
|
min: PropTypes.number
|
|
289
|
-
})),
|
|
290
|
-
/**
|
|
291
|
-
* The list of zoom data related to each axis.
|
|
292
|
-
*/
|
|
293
|
-
zoom: PropTypes.arrayOf(PropTypes.shape({
|
|
294
|
-
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
295
|
-
end: PropTypes.number.isRequired,
|
|
296
|
-
start: PropTypes.number.isRequired
|
|
297
287
|
}))
|
|
298
288
|
} : void 0;
|
|
299
289
|
export { ChartDataProviderPro };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useChartDataProviderProps } from '@mui/x-charts/internals';
|
|
4
|
+
export const useChartDataProviderProProps = props => {
|
|
5
|
+
const {
|
|
6
|
+
animationProviderProps,
|
|
7
|
+
chartProviderProps,
|
|
8
|
+
children
|
|
9
|
+
} = useChartDataProviderProps(props);
|
|
10
|
+
return {
|
|
11
|
+
children,
|
|
12
|
+
animationProviderProps,
|
|
13
|
+
chartProviderProps
|
|
14
|
+
};
|
|
15
|
+
};
|
|
@@ -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`.
|
|
@@ -140,12 +148,26 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
140
148
|
*/
|
|
141
149
|
height: PropTypes.number,
|
|
142
150
|
/**
|
|
143
|
-
* The
|
|
151
|
+
* The highlighted item.
|
|
152
|
+
* Used when the highlight is controlled.
|
|
144
153
|
*/
|
|
145
154
|
highlightedItem: PropTypes.shape({
|
|
146
155
|
dataIndex: PropTypes.number,
|
|
147
|
-
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
156
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired
|
|
148
157
|
}),
|
|
158
|
+
/**
|
|
159
|
+
* This prop is used to help implement the accessibility logic.
|
|
160
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
161
|
+
*/
|
|
162
|
+
id: PropTypes.string,
|
|
163
|
+
/**
|
|
164
|
+
* The list of zoom data related to each axis.
|
|
165
|
+
*/
|
|
166
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
167
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
168
|
+
end: PropTypes.number.isRequired,
|
|
169
|
+
start: PropTypes.number.isRequired
|
|
170
|
+
})),
|
|
149
171
|
/**
|
|
150
172
|
* Indicate which axis to display the left of the charts.
|
|
151
173
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -161,7 +183,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
161
183
|
* The margin between the SVG and the drawing area.
|
|
162
184
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
163
185
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
164
|
-
* @default object Depends on the charts type.
|
|
165
186
|
*/
|
|
166
187
|
margin: PropTypes.shape({
|
|
167
188
|
bottom: PropTypes.number,
|
|
@@ -193,6 +214,11 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
193
214
|
* An array of [[HeatmapSeriesType]] objects.
|
|
194
215
|
*/
|
|
195
216
|
series: PropTypes.arrayOf(PropTypes.object).isRequired,
|
|
217
|
+
/**
|
|
218
|
+
* The configuration helpers used to compute attributes according to the serries type.
|
|
219
|
+
* @ignore Unstable props for internal usage.
|
|
220
|
+
*/
|
|
221
|
+
seriesConfig: PropTypes.object,
|
|
196
222
|
/**
|
|
197
223
|
* The props used for each component slot.
|
|
198
224
|
* @default {}
|
|
@@ -204,6 +230,7 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
204
230
|
*/
|
|
205
231
|
slots: PropTypes.object,
|
|
206
232
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
233
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
207
234
|
title: PropTypes.string,
|
|
208
235
|
/**
|
|
209
236
|
* The configuration of the tooltip.
|
|
@@ -253,7 +280,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
253
280
|
hideTooltip: PropTypes.bool,
|
|
254
281
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
255
282
|
label: PropTypes.string,
|
|
256
|
-
labelFontSize: PropTypes.number,
|
|
257
283
|
labelStyle: PropTypes.object,
|
|
258
284
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
259
285
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -264,7 +290,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
264
290
|
slots: PropTypes.object,
|
|
265
291
|
stroke: PropTypes.string,
|
|
266
292
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
267
|
-
tickFontSize: PropTypes.number,
|
|
268
293
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
269
294
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
270
295
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -318,7 +343,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
318
343
|
hideTooltip: PropTypes.bool,
|
|
319
344
|
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
320
345
|
label: PropTypes.string,
|
|
321
|
-
labelFontSize: PropTypes.number,
|
|
322
346
|
labelStyle: PropTypes.object,
|
|
323
347
|
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
324
348
|
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
@@ -329,7 +353,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
329
353
|
slots: PropTypes.object,
|
|
330
354
|
stroke: PropTypes.string,
|
|
331
355
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
332
|
-
tickFontSize: PropTypes.number,
|
|
333
356
|
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
334
357
|
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
335
358
|
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
@@ -6,7 +6,7 @@ import PropTypes from 'prop-types';
|
|
|
6
6
|
import { styled } from '@mui/material/styles';
|
|
7
7
|
import useSlotProps from '@mui/utils/useSlotProps';
|
|
8
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
9
|
-
import { useItemHighlighted } from '@mui/x-charts/
|
|
9
|
+
import { useItemHighlighted } from '@mui/x-charts/hooks';
|
|
10
10
|
import { useInteractionItemProps } from '@mui/x-charts/internals';
|
|
11
11
|
import { getHeatmapUtilityClass } from "./heatmapClasses.js";
|
|
12
12
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
@@ -4,10 +4,11 @@ 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 clsx from 'clsx';
|
|
7
|
+
import HTMLElementType from '@mui/utils/HTMLElementType';
|
|
7
8
|
import composeClasses from '@mui/utils/composeClasses';
|
|
8
|
-
import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell,
|
|
9
|
+
import { ChartsTooltipPaper, ChartsTooltipTable, ChartsTooltipRow, ChartsTooltipCell, useItemTooltip, getChartsTooltipUtilityClass, ChartsTooltipContainer } from '@mui/x-charts/ChartsTooltip';
|
|
9
10
|
import { useXAxis, useYAxis } from '@mui/x-charts/hooks';
|
|
10
|
-
import { getLabel } from '@mui/x-charts/internals';
|
|
11
|
+
import { getLabel, ChartsLabelMark } from '@mui/x-charts/internals';
|
|
11
12
|
import { useHeatmapSeries } from "../hooks/useSeries.js";
|
|
12
13
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
14
|
const useUtilityClasses = ownerState => {
|
|
@@ -27,10 +28,6 @@ const useUtilityClasses = ownerState => {
|
|
|
27
28
|
};
|
|
28
29
|
return composeClasses(slots, getChartsTooltipUtilityClass, classes);
|
|
29
30
|
};
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* @ignore - internal component.
|
|
33
|
-
*/
|
|
34
31
|
function DefaultHeatmapTooltipContent(props) {
|
|
35
32
|
const {
|
|
36
33
|
classes
|
|
@@ -50,7 +47,8 @@ function DefaultHeatmapTooltipContent(props) {
|
|
|
50
47
|
const {
|
|
51
48
|
color,
|
|
52
49
|
value,
|
|
53
|
-
identifier
|
|
50
|
+
identifier,
|
|
51
|
+
markType
|
|
54
52
|
} = tooltipData;
|
|
55
53
|
const [xIndex, yIndex] = value;
|
|
56
54
|
const formattedX = xAxis.valueFormatter?.(xAxis.data[xIndex], {
|
|
@@ -83,7 +81,8 @@ function DefaultHeatmapTooltipContent(props) {
|
|
|
83
81
|
className: classes?.row,
|
|
84
82
|
children: [/*#__PURE__*/_jsx(ChartsTooltipCell, {
|
|
85
83
|
className: clsx(classes?.markCell, classes?.cell),
|
|
86
|
-
children: /*#__PURE__*/_jsx(
|
|
84
|
+
children: /*#__PURE__*/_jsx(ChartsLabelMark, {
|
|
85
|
+
type: markType,
|
|
87
86
|
color: color,
|
|
88
87
|
className: classes?.mark
|
|
89
88
|
})
|
|
@@ -132,26 +131,7 @@ process.env.NODE_ENV !== "production" ? HeatmapTooltip.propTypes = {
|
|
|
132
131
|
* It's used to set the position of the popper.
|
|
133
132
|
* The return value will passed as the reference object of the Popper instance.
|
|
134
133
|
*/
|
|
135
|
-
anchorEl: PropTypes
|
|
136
|
-
if (props[propName] == null) {
|
|
137
|
-
return new Error(`Prop '${propName}' is required but wasn't specified`);
|
|
138
|
-
}
|
|
139
|
-
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
140
|
-
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
141
|
-
}
|
|
142
|
-
return null;
|
|
143
|
-
}, PropTypes.func, PropTypes.shape({
|
|
144
|
-
contextElement: (props, propName) => {
|
|
145
|
-
if (props[propName] == null) {
|
|
146
|
-
return null;
|
|
147
|
-
}
|
|
148
|
-
if (typeof props[propName] !== 'object' || props[propName].nodeType !== 1) {
|
|
149
|
-
return new Error(`Expected prop '${propName}' to be of type Element`);
|
|
150
|
-
}
|
|
151
|
-
return null;
|
|
152
|
-
},
|
|
153
|
-
getBoundingClientRect: PropTypes.func.isRequired
|
|
154
|
-
})]),
|
|
134
|
+
anchorEl: PropTypes /* @typescript-to-proptypes-ignore */.oneOfType([HTMLElementType, PropTypes.object, PropTypes.func]),
|
|
155
135
|
/**
|
|
156
136
|
* Override or extend the styles applied to the component.
|
|
157
137
|
*/
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
2
|
-
import
|
|
2
|
+
import generateUtilityClass from '@mui/utils/generateUtilityClass';
|
|
3
|
+
import generateUtilityClasses from '@mui/utils/generateUtilityClasses';
|
|
3
4
|
export function getHeatmapUtilityClass(slot) {
|
|
4
5
|
// Those should be common to all charts
|
|
5
6
|
if (['highlighted', 'faded'].includes(slot)) {
|
package/modern/Heatmap/plugin.js
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { getBaseExtremum } from "./extremums.js";
|
|
2
2
|
import formatter from "./formatter.js";
|
|
3
3
|
import getColor from "./getColor.js";
|
|
4
|
+
import tooltipGetter from "./tooltip.js";
|
|
4
5
|
export const plugin = {
|
|
5
|
-
|
|
6
|
-
seriesFormatter: formatter,
|
|
6
|
+
seriesProcessor: formatter,
|
|
7
7
|
colorProcessor: getColor,
|
|
8
|
+
legendGetter: () => [],
|
|
9
|
+
tooltipGetter,
|
|
8
10
|
xExtremumGetter: getBaseExtremum,
|
|
9
11
|
yExtremumGetter: getBaseExtremum
|
|
10
12
|
};
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { getLabel } from '@mui/x-charts/internals';
|
|
2
|
+
const tooltipGetter = params => {
|
|
3
|
+
const {
|
|
4
|
+
series,
|
|
5
|
+
getColor,
|
|
6
|
+
identifier
|
|
7
|
+
} = params;
|
|
8
|
+
if (!identifier || identifier.dataIndex === undefined) {
|
|
9
|
+
return null;
|
|
10
|
+
}
|
|
11
|
+
const label = getLabel(series.label, 'tooltip');
|
|
12
|
+
const value = series.data[identifier.dataIndex];
|
|
13
|
+
const formattedValue = series.valueFormatter(value, {
|
|
14
|
+
dataIndex: identifier.dataIndex
|
|
15
|
+
});
|
|
16
|
+
return {
|
|
17
|
+
identifier,
|
|
18
|
+
color: getColor(identifier.dataIndex),
|
|
19
|
+
label,
|
|
20
|
+
value,
|
|
21
|
+
formattedValue,
|
|
22
|
+
markType: series.labelMarkType
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export default tooltipGetter;
|