@mui/x-charts-pro 8.0.0-alpha.0 → 8.0.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/BarChartPro/BarChartPro.js +3 -31
- package/CHANGELOG.md +429 -5
- package/ChartContainerPro/ChartContainerPro.js +13 -23
- package/ChartContainerPro/useChartContainerProProps.d.ts +2 -39
- package/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/Heatmap/Heatmap.d.ts +11 -4
- package/Heatmap/Heatmap.js +4 -35
- package/Heatmap/HeatmapTooltip.d.ts +9 -0
- package/Heatmap/HeatmapTooltip.js +294 -0
- package/Heatmap/index.d.ts +1 -1
- package/Heatmap/index.js +1 -1
- package/LineChartPro/LineChartPro.js +3 -32
- package/README.md +2 -2
- package/ScatterChartPro/ScatterChartPro.js +3 -32
- package/context/ChartDataProviderPro/ChartDataProviderPro.d.ts +4 -1
- package/context/ChartDataProviderPro/ChartDataProviderPro.js +22 -21
- package/context/ChartDataProviderPro/useChartDataProviderProProps.d.ts +3 -5
- package/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/index.js +1 -1
- package/internals/utils/releaseInfo.js +1 -1
- package/modern/BarChartPro/BarChartPro.js +3 -31
- package/modern/ChartContainerPro/ChartContainerPro.js +13 -23
- package/modern/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/modern/Heatmap/Heatmap.js +4 -35
- package/modern/Heatmap/HeatmapTooltip.js +294 -0
- package/modern/Heatmap/index.js +1 -1
- package/modern/LineChartPro/LineChartPro.js +3 -32
- package/modern/ScatterChartPro/ScatterChartPro.js +3 -32
- package/modern/context/ChartDataProviderPro/ChartDataProviderPro.js +22 -21
- package/modern/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/modern/index.js +1 -1
- package/modern/internals/utils/releaseInfo.js +1 -1
- package/node/BarChartPro/BarChartPro.js +3 -31
- package/node/ChartContainerPro/ChartContainerPro.js +13 -23
- package/node/ChartContainerPro/useChartContainerProProps.js +6 -4
- package/node/Heatmap/Heatmap.js +4 -35
- package/node/Heatmap/HeatmapTooltip.js +300 -0
- package/node/Heatmap/index.js +4 -4
- package/node/LineChartPro/LineChartPro.js +3 -32
- package/node/ScatterChartPro/ScatterChartPro.js +3 -32
- package/node/context/ChartDataProviderPro/ChartDataProviderPro.js +21 -20
- package/node/context/ChartDataProviderPro/useChartDataProviderProProps.js +6 -6
- package/node/index.js +1 -1
- package/node/internals/utils/releaseInfo.js +1 -1
- package/package.json +7 -7
- package/Heatmap/DefaultHeatmapTooltip.d.ts +0 -7
- package/Heatmap/DefaultHeatmapTooltip.js +0 -99
- package/modern/Heatmap/DefaultHeatmapTooltip.js +0 -99
- package/node/Heatmap/DefaultHeatmapTooltip.js +0 -105
|
@@ -3,44 +3,45 @@
|
|
|
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 { ChartsSurface } from '@mui/x-charts/ChartsSurface';
|
|
6
|
+
import { DrawingAreaProvider, InteractionProvider, PluginProvider, SeriesProvider, AnimationProvider, SvgRefProvider, SizeProvider } from '@mui/x-charts/internals';
|
|
8
7
|
import { HighlightedProvider, ZAxisContextProvider } from '@mui/x-charts/context';
|
|
9
8
|
import { useLicenseVerifier } from '@mui/x-license/useLicenseVerifier';
|
|
10
9
|
import { getReleaseInfo } from "../../internals/utils/releaseInfo.js";
|
|
11
10
|
import { CartesianProviderPro } from "../CartesianProviderPro/index.js";
|
|
12
11
|
import { ZoomProvider } from "../ZoomProvider/index.js";
|
|
13
12
|
import { useChartContainerProProps } from "./useChartDataProviderProProps.js";
|
|
14
|
-
import { jsx as _jsx
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
15
14
|
const releaseInfo = getReleaseInfo();
|
|
16
|
-
|
|
15
|
+
function ChartDataProviderPro(props) {
|
|
17
16
|
const {
|
|
18
17
|
zoomProviderProps,
|
|
19
|
-
|
|
18
|
+
drawingAreaProviderProps,
|
|
20
19
|
seriesProviderProps,
|
|
21
20
|
zAxisContextProps,
|
|
22
21
|
highlightedProviderProps,
|
|
23
22
|
cartesianProviderProps,
|
|
24
|
-
|
|
23
|
+
sizeProviderProps,
|
|
25
24
|
pluginProviderProps,
|
|
26
25
|
animationProviderProps,
|
|
27
26
|
children
|
|
28
|
-
} = useChartContainerProProps(props
|
|
27
|
+
} = useChartContainerProProps(props);
|
|
29
28
|
useLicenseVerifier('x-charts-pro', releaseInfo);
|
|
30
|
-
return /*#__PURE__*/_jsx(
|
|
31
|
-
children: /*#__PURE__*/_jsx(
|
|
32
|
-
children: /*#__PURE__*/_jsx(
|
|
33
|
-
children: /*#__PURE__*/_jsx(
|
|
34
|
-
children: /*#__PURE__*/_jsx(
|
|
35
|
-
children: /*#__PURE__*/_jsx(
|
|
36
|
-
children: /*#__PURE__*/_jsx(
|
|
37
|
-
children: /*#__PURE__*/_jsx(
|
|
38
|
-
children: /*#__PURE__*/_jsx(
|
|
39
|
-
children: /*#__PURE__*/
|
|
40
|
-
children:
|
|
29
|
+
return /*#__PURE__*/_jsx(SizeProvider, _extends({}, sizeProviderProps, {
|
|
30
|
+
children: /*#__PURE__*/_jsx(DrawingAreaProvider, _extends({}, drawingAreaProviderProps, {
|
|
31
|
+
children: /*#__PURE__*/_jsx(AnimationProvider, _extends({}, animationProviderProps, {
|
|
32
|
+
children: /*#__PURE__*/_jsx(PluginProvider, _extends({}, pluginProviderProps, {
|
|
33
|
+
children: /*#__PURE__*/_jsx(ZoomProvider, _extends({}, zoomProviderProps, {
|
|
34
|
+
children: /*#__PURE__*/_jsx(SeriesProvider, _extends({}, seriesProviderProps, {
|
|
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
|
+
})
|
|
41
42
|
}))
|
|
42
|
-
})
|
|
43
|
-
})
|
|
43
|
+
})
|
|
44
|
+
}))
|
|
44
45
|
}))
|
|
45
46
|
}))
|
|
46
47
|
}))
|
|
@@ -48,7 +49,7 @@ const ChartDataProviderPro = /*#__PURE__*/React.forwardRef(function ChartDataPro
|
|
|
48
49
|
}))
|
|
49
50
|
}))
|
|
50
51
|
}));
|
|
51
|
-
}
|
|
52
|
+
}
|
|
52
53
|
process.env.NODE_ENV !== "production" ? ChartDataProviderPro.propTypes = {
|
|
53
54
|
// ----------------------------- Warning --------------------------------
|
|
54
55
|
// | These PropTypes are generated from the TypeScript type definitions |
|
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
import { ZoomProviderProps } from '../ZoomProvider';
|
|
2
2
|
import type { ChartDataProviderProProps } from './ChartDataProviderPro';
|
|
3
|
-
export declare const useChartContainerProProps: (props: ChartDataProviderProProps
|
|
3
|
+
export declare const useChartContainerProProps: (props: ChartDataProviderProProps) => {
|
|
4
4
|
zoomProviderProps: Omit<ZoomProviderProps, "children">;
|
|
5
5
|
children: import("react").ReactNode;
|
|
6
|
-
|
|
6
|
+
drawingAreaProviderProps: Omit<import("@mui/x-charts/internals").DrawingAreaProviderProps, "children">;
|
|
7
7
|
pluginProviderProps: Omit<import("@mui/x-charts/internals").PluginProviderProps, "children">;
|
|
8
8
|
seriesProviderProps: Omit<import("@mui/x-charts/internals").SeriesProviderProps, "children">;
|
|
9
9
|
cartesianProviderProps: Omit<import("@mui/x-charts/internals").CartesianProviderProps, "children">;
|
|
10
10
|
zAxisContextProps: Omit<import("@mui/x-charts").ZAxisContextProviderProps, "children">;
|
|
11
11
|
highlightedProviderProps: Omit<import("@mui/x-charts").HighlightedProviderProps, "children">;
|
|
12
|
-
|
|
13
|
-
ref: any;
|
|
14
|
-
};
|
|
12
|
+
sizeProviderProps: Omit<import("@mui/x-charts/internals").SizeProviderProps, "children">;
|
|
15
13
|
animationProviderProps: Omit<import("@mui/x-charts/internals").AnimationProviderProps, "children">;
|
|
16
14
|
};
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/esm/objectWithoutPropertiesLoose";
|
|
4
4
|
const _excluded = ["zoom", "onZoomChange"];
|
|
5
5
|
import { useChartDataProviderProps } from '@mui/x-charts/internals';
|
|
6
|
-
export const useChartContainerProProps =
|
|
6
|
+
export const useChartContainerProProps = props => {
|
|
7
7
|
const {
|
|
8
8
|
zoom,
|
|
9
9
|
onZoomChange
|
|
@@ -11,17 +11,17 @@ export const useChartContainerProProps = (props, ref) => {
|
|
|
11
11
|
baseProps = _objectWithoutPropertiesLoose(props, _excluded);
|
|
12
12
|
const {
|
|
13
13
|
children,
|
|
14
|
-
|
|
14
|
+
drawingAreaProviderProps,
|
|
15
15
|
seriesProviderProps,
|
|
16
16
|
cartesianProviderProps,
|
|
17
17
|
zAxisContextProps,
|
|
18
18
|
highlightedProviderProps,
|
|
19
|
-
|
|
19
|
+
sizeProviderProps,
|
|
20
20
|
pluginProviderProps,
|
|
21
21
|
animationProviderProps,
|
|
22
22
|
xAxis,
|
|
23
23
|
yAxis
|
|
24
|
-
} = useChartDataProviderProps(baseProps
|
|
24
|
+
} = useChartDataProviderProps(baseProps);
|
|
25
25
|
const zoomProviderProps = {
|
|
26
26
|
zoom,
|
|
27
27
|
onZoomChange,
|
|
@@ -31,13 +31,13 @@ export const useChartContainerProProps = (props, ref) => {
|
|
|
31
31
|
return {
|
|
32
32
|
zoomProviderProps,
|
|
33
33
|
children,
|
|
34
|
-
|
|
34
|
+
drawingAreaProviderProps,
|
|
35
35
|
pluginProviderProps,
|
|
36
36
|
seriesProviderProps,
|
|
37
37
|
cartesianProviderProps,
|
|
38
38
|
zAxisContextProps,
|
|
39
39
|
highlightedProviderProps,
|
|
40
|
-
|
|
40
|
+
sizeProviderProps,
|
|
41
41
|
animationProviderProps
|
|
42
42
|
};
|
|
43
43
|
};
|
package/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ponyfillGlobal } from '@mui/utils';
|
|
2
2
|
export const getReleaseInfo = () => {
|
|
3
|
-
const releaseInfo = "
|
|
3
|
+
const releaseInfo = "MTczMjIzMDAwMDAwMA==";
|
|
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
|
|
@@ -99,9 +99,9 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
|
|
|
99
99
|
chartsAxisProps,
|
|
100
100
|
axisHighlightProps,
|
|
101
101
|
legendProps,
|
|
102
|
-
tooltipProps,
|
|
103
102
|
children
|
|
104
103
|
} = useBarChartProps(other);
|
|
104
|
+
const Tooltip = props.slots?.tooltip ?? ChartsTooltip;
|
|
105
105
|
return /*#__PURE__*/_jsxs(ChartContainerPro, _extends({
|
|
106
106
|
ref: ref
|
|
107
107
|
}, chartContainerProps, {
|
|
@@ -109,7 +109,7 @@ const BarChartPro = /*#__PURE__*/React.forwardRef(function BarChartPro(inProps,
|
|
|
109
109
|
onZoomChange: onZoomChange,
|
|
110
110
|
children: [props.onAxisClick && /*#__PURE__*/_jsx(ChartsOnAxisClickHandler, _extends({}, axisClickHandlerProps)), /*#__PURE__*/_jsx(ChartsGrid, _extends({}, gridProps)), /*#__PURE__*/_jsxs("g", _extends({}, clipPathGroupProps, {
|
|
111
111
|
children: [/*#__PURE__*/_jsx(BarChartPlotZoom, _extends({}, barPlotProps)), /*#__PURE__*/_jsx(ChartsOverlay, _extends({}, overlayProps)), /*#__PURE__*/_jsx(ChartsAxisHighlight, _extends({}, axisHighlightProps))]
|
|
112
|
-
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(
|
|
112
|
+
})), /*#__PURE__*/_jsx(ChartsAxis, _extends({}, chartsAxisProps)), !props.hideLegend && /*#__PURE__*/_jsx(ChartsLegend, _extends({}, legendProps)), !props.loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, props.slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, _extends({}, clipPathProps)), /*#__PURE__*/_jsx(ZoomSetup, {}), children]
|
|
113
113
|
}));
|
|
114
114
|
});
|
|
115
115
|
process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
@@ -121,7 +121,7 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
121
121
|
* The configuration of axes highlight.
|
|
122
122
|
* Default is set to 'band' in the bar direction.
|
|
123
123
|
* Depends on `layout` prop.
|
|
124
|
-
* @see See {@link https://mui.com/x/react-charts/highlighting highlighting docs} for more details.
|
|
124
|
+
* @see See {@link https://mui.com/x/react-charts/highlighting/ highlighting docs} for more details.
|
|
125
125
|
*/
|
|
126
126
|
axisHighlight: PropTypes.shape({
|
|
127
127
|
x: PropTypes.oneOf(['band', 'line', 'none']),
|
|
@@ -238,16 +238,6 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
238
238
|
* @param {ZoomData[]} zoomData Updated zoom data.
|
|
239
239
|
*/
|
|
240
240
|
onZoomChange: PropTypes.func,
|
|
241
|
-
/**
|
|
242
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
243
|
-
* before it renders for the first time.
|
|
244
|
-
*
|
|
245
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
246
|
-
* the first render, like when used inside a grid.
|
|
247
|
-
*
|
|
248
|
-
* @default false
|
|
249
|
-
*/
|
|
250
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
251
241
|
/**
|
|
252
242
|
* Indicate which axis to display the right of the charts.
|
|
253
243
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -276,30 +266,12 @@ process.env.NODE_ENV !== "production" ? BarChartPro.propTypes = {
|
|
|
276
266
|
slots: PropTypes.object,
|
|
277
267
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
278
268
|
title: PropTypes.string,
|
|
279
|
-
/**
|
|
280
|
-
* The configuration of the tooltip.
|
|
281
|
-
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
282
|
-
*/
|
|
283
|
-
tooltip: PropTypes.shape({
|
|
284
|
-
axisContent: PropTypes.elementType,
|
|
285
|
-
classes: PropTypes.object,
|
|
286
|
-
itemContent: PropTypes.elementType,
|
|
287
|
-
slotProps: PropTypes.object,
|
|
288
|
-
slots: PropTypes.object,
|
|
289
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
290
|
-
}),
|
|
291
269
|
/**
|
|
292
270
|
* Indicate which axis to display the top of the charts.
|
|
293
271
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
294
272
|
* @default null
|
|
295
273
|
*/
|
|
296
274
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
297
|
-
viewBox: PropTypes.shape({
|
|
298
|
-
height: PropTypes.number,
|
|
299
|
-
width: PropTypes.number,
|
|
300
|
-
x: PropTypes.number,
|
|
301
|
-
y: PropTypes.number
|
|
302
|
-
}),
|
|
303
275
|
/**
|
|
304
276
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
305
277
|
*/
|
|
@@ -5,6 +5,7 @@ import * as React from 'react';
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { Watermark } from '@mui/x-license/Watermark';
|
|
7
7
|
import { ResizableContainer } from '@mui/x-charts/internals';
|
|
8
|
+
import { ChartsSurface } from '@mui/x-charts';
|
|
8
9
|
import { getReleaseInfo } from "../internals/utils/releaseInfo.js";
|
|
9
10
|
import { ChartDataProviderPro } from "../context/ChartDataProviderPro/index.js";
|
|
10
11
|
import { useChartContainerProProps } from "./useChartContainerProProps.js";
|
|
@@ -13,14 +14,19 @@ const releaseInfo = getReleaseInfo();
|
|
|
13
14
|
const ChartContainerPro = /*#__PURE__*/React.forwardRef(function ChartContainerPro(props, ref) {
|
|
14
15
|
const {
|
|
15
16
|
chartDataProviderProProps,
|
|
16
|
-
|
|
17
|
-
|
|
17
|
+
children,
|
|
18
|
+
resizableContainerProps,
|
|
19
|
+
chartsSurfaceProps
|
|
18
20
|
} = useChartContainerProProps(props, ref);
|
|
19
|
-
return /*#__PURE__*/
|
|
20
|
-
children:
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
return /*#__PURE__*/_jsx(ChartDataProviderPro, _extends({}, chartDataProviderProProps, {
|
|
22
|
+
children: /*#__PURE__*/_jsxs(ResizableContainer, _extends({}, resizableContainerProps, {
|
|
23
|
+
children: [/*#__PURE__*/_jsx(ChartsSurface, _extends({}, chartsSurfaceProps, {
|
|
24
|
+
children: children
|
|
25
|
+
})), /*#__PURE__*/_jsx(Watermark, {
|
|
26
|
+
packageName: "x-charts-pro",
|
|
27
|
+
releaseInfo: releaseInfo
|
|
28
|
+
})]
|
|
29
|
+
}))
|
|
24
30
|
}));
|
|
25
31
|
});
|
|
26
32
|
process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
@@ -86,16 +92,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
|
86
92
|
* If not provided, the container supports line, bar, scatter and pie charts.
|
|
87
93
|
*/
|
|
88
94
|
plugins: PropTypes.arrayOf(PropTypes.object),
|
|
89
|
-
/**
|
|
90
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
91
|
-
* before it renders for the first time.
|
|
92
|
-
*
|
|
93
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
94
|
-
* the first render, like when used inside a grid.
|
|
95
|
-
*
|
|
96
|
-
* @default false
|
|
97
|
-
*/
|
|
98
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
99
95
|
/**
|
|
100
96
|
* The array of series to display.
|
|
101
97
|
* Each type of series has its own specificity.
|
|
@@ -109,12 +105,6 @@ process.env.NODE_ENV !== "production" ? ChartContainerPro.propTypes = {
|
|
|
109
105
|
skipAnimation: PropTypes.bool,
|
|
110
106
|
sx: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.func, PropTypes.object, PropTypes.bool])), PropTypes.func, PropTypes.object]),
|
|
111
107
|
title: PropTypes.string,
|
|
112
|
-
viewBox: PropTypes.shape({
|
|
113
|
-
height: PropTypes.number,
|
|
114
|
-
width: PropTypes.number,
|
|
115
|
-
x: PropTypes.number,
|
|
116
|
-
y: PropTypes.number
|
|
117
|
-
}),
|
|
118
108
|
/**
|
|
119
109
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
120
110
|
*/
|
|
@@ -16,12 +16,14 @@ export const useChartContainerProProps = (props, ref) => {
|
|
|
16
16
|
};
|
|
17
17
|
const {
|
|
18
18
|
chartDataProviderProps,
|
|
19
|
-
|
|
20
|
-
|
|
19
|
+
chartsSurfaceProps,
|
|
20
|
+
resizableContainerProps,
|
|
21
|
+
children
|
|
21
22
|
} = useChartContainerProps(baseProps, ref);
|
|
22
23
|
return {
|
|
23
24
|
chartDataProviderProProps: _extends({}, chartDataProviderProps, chartDataProviderProProps),
|
|
24
|
-
|
|
25
|
-
|
|
25
|
+
resizableContainerProps,
|
|
26
|
+
chartsSurfaceProps,
|
|
27
|
+
children
|
|
26
28
|
};
|
|
27
29
|
};
|
|
@@ -7,14 +7,13 @@ import { useThemeProps } from '@mui/material/styles';
|
|
|
7
7
|
import useId from '@mui/utils/useId';
|
|
8
8
|
import { interpolateRgbBasis } from '@mui/x-charts-vendor/d3-interpolate';
|
|
9
9
|
import { ChartsAxis } from '@mui/x-charts/ChartsAxis';
|
|
10
|
-
import { ChartsTooltip } from '@mui/x-charts/ChartsTooltip';
|
|
11
10
|
import { ChartsClipPath } from '@mui/x-charts/ChartsClipPath';
|
|
12
11
|
import { ChartsOnAxisClickHandler } from '@mui/x-charts/ChartsOnAxisClickHandler';
|
|
13
12
|
import { ChartsOverlay } from '@mui/x-charts/ChartsOverlay';
|
|
14
13
|
import { ChartContainerPro } from "../ChartContainerPro/index.js";
|
|
15
14
|
import { HeatmapPlot } from "./HeatmapPlot.js";
|
|
16
15
|
import { plugin as heatmapPlugin } from "./plugin.js";
|
|
17
|
-
import {
|
|
16
|
+
import { HeatmapTooltip } from "./HeatmapTooltip.js";
|
|
18
17
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
19
18
|
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
20
19
|
const defaultColorMap = interpolateRgbBasis(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
@@ -34,7 +33,6 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
34
33
|
colors,
|
|
35
34
|
dataset,
|
|
36
35
|
sx,
|
|
37
|
-
tooltip,
|
|
38
36
|
topAxis,
|
|
39
37
|
leftAxis,
|
|
40
38
|
rightAxis,
|
|
@@ -65,6 +63,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
65
63
|
color: defaultColorMap
|
|
66
64
|
}
|
|
67
65
|
}], [zAxis]);
|
|
66
|
+
const Tooltip = props.slots?.tooltip ?? HeatmapTooltip;
|
|
68
67
|
return /*#__PURE__*/_jsxs(ChartContainerPro, {
|
|
69
68
|
ref: ref,
|
|
70
69
|
plugins: [heatmapPlugin],
|
|
@@ -102,14 +101,7 @@ const Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(inProps, ref) {
|
|
|
102
101
|
bottomAxis: bottomAxis,
|
|
103
102
|
slots: slots,
|
|
104
103
|
slotProps: slotProps
|
|
105
|
-
}), !loading && /*#__PURE__*/_jsx(
|
|
106
|
-
trigger: "item"
|
|
107
|
-
}, tooltip, {
|
|
108
|
-
slots: _extends({
|
|
109
|
-
itemContent: DefaultHeatmapTooltip
|
|
110
|
-
}, slots),
|
|
111
|
-
slotProps: slotProps
|
|
112
|
-
})), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
104
|
+
}), !loading && /*#__PURE__*/_jsx(Tooltip, _extends({}, slotProps?.tooltip)), /*#__PURE__*/_jsx(ChartsClipPath, {
|
|
113
105
|
id: clipPathId
|
|
114
106
|
}), children]
|
|
115
107
|
});
|
|
@@ -190,16 +182,6 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
190
182
|
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
191
183
|
*/
|
|
192
184
|
onHighlightChange: PropTypes.func,
|
|
193
|
-
/**
|
|
194
|
-
* The chart will try to wait for the parent container to resolve its size
|
|
195
|
-
* before it renders for the first time.
|
|
196
|
-
*
|
|
197
|
-
* This can be useful in some scenarios where the chart appear to grow after
|
|
198
|
-
* the first render, like when used inside a grid.
|
|
199
|
-
*
|
|
200
|
-
* @default false
|
|
201
|
-
*/
|
|
202
|
-
resolveSizeBeforeRender: PropTypes.bool,
|
|
203
185
|
/**
|
|
204
186
|
* Indicate which axis to display the right of the charts.
|
|
205
187
|
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
@@ -227,26 +209,13 @@ process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
|
227
209
|
* The configuration of the tooltip.
|
|
228
210
|
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
229
211
|
*/
|
|
230
|
-
tooltip: PropTypes.
|
|
231
|
-
axisContent: PropTypes.elementType,
|
|
232
|
-
classes: PropTypes.object,
|
|
233
|
-
itemContent: PropTypes.elementType,
|
|
234
|
-
slotProps: PropTypes.object,
|
|
235
|
-
slots: PropTypes.object,
|
|
236
|
-
trigger: PropTypes.oneOf(['axis', 'item', 'none'])
|
|
237
|
-
}),
|
|
212
|
+
tooltip: PropTypes.object,
|
|
238
213
|
/**
|
|
239
214
|
* Indicate which axis to display the top of the charts.
|
|
240
215
|
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
241
216
|
* @default null
|
|
242
217
|
*/
|
|
243
218
|
topAxis: PropTypes.oneOfType([PropTypes.object, PropTypes.string]),
|
|
244
|
-
viewBox: PropTypes.shape({
|
|
245
|
-
height: PropTypes.number,
|
|
246
|
-
width: PropTypes.number,
|
|
247
|
-
x: PropTypes.number,
|
|
248
|
-
y: PropTypes.number
|
|
249
|
-
}),
|
|
250
219
|
/**
|
|
251
220
|
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
252
221
|
*/
|