@mui/x-charts-pro 8.0.0-alpha.7 → 8.0.0-alpha.9
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 +55 -20
- package/CHANGELOG.md +551 -3
- package/ChartContainerPro/ChartContainerPro.d.ts +33 -4
- package/ChartContainerPro/ChartContainerPro.js +52 -27
- package/ChartContainerPro/useChartContainerProProps.d.ts +6 -5
- package/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/ChartDataProviderPro/ChartDataProviderPro.d.ts +37 -0
- package/ChartDataProviderPro/ChartDataProviderPro.js +292 -0
- package/{context → ChartDataProviderPro}/package.json +1 -1
- package/ChartDataProviderPro/useChartDataProviderProProps.d.ts +8 -0
- package/ChartDataProviderPro/useChartDataProviderProProps.js +17 -0
- 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 +2 -2
- package/LineChartPro/LineChartPro.d.ts +2 -2
- package/LineChartPro/LineChartPro.js +58 -37
- package/ScatterChartPro/ScatterChartPro.d.ts +2 -2
- package/ScatterChartPro/ScatterChartPro.js +36 -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 +3 -1
- package/index.js +5 -5
- package/internals/plugins/allPlugins.d.ts +10 -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 +1 -1
- package/models/index.d.ts +1 -0
- package/models/index.js +2 -1
- package/modern/BarChartPro/BarChartPro.js +55 -20
- package/modern/ChartContainerPro/ChartContainerPro.js +52 -27
- package/modern/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/modern/ChartDataProviderPro/ChartDataProviderPro.js +292 -0
- package/modern/ChartDataProviderPro/useChartDataProviderProProps.js +17 -0
- 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 +2 -2
- package/modern/LineChartPro/LineChartPro.js +58 -37
- package/modern/ScatterChartPro/ScatterChartPro.js +36 -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 +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 +1 -1
- package/modern/models/index.js +2 -1
- package/node/BarChartPro/BarChartPro.js +55 -20
- package/node/ChartContainerPro/ChartContainerPro.js +51 -26
- package/node/ChartContainerPro/useChartContainerProProps.js +11 -5
- package/node/ChartDataProviderPro/ChartDataProviderPro.js +298 -0
- package/node/ChartDataProviderPro/useChartDataProviderProProps.js +23 -0
- 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 +2 -2
- package/node/LineChartPro/LineChartPro.js +58 -37
- package/node/ScatterChartPro/ScatterChartPro.js +36 -28
- 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 +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/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/ChartDataProviderPro.js +0 -50
- 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/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
|
@@ -3,33 +3,58 @@
|
|
|
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 { Watermark } from '@mui/x-license/Watermark';
|
|
7
6
|
import { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
8
|
-
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
9
|
-
import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
|
|
10
7
|
import { useChartContainerProProps } from "./useChartContainerProProps.js";
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
8
|
+
import { ChartDataProviderPro } from "../ChartDataProviderPro/index.js";
|
|
9
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
|
+
/**
|
|
11
|
+
* It sets up the data providers as well as the `<svg>` for the chart.
|
|
12
|
+
*
|
|
13
|
+
* This is a combination of both the `ChartDataProviderPro` and `ChartsSurface` components.
|
|
14
|
+
*
|
|
15
|
+
* Demos:
|
|
16
|
+
*
|
|
17
|
+
* - [Composition](https://mui.com/x/api/charts/composition/)
|
|
18
|
+
*
|
|
19
|
+
* API:
|
|
20
|
+
*
|
|
21
|
+
* - [ChartContainer API](https://mui.com/x/api/charts/chart-container/)
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```jsx
|
|
25
|
+
* <ChartContainerPro
|
|
26
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
27
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
28
|
+
* >
|
|
29
|
+
* <BarPlot />
|
|
30
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
31
|
+
* </ChartContainerPro>
|
|
32
|
+
* ```
|
|
33
|
+
*/
|
|
34
|
+
const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainerProInner(props, ref) {
|
|
14
35
|
const {
|
|
15
36
|
chartDataProviderProProps,
|
|
16
37
|
children,
|
|
17
38
|
chartsSurfaceProps
|
|
18
39
|
} = useChartContainerProProps(props, ref);
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
-
children:
|
|
40
|
+
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
41
|
+
children: /*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
21
42
|
children: children
|
|
22
|
-
}))
|
|
23
|
-
packageName: "x-charts-pro",
|
|
24
|
-
releaseInfo: releaseInfo
|
|
25
|
-
})]
|
|
43
|
+
}))
|
|
26
44
|
}));
|
|
27
45
|
});
|
|
46
|
+
|
|
47
|
+
// @ts-expect-error the type coercion breaks the prop types
|
|
28
48
|
process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
29
49
|
// ----------------------------- Warning --------------------------------
|
|
30
50
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
31
51
|
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
32
52
|
// ----------------------------------------------------------------------
|
|
53
|
+
apiRef: PropTypes.shape({
|
|
54
|
+
current: PropTypes.shape({
|
|
55
|
+
setZoomData: PropTypes.func.isRequired
|
|
56
|
+
})
|
|
57
|
+
}),
|
|
33
58
|
children: PropTypes.node,
|
|
34
59
|
className: PropTypes.string,
|
|
35
60
|
/**
|
|
@@ -59,11 +84,23 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
|
59
84
|
dataIndex: PropTypes.number,
|
|
60
85
|
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
61
86
|
}),
|
|
87
|
+
/**
|
|
88
|
+
* This prop is used to help implement the accessibility logic.
|
|
89
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
90
|
+
*/
|
|
91
|
+
id: PropTypes.string,
|
|
92
|
+
/**
|
|
93
|
+
* The list of zoom data related to each axis.
|
|
94
|
+
*/
|
|
95
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
96
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
97
|
+
end: PropTypes.number.isRequired,
|
|
98
|
+
start: PropTypes.number.isRequired
|
|
99
|
+
})),
|
|
62
100
|
/**
|
|
63
101
|
* The margin between the SVG and the drawing area.
|
|
64
102
|
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
65
103
|
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
66
|
-
* @default object Depends on the charts type.
|
|
67
104
|
*/
|
|
68
105
|
margin: PropTypes.shape({
|
|
69
106
|
bottom: PropTypes.number,
|
|
@@ -83,23 +120,19 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
|
83
120
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
84
121
|
*/
|
|
85
122
|
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
123
|
/**
|
|
92
124
|
* The array of series to display.
|
|
93
125
|
* Each type of series has its own specificity.
|
|
94
126
|
* Please refer to the appropriate docs page to learn more about it.
|
|
95
127
|
*/
|
|
96
|
-
series: PropTypes.arrayOf(PropTypes.object)
|
|
128
|
+
series: PropTypes.arrayOf(PropTypes.object),
|
|
97
129
|
/**
|
|
98
130
|
* If `true`, animations are skipped.
|
|
99
131
|
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
100
132
|
*/
|
|
101
133
|
skipAnimation: PropTypes.bool,
|
|
102
134
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
135
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
103
136
|
title: PropTypes.string,
|
|
104
137
|
/**
|
|
105
138
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
@@ -251,14 +284,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
|
251
284
|
id: PropTypes.string,
|
|
252
285
|
max: PropTypes.number,
|
|
253
286
|
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
287
|
}))
|
|
263
288
|
} : void 0;
|
|
264
289
|
export { ChartContainerPro };
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { UseChartContainerPropsReturnValue } from '@mui/x-charts/internals';
|
|
1
|
+
import { ChartSeriesType, UseChartContainerPropsReturnValue } from '@mui/x-charts/internals';
|
|
2
2
|
import * as React from 'react';
|
|
3
|
-
import
|
|
3
|
+
import { ChartDataProviderProps } from '@mui/x-charts/ChartDataProvider';
|
|
4
4
|
import type { ChartContainerProProps } from './ChartContainerPro';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { AllPluginSignatures } from '../internals/plugins/allPlugins';
|
|
6
|
+
export type UseChartContainerProPropsReturnValue<TSeries extends ChartSeriesType> = Pick<UseChartContainerPropsReturnValue<TSeries>, 'chartsSurfaceProps' | 'children'> & {
|
|
7
|
+
chartDataProviderProProps: ChartDataProviderProps<TSeries, AllPluginSignatures<TSeries>>;
|
|
7
8
|
};
|
|
8
|
-
export declare const useChartContainerProProps: (props: ChartContainerProProps
|
|
9
|
+
export declare const useChartContainerProProps: <TSeries extends ChartSeriesType = keyof import("@mui/x-charts/internals").ChartsSeriesConfig>(props: ChartContainerProProps<TSeries>, ref: React.Ref<SVGSVGElement>) => UseChartContainerProPropsReturnValue<TSeries>;
|
|
@@ -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
|
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { ChartSeriesType, ChartAnyPluginSignature } from '@mui/x-charts/internals';
|
|
3
|
+
import { ChartDataProviderProps } from '@mui/x-charts/ChartDataProvider';
|
|
4
|
+
import { AllPluginSignatures } from '../internals/plugins/allPlugins';
|
|
5
|
+
export type ChartDataProviderProProps<TSeries extends ChartSeriesType = ChartSeriesType, TSignatures extends readonly ChartAnyPluginSignature[] = AllPluginSignatures<TSeries>> = ChartDataProviderProps<TSeries, TSignatures>;
|
|
6
|
+
/**
|
|
7
|
+
* Orchestrates the data providers for the chart components and hooks.
|
|
8
|
+
*
|
|
9
|
+
* Use this component if you have custom HTML components that need to access the chart data.
|
|
10
|
+
*
|
|
11
|
+
* Demos:
|
|
12
|
+
*
|
|
13
|
+
* - [Composition](https://mui.com/x/api/charts/composition/)
|
|
14
|
+
*
|
|
15
|
+
* API:
|
|
16
|
+
*
|
|
17
|
+
* - [ChartDataProviderPro API](https://mui.com/x/api/charts/chart-data-provider/)
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```jsx
|
|
21
|
+
* <ChartDataProviderPro
|
|
22
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
23
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
24
|
+
* >
|
|
25
|
+
* <ChartsSurface>
|
|
26
|
+
* <BarPlot />
|
|
27
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
28
|
+
* </ChartsSurface>
|
|
29
|
+
* {'Custom Legend Component'}
|
|
30
|
+
* </ChartDataProviderPro>
|
|
31
|
+
* ```
|
|
32
|
+
*/
|
|
33
|
+
declare function ChartDataProviderPro<TSeries extends ChartSeriesType = ChartSeriesType>(props: ChartDataProviderProProps<TSeries>): React.JSX.Element;
|
|
34
|
+
declare namespace ChartDataProviderPro {
|
|
35
|
+
var propTypes: any;
|
|
36
|
+
}
|
|
37
|
+
export { ChartDataProviderPro };
|
|
@@ -0,0 +1,292 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import _extends from "@babel/runtime/helpers/esm/extends";
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import PropTypes from 'prop-types';
|
|
6
|
+
import { Watermark } from '@mui/x-license/Watermark';
|
|
7
|
+
import { ChartProvider, AnimationProvider } from '@mui/x-charts/internals';
|
|
8
|
+
import { HighlightedProvider } from '@mui/x-charts/context';
|
|
9
|
+
import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
|
|
10
|
+
import { useChartDataProviderProProps } from "./useChartDataProviderProProps.js";
|
|
11
|
+
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
const releaseInfo = getReleaseInfo();
|
|
14
|
+
const packageIdentifier = 'x-charts-pro';
|
|
15
|
+
/**
|
|
16
|
+
* Orchestrates the data providers for the chart components and hooks.
|
|
17
|
+
*
|
|
18
|
+
* Use this component if you have custom HTML components that need to access the chart data.
|
|
19
|
+
*
|
|
20
|
+
* Demos:
|
|
21
|
+
*
|
|
22
|
+
* - [Composition](https://mui.com/x/api/charts/composition/)
|
|
23
|
+
*
|
|
24
|
+
* API:
|
|
25
|
+
*
|
|
26
|
+
* - [ChartDataProviderPro API](https://mui.com/x/api/charts/chart-data-provider/)
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```jsx
|
|
30
|
+
* <ChartDataProviderPro
|
|
31
|
+
* series={[{ label: "Label", type: "bar", data: [10, 20] }]}
|
|
32
|
+
* xAxis={[{ data: ["A", "B"], scaleType: "band", id: "x-axis" }]}
|
|
33
|
+
* >
|
|
34
|
+
* <ChartsSurface>
|
|
35
|
+
* <BarPlot />
|
|
36
|
+
* <ChartsXAxis position="bottom" axisId="x-axis" />
|
|
37
|
+
* </ChartsSurface>
|
|
38
|
+
* {'Custom Legend Component'}
|
|
39
|
+
* </ChartDataProviderPro>
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
function ChartDataProviderPro(props) {
|
|
43
|
+
const {
|
|
44
|
+
children,
|
|
45
|
+
highlightedProviderProps,
|
|
46
|
+
animationProviderProps,
|
|
47
|
+
chartProviderProps
|
|
48
|
+
} = useChartDataProviderProProps(props);
|
|
49
|
+
useLicenseVerifier(packageIdentifier, releaseInfo);
|
|
50
|
+
return /*#__PURE__*/_jsx(ChartProvider, _extends({}, chartProviderProps, {
|
|
51
|
+
children: /*#__PURE__*/_jsx(HighlightedProvider, _extends({}, highlightedProviderProps, {
|
|
52
|
+
children: /*#__PURE__*/_jsxs(AnimationProvider, _extends({}, animationProviderProps, {
|
|
53
|
+
children: [children, /*#__PURE__*/_jsx(Watermark, {
|
|
54
|
+
packageName: packageIdentifier,
|
|
55
|
+
releaseInfo: releaseInfo
|
|
56
|
+
})]
|
|
57
|
+
}))
|
|
58
|
+
}))
|
|
59
|
+
}));
|
|
60
|
+
}
|
|
61
|
+
process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
62
|
+
// ----------------------------- Warning --------------------------------
|
|
63
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
64
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
65
|
+
// ----------------------------------------------------------------------
|
|
66
|
+
apiRef: PropTypes.shape({
|
|
67
|
+
current: PropTypes.shape({
|
|
68
|
+
setZoomData: PropTypes.func.isRequired
|
|
69
|
+
})
|
|
70
|
+
}),
|
|
71
|
+
children: PropTypes.node,
|
|
72
|
+
/**
|
|
73
|
+
* Color palette used to colorize multiple series.
|
|
74
|
+
* @default blueberryTwilightPalette
|
|
75
|
+
*/
|
|
76
|
+
colors: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string), PropTypes.func]),
|
|
77
|
+
/**
|
|
78
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
79
|
+
*/
|
|
80
|
+
dataset: PropTypes.arrayOf(PropTypes.object),
|
|
81
|
+
/**
|
|
82
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
83
|
+
*/
|
|
84
|
+
height: PropTypes.number,
|
|
85
|
+
/**
|
|
86
|
+
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
87
|
+
*/
|
|
88
|
+
highlightedItem: PropTypes.shape({
|
|
89
|
+
dataIndex: PropTypes.number,
|
|
90
|
+
seriesId: PropTypes.oneOfType([PropTypes.number, PropTypes.string])
|
|
91
|
+
}),
|
|
92
|
+
/**
|
|
93
|
+
* This prop is used to help implement the accessibility logic.
|
|
94
|
+
* If you don't provide this prop. It falls back to a randomly generated id.
|
|
95
|
+
*/
|
|
96
|
+
id: PropTypes.string,
|
|
97
|
+
/**
|
|
98
|
+
* The list of zoom data related to each axis.
|
|
99
|
+
*/
|
|
100
|
+
initialZoom: PropTypes.arrayOf(PropTypes.shape({
|
|
101
|
+
axisId: PropTypes.oneOfType([PropTypes.number, PropTypes.string]).isRequired,
|
|
102
|
+
end: PropTypes.number.isRequired,
|
|
103
|
+
start: PropTypes.number.isRequired
|
|
104
|
+
})),
|
|
105
|
+
/**
|
|
106
|
+
* The margin between the SVG and the drawing area.
|
|
107
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
108
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
109
|
+
*/
|
|
110
|
+
margin: PropTypes.shape({
|
|
111
|
+
bottom: PropTypes.number,
|
|
112
|
+
left: PropTypes.number,
|
|
113
|
+
right: PropTypes.number,
|
|
114
|
+
top: PropTypes.number
|
|
115
|
+
}),
|
|
116
|
+
/**
|
|
117
|
+
* The callback fired when the highlighted item changes.
|
|
118
|
+
*
|
|
119
|
+
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
120
|
+
*/
|
|
121
|
+
onHighlightChange: PropTypes.func,
|
|
122
|
+
/**
|
|
123
|
+
* Callback fired when the zoom has changed.
|
|
124
|
+
*
|
|
125
|
+
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
126
|
+
*/
|
|
127
|
+
onZoomChange: PropTypes.func,
|
|
128
|
+
/**
|
|
129
|
+
* The array of series to display.
|
|
130
|
+
* Each type of series has its own specificity.
|
|
131
|
+
* Please refer to the appropriate docs page to learn more about it.
|
|
132
|
+
*/
|
|
133
|
+
series: PropTypes.arrayOf(PropTypes.object),
|
|
134
|
+
/**
|
|
135
|
+
* If `true`, animations are skipped.
|
|
136
|
+
* If unset or `false`, the animations respects the user's `prefers-reduced-motion` setting.
|
|
137
|
+
*/
|
|
138
|
+
skipAnimation: PropTypes.bool,
|
|
139
|
+
theme: PropTypes.oneOf(['dark', 'light']),
|
|
140
|
+
/**
|
|
141
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
142
|
+
*/
|
|
143
|
+
width: PropTypes.number,
|
|
144
|
+
/**
|
|
145
|
+
* The configuration of the x-axes.
|
|
146
|
+
* If not provided, a default axis config is used.
|
|
147
|
+
* An array of [[AxisConfig]] objects.
|
|
148
|
+
*/
|
|
149
|
+
xAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
150
|
+
classes: PropTypes.object,
|
|
151
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
152
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
153
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
154
|
+
unknownColor: PropTypes.string,
|
|
155
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
156
|
+
}), PropTypes.shape({
|
|
157
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
158
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
159
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
160
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
161
|
+
}), PropTypes.shape({
|
|
162
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
163
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
164
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
165
|
+
})]),
|
|
166
|
+
data: PropTypes.array,
|
|
167
|
+
dataKey: PropTypes.string,
|
|
168
|
+
disableLine: PropTypes.bool,
|
|
169
|
+
disableTicks: PropTypes.bool,
|
|
170
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
171
|
+
fill: PropTypes.string,
|
|
172
|
+
hideTooltip: PropTypes.bool,
|
|
173
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
174
|
+
label: PropTypes.string,
|
|
175
|
+
labelStyle: PropTypes.object,
|
|
176
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
177
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
178
|
+
position: PropTypes.oneOf(['bottom', 'top']),
|
|
179
|
+
reverse: PropTypes.bool,
|
|
180
|
+
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
181
|
+
slotProps: PropTypes.object,
|
|
182
|
+
slots: PropTypes.object,
|
|
183
|
+
stroke: PropTypes.string,
|
|
184
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
185
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
186
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
187
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
188
|
+
tickLabelStyle: PropTypes.object,
|
|
189
|
+
tickMaxStep: PropTypes.number,
|
|
190
|
+
tickMinStep: PropTypes.number,
|
|
191
|
+
tickNumber: PropTypes.number,
|
|
192
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
193
|
+
tickSize: PropTypes.number,
|
|
194
|
+
valueFormatter: PropTypes.func,
|
|
195
|
+
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
196
|
+
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
197
|
+
maxEnd: PropTypes.number,
|
|
198
|
+
maxSpan: PropTypes.number,
|
|
199
|
+
minSpan: PropTypes.number,
|
|
200
|
+
minStart: PropTypes.number,
|
|
201
|
+
panning: PropTypes.bool,
|
|
202
|
+
step: PropTypes.number
|
|
203
|
+
}), PropTypes.bool])
|
|
204
|
+
})),
|
|
205
|
+
/**
|
|
206
|
+
* The configuration of the y-axes.
|
|
207
|
+
* If not provided, a default axis config is used.
|
|
208
|
+
* An array of [[AxisConfig]] objects.
|
|
209
|
+
*/
|
|
210
|
+
yAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
211
|
+
classes: PropTypes.object,
|
|
212
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
213
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
214
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
215
|
+
unknownColor: PropTypes.string,
|
|
216
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
217
|
+
}), PropTypes.shape({
|
|
218
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
219
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
220
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
221
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
222
|
+
}), PropTypes.shape({
|
|
223
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
224
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
225
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
226
|
+
})]),
|
|
227
|
+
data: PropTypes.array,
|
|
228
|
+
dataKey: PropTypes.string,
|
|
229
|
+
disableLine: PropTypes.bool,
|
|
230
|
+
disableTicks: PropTypes.bool,
|
|
231
|
+
domainLimit: PropTypes.oneOfType([PropTypes.oneOf(['nice', 'strict']), PropTypes.func]),
|
|
232
|
+
fill: PropTypes.string,
|
|
233
|
+
hideTooltip: PropTypes.bool,
|
|
234
|
+
id: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
235
|
+
label: PropTypes.string,
|
|
236
|
+
labelStyle: PropTypes.object,
|
|
237
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
238
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
239
|
+
position: PropTypes.oneOf(['left', 'right']),
|
|
240
|
+
reverse: PropTypes.bool,
|
|
241
|
+
scaleType: PropTypes.oneOf(['band', 'linear', 'log', 'point', 'pow', 'sqrt', 'time', 'utc']),
|
|
242
|
+
slotProps: PropTypes.object,
|
|
243
|
+
slots: PropTypes.object,
|
|
244
|
+
stroke: PropTypes.string,
|
|
245
|
+
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
246
|
+
tickInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.array, PropTypes.func]),
|
|
247
|
+
tickLabelInterval: PropTypes.oneOfType([PropTypes.oneOf(['auto']), PropTypes.func]),
|
|
248
|
+
tickLabelPlacement: PropTypes.oneOf(['middle', 'tick']),
|
|
249
|
+
tickLabelStyle: PropTypes.object,
|
|
250
|
+
tickMaxStep: PropTypes.number,
|
|
251
|
+
tickMinStep: PropTypes.number,
|
|
252
|
+
tickNumber: PropTypes.number,
|
|
253
|
+
tickPlacement: PropTypes.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
254
|
+
tickSize: PropTypes.number,
|
|
255
|
+
valueFormatter: PropTypes.func,
|
|
256
|
+
zoom: PropTypes.oneOfType([PropTypes.shape({
|
|
257
|
+
filterMode: PropTypes.oneOf(['discard', 'keep']),
|
|
258
|
+
maxEnd: PropTypes.number,
|
|
259
|
+
maxSpan: PropTypes.number,
|
|
260
|
+
minSpan: PropTypes.number,
|
|
261
|
+
minStart: PropTypes.number,
|
|
262
|
+
panning: PropTypes.bool,
|
|
263
|
+
step: PropTypes.number
|
|
264
|
+
}), PropTypes.bool])
|
|
265
|
+
})),
|
|
266
|
+
/**
|
|
267
|
+
* The configuration of the z-axes.
|
|
268
|
+
*/
|
|
269
|
+
zAxis: PropTypes.arrayOf(PropTypes.shape({
|
|
270
|
+
colorMap: PropTypes.oneOfType([PropTypes.shape({
|
|
271
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
272
|
+
type: PropTypes.oneOf(['ordinal']).isRequired,
|
|
273
|
+
unknownColor: PropTypes.string,
|
|
274
|
+
values: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number, PropTypes.string]).isRequired)
|
|
275
|
+
}), PropTypes.shape({
|
|
276
|
+
color: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.string.isRequired), PropTypes.func]).isRequired,
|
|
277
|
+
max: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
278
|
+
min: PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]),
|
|
279
|
+
type: PropTypes.oneOf(['continuous']).isRequired
|
|
280
|
+
}), PropTypes.shape({
|
|
281
|
+
colors: PropTypes.arrayOf(PropTypes.string).isRequired,
|
|
282
|
+
thresholds: PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.instanceOf(Date), PropTypes.number]).isRequired).isRequired,
|
|
283
|
+
type: PropTypes.oneOf(['piecewise']).isRequired
|
|
284
|
+
})]),
|
|
285
|
+
data: PropTypes.array,
|
|
286
|
+
dataKey: PropTypes.string,
|
|
287
|
+
id: PropTypes.string,
|
|
288
|
+
max: PropTypes.number,
|
|
289
|
+
min: PropTypes.number
|
|
290
|
+
}))
|
|
291
|
+
} : void 0;
|
|
292
|
+
export { ChartDataProviderPro };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ChartSeriesType } from '@mui/x-charts/internals';
|
|
2
|
+
import type { ChartDataProviderProProps } from './ChartDataProviderPro';
|
|
3
|
+
export declare const useChartDataProviderProProps: <TSeries extends ChartSeriesType = keyof import("@mui/x-charts/internals").ChartsSeriesConfig>(props: ChartDataProviderProProps<TSeries>) => {
|
|
4
|
+
children: import("react").ReactNode;
|
|
5
|
+
highlightedProviderProps: Omit<import("@mui/x-charts").HighlightedProviderProps, "children">;
|
|
6
|
+
animationProviderProps: Omit<import("@mui/x-charts/internals").AnimationProviderProps, "children">;
|
|
7
|
+
chartProviderProps: Omit<import("@mui/x-charts/internals").ChartProviderProps<TSeries, import("../internals/plugins/allPlugins").AllPluginSignatures<TSeries>>, "children">;
|
|
8
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import { useChartDataProviderProps } from '@mui/x-charts/internals';
|
|
4
|
+
export const useChartDataProviderProProps = props => {
|
|
5
|
+
const {
|
|
6
|
+
animationProviderProps,
|
|
7
|
+
chartProviderProps,
|
|
8
|
+
highlightedProviderProps,
|
|
9
|
+
children
|
|
10
|
+
} = useChartDataProviderProps(props);
|
|
11
|
+
return {
|
|
12
|
+
children,
|
|
13
|
+
highlightedProviderProps,
|
|
14
|
+
animationProviderProps,
|
|
15
|
+
chartProviderProps
|
|
16
|
+
};
|
|
17
|
+
};
|
package/Heatmap/Heatmap.js
CHANGED
|
@@ -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/Heatmap/extremums.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
export declare const getBaseExtremum:
|
|
1
|
+
import { CartesianExtremumGetter } from '@mui/x-charts/internals';
|
|
2
|
+
export declare const getBaseExtremum: CartesianExtremumGetter<'heatmap'>;
|