@mui/x-charts-pro 7.0.0-alpha.0
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 +18 -0
- package/BarChartPro/BarChartPro.js +417 -0
- package/BarChartPro/index.d.ts +1 -0
- package/BarChartPro/index.js +1 -0
- package/BarChartPro/package.json +6 -0
- package/CHANGELOG.md +4404 -0
- package/ChartContainerPro/ChartContainerPro.d.ts +7 -0
- package/ChartContainerPro/ChartContainerPro.js +282 -0
- package/ChartContainerPro/index.d.ts +1 -0
- package/ChartContainerPro/index.js +1 -0
- package/ChartContainerPro/package.json +6 -0
- package/ChartContainerPro/useChartContainerProProps.d.ts +15 -0
- package/ChartContainerPro/useChartContainerProProps.js +39 -0
- package/Heatmap/DefaultHeatmapTooltip.d.ts +7 -0
- package/Heatmap/DefaultHeatmapTooltip.js +97 -0
- package/Heatmap/Heatmap.d.ts +49 -0
- package/Heatmap/Heatmap.js +387 -0
- package/Heatmap/HeatmapItem.d.ts +49 -0
- package/Heatmap/HeatmapItem.js +106 -0
- package/Heatmap/HeatmapPlot.d.ts +9 -0
- package/Heatmap/HeatmapPlot.js +57 -0
- package/Heatmap/extremums.d.ts +2 -0
- package/Heatmap/extremums.js +8 -0
- package/Heatmap/formatter.d.ts +3 -0
- package/Heatmap/formatter.js +20 -0
- package/Heatmap/getColor.d.ts +3 -0
- package/Heatmap/getColor.js +15 -0
- package/Heatmap/heatmapClasses.d.ts +11 -0
- package/Heatmap/heatmapClasses.js +13 -0
- package/Heatmap/index.d.ts +4 -0
- package/Heatmap/index.js +4 -0
- package/Heatmap/package.json +6 -0
- package/Heatmap/plugin.d.ts +2 -0
- package/Heatmap/plugin.js +10 -0
- package/LICENSE +11 -0
- package/LineChartPro/LineChartPro.d.ts +17 -0
- package/LineChartPro/LineChartPro.js +473 -0
- package/LineChartPro/index.d.ts +1 -0
- package/LineChartPro/index.js +1 -0
- package/LineChartPro/package.json +6 -0
- package/README.md +26 -0
- package/ResponsiveChartContainerPro/ResponsiveChartContainerPro.d.ts +7 -0
- package/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +259 -0
- package/ResponsiveChartContainerPro/index.d.ts +1 -0
- package/ResponsiveChartContainerPro/index.js +1 -0
- package/ResponsiveChartContainerPro/package.json +6 -0
- package/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.d.ts +41 -0
- package/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.js +25 -0
- package/ScatterChartPro/ScatterChartPro.d.ts +17 -0
- package/ScatterChartPro/ScatterChartPro.js +388 -0
- package/ScatterChartPro/index.d.ts +1 -0
- package/ScatterChartPro/index.js +1 -0
- package/ScatterChartPro/package.json +6 -0
- package/context/CartesianProviderPro/CartesianProviderPro.d.ts +6 -0
- package/context/CartesianProviderPro/CartesianProviderPro.js +54 -0
- package/context/CartesianProviderPro/index.d.ts +1 -0
- package/context/CartesianProviderPro/index.js +1 -0
- package/context/ZoomProvider/Zoom.types.d.ts +134 -0
- package/context/ZoomProvider/Zoom.types.js +1 -0
- package/context/ZoomProvider/ZoomContext.d.ts +4 -0
- package/context/ZoomProvider/ZoomContext.js +16 -0
- package/context/ZoomProvider/ZoomProvider.d.ts +3 -0
- package/context/ZoomProvider/ZoomProvider.js +53 -0
- package/context/ZoomProvider/ZoomSetup.d.ts +9 -0
- package/context/ZoomProvider/ZoomSetup.js +16 -0
- package/context/ZoomProvider/defaultizeZoom.d.ts +2 -0
- package/context/ZoomProvider/defaultizeZoom.js +31 -0
- package/context/ZoomProvider/index.d.ts +3 -0
- package/context/ZoomProvider/index.js +3 -0
- package/context/ZoomProvider/initializeZoomData.d.ts +6 -0
- package/context/ZoomProvider/initializeZoomData.js +13 -0
- package/context/ZoomProvider/useSetupPan.d.ts +1 -0
- package/context/ZoomProvider/useSetupPan.js +104 -0
- package/context/ZoomProvider/useSetupZoom.d.ts +1 -0
- package/context/ZoomProvider/useSetupZoom.js +272 -0
- package/context/ZoomProvider/useZoom.d.ts +7 -0
- package/context/ZoomProvider/useZoom.js +17 -0
- package/context/index.d.ts +3 -0
- package/context/index.js +5 -0
- package/context/package.json +6 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/index.js +1 -0
- package/hooks/package.json +6 -0
- package/hooks/useSeries.d.ts +11 -0
- package/hooks/useSeries.js +14 -0
- package/index.d.ts +31 -0
- package/index.js +45 -0
- package/internals/utils/releaseInfo.d.ts +1 -0
- package/internals/utils/releaseInfo.js +13 -0
- package/models/index.d.ts +1 -0
- package/models/index.js +1 -0
- package/models/package.json +6 -0
- package/models/seriesType/heatmap.d.ts +28 -0
- package/models/seriesType/heatmap.js +1 -0
- package/models/seriesType/index.d.ts +1 -0
- package/models/seriesType/index.js +1 -0
- package/modern/BarChartPro/BarChartPro.js +417 -0
- package/modern/BarChartPro/index.js +1 -0
- package/modern/ChartContainerPro/ChartContainerPro.js +282 -0
- package/modern/ChartContainerPro/index.js +1 -0
- package/modern/ChartContainerPro/useChartContainerProProps.js +39 -0
- package/modern/Heatmap/DefaultHeatmapTooltip.js +97 -0
- package/modern/Heatmap/Heatmap.js +387 -0
- package/modern/Heatmap/HeatmapItem.js +106 -0
- package/modern/Heatmap/HeatmapPlot.js +57 -0
- package/modern/Heatmap/extremums.js +8 -0
- package/modern/Heatmap/formatter.js +20 -0
- package/modern/Heatmap/getColor.js +15 -0
- package/modern/Heatmap/heatmapClasses.js +13 -0
- package/modern/Heatmap/index.js +4 -0
- package/modern/Heatmap/plugin.js +10 -0
- package/modern/LineChartPro/LineChartPro.js +473 -0
- package/modern/LineChartPro/index.js +1 -0
- package/modern/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +259 -0
- package/modern/ResponsiveChartContainerPro/index.js +1 -0
- package/modern/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.js +25 -0
- package/modern/ScatterChartPro/ScatterChartPro.js +388 -0
- package/modern/ScatterChartPro/index.js +1 -0
- package/modern/context/CartesianProviderPro/CartesianProviderPro.js +54 -0
- package/modern/context/CartesianProviderPro/index.js +1 -0
- package/modern/context/ZoomProvider/Zoom.types.js +1 -0
- package/modern/context/ZoomProvider/ZoomContext.js +16 -0
- package/modern/context/ZoomProvider/ZoomProvider.js +53 -0
- package/modern/context/ZoomProvider/ZoomSetup.js +16 -0
- package/modern/context/ZoomProvider/defaultizeZoom.js +31 -0
- package/modern/context/ZoomProvider/index.js +3 -0
- package/modern/context/ZoomProvider/initializeZoomData.js +13 -0
- package/modern/context/ZoomProvider/useSetupPan.js +104 -0
- package/modern/context/ZoomProvider/useSetupZoom.js +272 -0
- package/modern/context/ZoomProvider/useZoom.js +17 -0
- package/modern/context/index.js +5 -0
- package/modern/hooks/index.js +1 -0
- package/modern/hooks/useSeries.js +14 -0
- package/modern/index.js +45 -0
- package/modern/internals/utils/releaseInfo.js +13 -0
- package/modern/models/index.js +1 -0
- package/modern/models/seriesType/heatmap.js +1 -0
- package/modern/models/seriesType/index.js +1 -0
- package/modern/typeOverloads/index.js +1 -0
- package/modern/typeOverloads/modules.js +1 -0
- package/node/BarChartPro/BarChartPro.js +425 -0
- package/node/BarChartPro/index.js +16 -0
- package/node/ChartContainerPro/ChartContainerPro.js +290 -0
- package/node/ChartContainerPro/index.js +16 -0
- package/node/ChartContainerPro/useChartContainerProProps.js +47 -0
- package/node/Heatmap/DefaultHeatmapTooltip.js +105 -0
- package/node/Heatmap/Heatmap.js +395 -0
- package/node/Heatmap/HeatmapItem.js +114 -0
- package/node/Heatmap/HeatmapPlot.js +65 -0
- package/node/Heatmap/extremums.js +15 -0
- package/node/Heatmap/formatter.js +27 -0
- package/node/Heatmap/getColor.js +21 -0
- package/node/Heatmap/heatmapClasses.js +21 -0
- package/node/Heatmap/index.js +47 -0
- package/node/Heatmap/plugin.js +17 -0
- package/node/LineChartPro/LineChartPro.js +481 -0
- package/node/LineChartPro/index.js +16 -0
- package/node/ResponsiveChartContainerPro/ResponsiveChartContainerPro.js +267 -0
- package/node/ResponsiveChartContainerPro/index.js +16 -0
- package/node/ResponsiveChartContainerPro/useResponsiveChartContainerProProps.js +33 -0
- package/node/ScatterChartPro/ScatterChartPro.js +396 -0
- package/node/ScatterChartPro/index.js +16 -0
- package/node/context/CartesianProviderPro/CartesianProviderPro.js +61 -0
- package/node/context/CartesianProviderPro/index.js +16 -0
- package/node/context/ZoomProvider/Zoom.types.js +5 -0
- package/node/context/ZoomProvider/ZoomContext.js +24 -0
- package/node/context/ZoomProvider/ZoomProvider.js +62 -0
- package/node/context/ZoomProvider/ZoomSetup.js +20 -0
- package/node/context/ZoomProvider/defaultizeZoom.js +39 -0
- package/node/context/ZoomProvider/index.js +38 -0
- package/node/context/ZoomProvider/initializeZoomData.js +20 -0
- package/node/context/ZoomProvider/useSetupPan.js +114 -0
- package/node/context/ZoomProvider/useSetupZoom.js +281 -0
- package/node/context/ZoomProvider/useZoom.js +25 -0
- package/node/context/index.js +27 -0
- package/node/hooks/index.js +12 -0
- package/node/hooks/useSeries.js +21 -0
- package/node/index.js +354 -0
- package/node/internals/utils/releaseInfo.js +20 -0
- package/node/models/index.js +16 -0
- package/node/models/seriesType/heatmap.js +5 -0
- package/node/models/seriesType/index.js +16 -0
- package/node/typeOverloads/index.js +6 -0
- package/node/typeOverloads/modules.js +5 -0
- package/package.json +64 -0
- package/typeOverloads/index.d.ts +1 -0
- package/typeOverloads/index.js +1 -0
- package/typeOverloads/modules.d.ts +17 -0
- package/typeOverloads/modules.js +1 -0
- package/typeOverloads/package.json +6 -0
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.Heatmap = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var React = _interopRequireWildcard(require("react"));
|
|
10
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
11
|
+
var _d3Interpolate = require("@mui/x-charts-vendor/d3-interpolate");
|
|
12
|
+
var _useId = _interopRequireDefault(require("@mui/utils/useId"));
|
|
13
|
+
var _ChartsAxis = require("@mui/x-charts/ChartsAxis");
|
|
14
|
+
var _ChartsTooltip = require("@mui/x-charts/ChartsTooltip");
|
|
15
|
+
var _ChartsClipPath = require("@mui/x-charts/ChartsClipPath");
|
|
16
|
+
var _ChartsOnAxisClickHandler = require("@mui/x-charts/ChartsOnAxisClickHandler");
|
|
17
|
+
var _ChartsOverlay = require("@mui/x-charts/ChartsOverlay");
|
|
18
|
+
var _ResponsiveChartContainerPro = require("../ResponsiveChartContainerPro");
|
|
19
|
+
var _HeatmapPlot = require("./HeatmapPlot");
|
|
20
|
+
var _plugin = require("./plugin");
|
|
21
|
+
var _DefaultHeatmapTooltip = require("./DefaultHeatmapTooltip");
|
|
22
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
23
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
24
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
25
|
+
// The GnBu: https://github.com/d3/d3-scale-chromatic/blob/main/src/sequential-multi/GnBu.js
|
|
26
|
+
const defaultColorMap = (0, _d3Interpolate.interpolateRgbBasis)(['#f7fcf0', '#e0f3db', '#ccebc5', '#a8ddb5', '#7bccc4', '#4eb3d3', '#2b8cbe', '#0868ac', '#084081']);
|
|
27
|
+
const Heatmap = exports.Heatmap = /*#__PURE__*/React.forwardRef(function Heatmap(props, ref) {
|
|
28
|
+
const {
|
|
29
|
+
xAxis,
|
|
30
|
+
yAxis,
|
|
31
|
+
zAxis,
|
|
32
|
+
series,
|
|
33
|
+
width,
|
|
34
|
+
height,
|
|
35
|
+
margin,
|
|
36
|
+
colors,
|
|
37
|
+
dataset,
|
|
38
|
+
sx,
|
|
39
|
+
tooltip,
|
|
40
|
+
topAxis,
|
|
41
|
+
leftAxis,
|
|
42
|
+
rightAxis,
|
|
43
|
+
bottomAxis,
|
|
44
|
+
onAxisClick,
|
|
45
|
+
children,
|
|
46
|
+
slots,
|
|
47
|
+
slotProps,
|
|
48
|
+
loading,
|
|
49
|
+
highlightedItem,
|
|
50
|
+
onHighlightChange
|
|
51
|
+
} = props;
|
|
52
|
+
const id = (0, _useId.default)();
|
|
53
|
+
const clipPathId = `${id}-clip-path`;
|
|
54
|
+
const defaultizedXAxis = React.useMemo(() => xAxis.map(axis => (0, _extends2.default)({
|
|
55
|
+
scaleType: 'band',
|
|
56
|
+
categoryGapRatio: 0
|
|
57
|
+
}, axis)), [xAxis]);
|
|
58
|
+
const defaultizedYAxis = React.useMemo(() => yAxis.map(axis => (0, _extends2.default)({
|
|
59
|
+
scaleType: 'band',
|
|
60
|
+
categoryGapRatio: 0
|
|
61
|
+
}, axis)), [yAxis]);
|
|
62
|
+
const defaultizedZAxis = React.useMemo(() => zAxis ?? [{
|
|
63
|
+
colorMap: {
|
|
64
|
+
type: 'continuous',
|
|
65
|
+
min: 0,
|
|
66
|
+
max: 100,
|
|
67
|
+
color: defaultColorMap
|
|
68
|
+
}
|
|
69
|
+
}], [zAxis]);
|
|
70
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_ResponsiveChartContainerPro.ResponsiveChartContainerPro, {
|
|
71
|
+
ref: ref,
|
|
72
|
+
plugins: [_plugin.plugin],
|
|
73
|
+
series: series.map(s => (0, _extends2.default)({
|
|
74
|
+
type: 'heatmap'
|
|
75
|
+
}, s)),
|
|
76
|
+
width: width,
|
|
77
|
+
height: height,
|
|
78
|
+
margin: margin,
|
|
79
|
+
xAxis: defaultizedXAxis,
|
|
80
|
+
yAxis: defaultizedYAxis,
|
|
81
|
+
zAxis: defaultizedZAxis,
|
|
82
|
+
colors: colors,
|
|
83
|
+
dataset: dataset,
|
|
84
|
+
sx: sx,
|
|
85
|
+
disableAxisListener: true,
|
|
86
|
+
highlightedItem: highlightedItem,
|
|
87
|
+
onHighlightChange: onHighlightChange,
|
|
88
|
+
children: [onAxisClick && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOnAxisClickHandler.ChartsOnAxisClickHandler, {
|
|
89
|
+
onAxisClick: onAxisClick
|
|
90
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsxs)("g", {
|
|
91
|
+
clipPath: `url(#${clipPathId})`,
|
|
92
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapPlot.HeatmapPlot, {
|
|
93
|
+
slots: slots,
|
|
94
|
+
slotProps: slotProps
|
|
95
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsOverlay.ChartsOverlay, {
|
|
96
|
+
loading: loading,
|
|
97
|
+
slots: slots,
|
|
98
|
+
slotProps: slotProps
|
|
99
|
+
})]
|
|
100
|
+
}), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsAxis.ChartsAxis, {
|
|
101
|
+
topAxis: topAxis,
|
|
102
|
+
leftAxis: leftAxis,
|
|
103
|
+
rightAxis: rightAxis,
|
|
104
|
+
bottomAxis: bottomAxis,
|
|
105
|
+
slots: slots,
|
|
106
|
+
slotProps: slotProps
|
|
107
|
+
}), !loading && /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsTooltip.ChartsTooltip, (0, _extends2.default)({
|
|
108
|
+
trigger: "item"
|
|
109
|
+
}, tooltip, {
|
|
110
|
+
slots: (0, _extends2.default)({
|
|
111
|
+
itemContent: _DefaultHeatmapTooltip.DefaultHeatmapTooltip
|
|
112
|
+
}, slots),
|
|
113
|
+
slotProps: slotProps
|
|
114
|
+
})), /*#__PURE__*/(0, _jsxRuntime.jsx)(_ChartsClipPath.ChartsClipPath, {
|
|
115
|
+
id: clipPathId
|
|
116
|
+
}), children]
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
process.env.NODE_ENV !== "production" ? Heatmap.propTypes = {
|
|
120
|
+
// ----------------------------- Warning --------------------------------
|
|
121
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
122
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
123
|
+
// ----------------------------------------------------------------------
|
|
124
|
+
/**
|
|
125
|
+
* Indicate which axis to display the bottom of the charts.
|
|
126
|
+
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
127
|
+
* @default xAxisIds[0] The id of the first provided axis
|
|
128
|
+
*/
|
|
129
|
+
bottomAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
130
|
+
children: _propTypes.default.node,
|
|
131
|
+
className: _propTypes.default.string,
|
|
132
|
+
/**
|
|
133
|
+
* Color palette used to colorize multiple series.
|
|
134
|
+
* @default blueberryTwilightPalette
|
|
135
|
+
*/
|
|
136
|
+
colors: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string), _propTypes.default.func]),
|
|
137
|
+
/**
|
|
138
|
+
* An array of objects that can be used to populate series and axes data using their `dataKey` property.
|
|
139
|
+
*/
|
|
140
|
+
dataset: _propTypes.default.arrayOf(_propTypes.default.object),
|
|
141
|
+
desc: _propTypes.default.string,
|
|
142
|
+
/**
|
|
143
|
+
* If `true`, the charts will not listen to the mouse move event.
|
|
144
|
+
* It might break interactive features, but will improve performance.
|
|
145
|
+
* @default false
|
|
146
|
+
*/
|
|
147
|
+
disableAxisListener: _propTypes.default.bool,
|
|
148
|
+
/**
|
|
149
|
+
* The height of the chart in px. If not defined, it takes the height of the parent element.
|
|
150
|
+
*/
|
|
151
|
+
height: _propTypes.default.number,
|
|
152
|
+
/**
|
|
153
|
+
* The item currently highlighted. Turns highlighting into a controlled prop.
|
|
154
|
+
*/
|
|
155
|
+
highlightedItem: _propTypes.default.shape({
|
|
156
|
+
dataIndex: _propTypes.default.number,
|
|
157
|
+
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string])
|
|
158
|
+
}),
|
|
159
|
+
/**
|
|
160
|
+
* Indicate which axis to display the left of the charts.
|
|
161
|
+
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
162
|
+
* @default yAxisIds[0] The id of the first provided axis
|
|
163
|
+
*/
|
|
164
|
+
leftAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
165
|
+
/**
|
|
166
|
+
* If `true`, a loading overlay is displayed.
|
|
167
|
+
* @default false
|
|
168
|
+
*/
|
|
169
|
+
loading: _propTypes.default.bool,
|
|
170
|
+
/**
|
|
171
|
+
* The margin between the SVG and the drawing area.
|
|
172
|
+
* It's used for leaving some space for extra information such as the x- and y-axis or legend.
|
|
173
|
+
* Accepts an object with the optional properties: `top`, `bottom`, `left`, and `right`.
|
|
174
|
+
* @default object Depends on the charts type.
|
|
175
|
+
*/
|
|
176
|
+
margin: _propTypes.default.shape({
|
|
177
|
+
bottom: _propTypes.default.number,
|
|
178
|
+
left: _propTypes.default.number,
|
|
179
|
+
right: _propTypes.default.number,
|
|
180
|
+
top: _propTypes.default.number
|
|
181
|
+
}),
|
|
182
|
+
/**
|
|
183
|
+
* The function called for onClick events.
|
|
184
|
+
* The second argument contains information about all line/bar elements at the current mouse position.
|
|
185
|
+
* @param {MouseEvent} event The mouse event recorded on the `<svg/>` element.
|
|
186
|
+
* @param {null | AxisData} data The data about the clicked axis and items associated with it.
|
|
187
|
+
*/
|
|
188
|
+
onAxisClick: _propTypes.default.func,
|
|
189
|
+
/**
|
|
190
|
+
* The callback fired when the highlighted item changes.
|
|
191
|
+
*
|
|
192
|
+
* @param {HighlightItemData | null} highlightedItem The newly highlighted item.
|
|
193
|
+
*/
|
|
194
|
+
onHighlightChange: _propTypes.default.func,
|
|
195
|
+
/**
|
|
196
|
+
* Indicate which axis to display the right of the charts.
|
|
197
|
+
* Can be a string (the id of the axis) or an object `ChartsYAxisProps`.
|
|
198
|
+
* @default null
|
|
199
|
+
*/
|
|
200
|
+
rightAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
201
|
+
/**
|
|
202
|
+
* The series to display in the bar chart.
|
|
203
|
+
* An array of [[HeatmapSeriesType]] objects.
|
|
204
|
+
*/
|
|
205
|
+
series: _propTypes.default.arrayOf(_propTypes.default.object).isRequired,
|
|
206
|
+
/**
|
|
207
|
+
* The props used for each component slot.
|
|
208
|
+
* @default {}
|
|
209
|
+
*/
|
|
210
|
+
slotProps: _propTypes.default.object,
|
|
211
|
+
/**
|
|
212
|
+
* Overridable component slots.
|
|
213
|
+
* @default {}
|
|
214
|
+
*/
|
|
215
|
+
slots: _propTypes.default.object,
|
|
216
|
+
sx: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.object, _propTypes.default.bool])), _propTypes.default.func, _propTypes.default.object]),
|
|
217
|
+
title: _propTypes.default.string,
|
|
218
|
+
/**
|
|
219
|
+
* The configuration of the tooltip.
|
|
220
|
+
* @see See {@link https://mui.com/x/react-charts/tooltip/ tooltip docs} for more details.
|
|
221
|
+
*/
|
|
222
|
+
tooltip: _propTypes.default.shape({
|
|
223
|
+
axisContent: _propTypes.default.elementType,
|
|
224
|
+
classes: _propTypes.default.object,
|
|
225
|
+
itemContent: _propTypes.default.elementType,
|
|
226
|
+
slotProps: _propTypes.default.object,
|
|
227
|
+
slots: _propTypes.default.object,
|
|
228
|
+
trigger: _propTypes.default.oneOf(['axis', 'item', 'none'])
|
|
229
|
+
}),
|
|
230
|
+
/**
|
|
231
|
+
* Indicate which axis to display the top of the charts.
|
|
232
|
+
* Can be a string (the id of the axis) or an object `ChartsXAxisProps`.
|
|
233
|
+
* @default null
|
|
234
|
+
*/
|
|
235
|
+
topAxis: _propTypes.default.oneOfType([_propTypes.default.object, _propTypes.default.string]),
|
|
236
|
+
viewBox: _propTypes.default.shape({
|
|
237
|
+
height: _propTypes.default.number,
|
|
238
|
+
width: _propTypes.default.number,
|
|
239
|
+
x: _propTypes.default.number,
|
|
240
|
+
y: _propTypes.default.number
|
|
241
|
+
}),
|
|
242
|
+
/**
|
|
243
|
+
* The width of the chart in px. If not defined, it takes the width of the parent element.
|
|
244
|
+
*/
|
|
245
|
+
width: _propTypes.default.number,
|
|
246
|
+
/**
|
|
247
|
+
* The configuration of the x-axes.
|
|
248
|
+
* If not provided, a default axis config is used.
|
|
249
|
+
* An array of [[AxisConfig]] objects.
|
|
250
|
+
*/
|
|
251
|
+
xAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
252
|
+
barGapRatio: _propTypes.default.number,
|
|
253
|
+
categoryGapRatio: _propTypes.default.number,
|
|
254
|
+
classes: _propTypes.default.object,
|
|
255
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
256
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
257
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
258
|
+
unknownColor: _propTypes.default.string,
|
|
259
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
260
|
+
}), _propTypes.default.shape({
|
|
261
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
262
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
263
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
264
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
265
|
+
}), _propTypes.default.shape({
|
|
266
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
267
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
268
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
269
|
+
})]),
|
|
270
|
+
data: _propTypes.default.array,
|
|
271
|
+
dataKey: _propTypes.default.string,
|
|
272
|
+
disableLine: _propTypes.default.bool,
|
|
273
|
+
disableTicks: _propTypes.default.bool,
|
|
274
|
+
fill: _propTypes.default.string,
|
|
275
|
+
hideTooltip: _propTypes.default.bool,
|
|
276
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
277
|
+
label: _propTypes.default.string,
|
|
278
|
+
labelFontSize: _propTypes.default.number,
|
|
279
|
+
labelStyle: _propTypes.default.object,
|
|
280
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
281
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
282
|
+
position: _propTypes.default.oneOf(['bottom', 'top']),
|
|
283
|
+
reverse: _propTypes.default.bool,
|
|
284
|
+
scaleType: _propTypes.default.oneOf(['band']),
|
|
285
|
+
slotProps: _propTypes.default.object,
|
|
286
|
+
slots: _propTypes.default.object,
|
|
287
|
+
stroke: _propTypes.default.string,
|
|
288
|
+
tickFontSize: _propTypes.default.number,
|
|
289
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
290
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
291
|
+
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
292
|
+
tickLabelStyle: _propTypes.default.object,
|
|
293
|
+
tickMaxStep: _propTypes.default.number,
|
|
294
|
+
tickMinStep: _propTypes.default.number,
|
|
295
|
+
tickNumber: _propTypes.default.number,
|
|
296
|
+
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
297
|
+
tickSize: _propTypes.default.number,
|
|
298
|
+
valueFormatter: _propTypes.default.func,
|
|
299
|
+
zoom: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
300
|
+
maxEnd: _propTypes.default.number,
|
|
301
|
+
maxSpan: _propTypes.default.number,
|
|
302
|
+
minSpan: _propTypes.default.number,
|
|
303
|
+
minStart: _propTypes.default.number,
|
|
304
|
+
panning: _propTypes.default.bool,
|
|
305
|
+
step: _propTypes.default.number
|
|
306
|
+
}), _propTypes.default.bool])
|
|
307
|
+
})).isRequired,
|
|
308
|
+
/**
|
|
309
|
+
* The configuration of the y-axes.
|
|
310
|
+
* If not provided, a default axis config is used.
|
|
311
|
+
* An array of [[AxisConfig]] objects.
|
|
312
|
+
*/
|
|
313
|
+
yAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
314
|
+
barGapRatio: _propTypes.default.number,
|
|
315
|
+
categoryGapRatio: _propTypes.default.number,
|
|
316
|
+
classes: _propTypes.default.object,
|
|
317
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
318
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
319
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
320
|
+
unknownColor: _propTypes.default.string,
|
|
321
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
322
|
+
}), _propTypes.default.shape({
|
|
323
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
324
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
325
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
326
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
327
|
+
}), _propTypes.default.shape({
|
|
328
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
329
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
330
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
331
|
+
})]),
|
|
332
|
+
data: _propTypes.default.array,
|
|
333
|
+
dataKey: _propTypes.default.string,
|
|
334
|
+
disableLine: _propTypes.default.bool,
|
|
335
|
+
disableTicks: _propTypes.default.bool,
|
|
336
|
+
fill: _propTypes.default.string,
|
|
337
|
+
hideTooltip: _propTypes.default.bool,
|
|
338
|
+
id: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]),
|
|
339
|
+
label: _propTypes.default.string,
|
|
340
|
+
labelFontSize: _propTypes.default.number,
|
|
341
|
+
labelStyle: _propTypes.default.object,
|
|
342
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
343
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
344
|
+
position: _propTypes.default.oneOf(['left', 'right']),
|
|
345
|
+
reverse: _propTypes.default.bool,
|
|
346
|
+
scaleType: _propTypes.default.oneOf(['band']),
|
|
347
|
+
slotProps: _propTypes.default.object,
|
|
348
|
+
slots: _propTypes.default.object,
|
|
349
|
+
stroke: _propTypes.default.string,
|
|
350
|
+
tickFontSize: _propTypes.default.number,
|
|
351
|
+
tickInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.array, _propTypes.default.func]),
|
|
352
|
+
tickLabelInterval: _propTypes.default.oneOfType([_propTypes.default.oneOf(['auto']), _propTypes.default.func]),
|
|
353
|
+
tickLabelPlacement: _propTypes.default.oneOf(['middle', 'tick']),
|
|
354
|
+
tickLabelStyle: _propTypes.default.object,
|
|
355
|
+
tickMaxStep: _propTypes.default.number,
|
|
356
|
+
tickMinStep: _propTypes.default.number,
|
|
357
|
+
tickNumber: _propTypes.default.number,
|
|
358
|
+
tickPlacement: _propTypes.default.oneOf(['end', 'extremities', 'middle', 'start']),
|
|
359
|
+
tickSize: _propTypes.default.number,
|
|
360
|
+
valueFormatter: _propTypes.default.func,
|
|
361
|
+
zoom: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
362
|
+
maxEnd: _propTypes.default.number,
|
|
363
|
+
maxSpan: _propTypes.default.number,
|
|
364
|
+
minSpan: _propTypes.default.number,
|
|
365
|
+
minStart: _propTypes.default.number,
|
|
366
|
+
panning: _propTypes.default.bool,
|
|
367
|
+
step: _propTypes.default.number
|
|
368
|
+
}), _propTypes.default.bool])
|
|
369
|
+
})).isRequired,
|
|
370
|
+
/**
|
|
371
|
+
* The configuration of the z-axes.
|
|
372
|
+
*/
|
|
373
|
+
zAxis: _propTypes.default.arrayOf(_propTypes.default.shape({
|
|
374
|
+
colorMap: _propTypes.default.oneOfType([_propTypes.default.shape({
|
|
375
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
376
|
+
type: _propTypes.default.oneOf(['ordinal']).isRequired,
|
|
377
|
+
unknownColor: _propTypes.default.string,
|
|
378
|
+
values: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number, _propTypes.default.string]).isRequired)
|
|
379
|
+
}), _propTypes.default.shape({
|
|
380
|
+
color: _propTypes.default.oneOfType([_propTypes.default.arrayOf(_propTypes.default.string.isRequired), _propTypes.default.func]).isRequired,
|
|
381
|
+
max: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
382
|
+
min: _propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]),
|
|
383
|
+
type: _propTypes.default.oneOf(['continuous']).isRequired
|
|
384
|
+
}), _propTypes.default.shape({
|
|
385
|
+
colors: _propTypes.default.arrayOf(_propTypes.default.string).isRequired,
|
|
386
|
+
thresholds: _propTypes.default.arrayOf(_propTypes.default.oneOfType([_propTypes.default.instanceOf(Date), _propTypes.default.number]).isRequired).isRequired,
|
|
387
|
+
type: _propTypes.default.oneOf(['piecewise']).isRequired
|
|
388
|
+
})]),
|
|
389
|
+
data: _propTypes.default.array,
|
|
390
|
+
dataKey: _propTypes.default.string,
|
|
391
|
+
id: _propTypes.default.string,
|
|
392
|
+
max: _propTypes.default.number,
|
|
393
|
+
min: _propTypes.default.number
|
|
394
|
+
}))
|
|
395
|
+
} : void 0;
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.HeatmapItem = HeatmapItem;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
var _objectWithoutPropertiesLoose2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutPropertiesLoose"));
|
|
10
|
+
var React = _interopRequireWildcard(require("react"));
|
|
11
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
12
|
+
var _styles = require("@mui/material/styles");
|
|
13
|
+
var _useSlotProps = _interopRequireDefault(require("@mui/utils/useSlotProps"));
|
|
14
|
+
var _composeClasses = _interopRequireDefault(require("@mui/utils/composeClasses"));
|
|
15
|
+
var _context = require("@mui/x-charts/context");
|
|
16
|
+
var _internals = require("@mui/x-charts/internals");
|
|
17
|
+
var _heatmapClasses = require("./heatmapClasses");
|
|
18
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
19
|
+
const _excluded = ["seriesId", "dataIndex", "color", "value", "slotProps", "slots"];
|
|
20
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
21
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
22
|
+
const HeatmapCell = (0, _styles.styled)('rect', {
|
|
23
|
+
name: 'MuiHeatmap',
|
|
24
|
+
slot: 'Cell',
|
|
25
|
+
overridesResolver: (_, styles) => styles.arc
|
|
26
|
+
})(({
|
|
27
|
+
ownerState
|
|
28
|
+
}) => ({
|
|
29
|
+
filter: ownerState.isHighlighted && 'saturate(120%)' || ownerState.isFaded && 'saturate(80%)' || undefined,
|
|
30
|
+
fill: ownerState.color,
|
|
31
|
+
shapeRendering: 'crispEdges'
|
|
32
|
+
}));
|
|
33
|
+
const useUtilityClasses = ownerState => {
|
|
34
|
+
const {
|
|
35
|
+
classes,
|
|
36
|
+
seriesId,
|
|
37
|
+
isFaded,
|
|
38
|
+
isHighlighted
|
|
39
|
+
} = ownerState;
|
|
40
|
+
const slots = {
|
|
41
|
+
cell: ['cell', `series-${seriesId}`, isFaded && 'faded', isHighlighted && 'highlighted']
|
|
42
|
+
};
|
|
43
|
+
return (0, _composeClasses.default)(slots, _heatmapClasses.getHeatmapUtilityClass, classes);
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* @ignore - internal component.
|
|
48
|
+
*/
|
|
49
|
+
function HeatmapItem(props) {
|
|
50
|
+
const {
|
|
51
|
+
seriesId,
|
|
52
|
+
dataIndex,
|
|
53
|
+
color,
|
|
54
|
+
value,
|
|
55
|
+
slotProps = {},
|
|
56
|
+
slots = {}
|
|
57
|
+
} = props,
|
|
58
|
+
other = (0, _objectWithoutPropertiesLoose2.default)(props, _excluded);
|
|
59
|
+
const getInteractionItemProps = (0, _internals.useInteractionItemProps)();
|
|
60
|
+
const {
|
|
61
|
+
isFaded,
|
|
62
|
+
isHighlighted
|
|
63
|
+
} = (0, _context.useItemHighlighted)({
|
|
64
|
+
seriesId,
|
|
65
|
+
dataIndex
|
|
66
|
+
});
|
|
67
|
+
const ownerState = {
|
|
68
|
+
seriesId,
|
|
69
|
+
dataIndex,
|
|
70
|
+
color,
|
|
71
|
+
value,
|
|
72
|
+
isFaded,
|
|
73
|
+
isHighlighted
|
|
74
|
+
};
|
|
75
|
+
const classes = useUtilityClasses(ownerState);
|
|
76
|
+
const Cell = slots?.cell ?? HeatmapCell;
|
|
77
|
+
const cellProps = (0, _useSlotProps.default)({
|
|
78
|
+
elementType: Cell,
|
|
79
|
+
additionalProps: (0, _extends2.default)({}, getInteractionItemProps({
|
|
80
|
+
type: 'heatmap',
|
|
81
|
+
seriesId,
|
|
82
|
+
dataIndex
|
|
83
|
+
})),
|
|
84
|
+
externalForwardedProps: (0, _extends2.default)({}, other),
|
|
85
|
+
externalSlotProps: slotProps.cell,
|
|
86
|
+
ownerState,
|
|
87
|
+
className: classes.cell
|
|
88
|
+
});
|
|
89
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(Cell, (0, _extends2.default)({}, cellProps));
|
|
90
|
+
}
|
|
91
|
+
process.env.NODE_ENV !== "production" ? HeatmapItem.propTypes = {
|
|
92
|
+
// ----------------------------- Warning --------------------------------
|
|
93
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
94
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
95
|
+
// ----------------------------------------------------------------------
|
|
96
|
+
color: _propTypes.default.string.isRequired,
|
|
97
|
+
dataIndex: _propTypes.default.number.isRequired,
|
|
98
|
+
height: _propTypes.default.number.isRequired,
|
|
99
|
+
seriesId: _propTypes.default.oneOfType([_propTypes.default.number, _propTypes.default.string]).isRequired,
|
|
100
|
+
/**
|
|
101
|
+
* The props used for each component slot.
|
|
102
|
+
* @default {}
|
|
103
|
+
*/
|
|
104
|
+
slotProps: _propTypes.default.object,
|
|
105
|
+
/**
|
|
106
|
+
* Overridable component slots.
|
|
107
|
+
* @default {}
|
|
108
|
+
*/
|
|
109
|
+
slots: _propTypes.default.object,
|
|
110
|
+
value: _propTypes.default.number.isRequired,
|
|
111
|
+
width: _propTypes.default.number.isRequired,
|
|
112
|
+
x: _propTypes.default.number.isRequired,
|
|
113
|
+
y: _propTypes.default.number.isRequired
|
|
114
|
+
} : void 0;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.HeatmapPlot = HeatmapPlot;
|
|
8
|
+
var React = _interopRequireWildcard(require("react"));
|
|
9
|
+
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
10
|
+
var _hooks = require("@mui/x-charts/hooks");
|
|
11
|
+
var _useSeries = require("../hooks/useSeries");
|
|
12
|
+
var _HeatmapItem = require("./HeatmapItem");
|
|
13
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
14
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
15
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
16
|
+
function HeatmapPlot(props) {
|
|
17
|
+
const xScale = (0, _hooks.useXScale)();
|
|
18
|
+
const yScale = (0, _hooks.useYScale)();
|
|
19
|
+
const colorScale = (0, _hooks.useZColorScale)();
|
|
20
|
+
const series = (0, _useSeries.useHeatmapSeries)();
|
|
21
|
+
const xDomain = xScale.domain();
|
|
22
|
+
const yDomain = yScale.domain();
|
|
23
|
+
if (!series || series.seriesOrder.length === 0) {
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
const seriesToDisplay = series.series[series.seriesOrder[0]];
|
|
27
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)("g", {
|
|
28
|
+
children: seriesToDisplay.data.map(([xIndex, yIndex, value], dataIndex) => {
|
|
29
|
+
const x = xScale(xDomain[xIndex]);
|
|
30
|
+
const y = yScale(yDomain[yIndex]);
|
|
31
|
+
const color = colorScale?.(value);
|
|
32
|
+
if (x === undefined || y === undefined || !color) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_HeatmapItem.HeatmapItem, {
|
|
36
|
+
width: xScale.bandwidth(),
|
|
37
|
+
height: yScale.bandwidth(),
|
|
38
|
+
x: x,
|
|
39
|
+
y: y,
|
|
40
|
+
color: color,
|
|
41
|
+
dataIndex: dataIndex,
|
|
42
|
+
seriesId: series.seriesOrder[0],
|
|
43
|
+
value: value,
|
|
44
|
+
slots: props.slots,
|
|
45
|
+
slotProps: props.slotProps
|
|
46
|
+
}, `${xIndex}_${yIndex}`);
|
|
47
|
+
})
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
process.env.NODE_ENV !== "production" ? HeatmapPlot.propTypes = {
|
|
51
|
+
// ----------------------------- Warning --------------------------------
|
|
52
|
+
// | These PropTypes are generated from the TypeScript type definitions |
|
|
53
|
+
// | To update them edit the TypeScript types and run "pnpm proptypes" |
|
|
54
|
+
// ----------------------------------------------------------------------
|
|
55
|
+
/**
|
|
56
|
+
* The props used for each component slot.
|
|
57
|
+
* @default {}
|
|
58
|
+
*/
|
|
59
|
+
slotProps: _propTypes.default.object,
|
|
60
|
+
/**
|
|
61
|
+
* Overridable component slots.
|
|
62
|
+
* @default {}
|
|
63
|
+
*/
|
|
64
|
+
slots: _propTypes.default.object
|
|
65
|
+
} : void 0;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.getBaseExtremum = void 0;
|
|
7
|
+
const getBaseExtremum = params => {
|
|
8
|
+
const {
|
|
9
|
+
axis
|
|
10
|
+
} = params;
|
|
11
|
+
const minX = Math.min(...(axis.data ?? []));
|
|
12
|
+
const maxX = Math.max(...(axis.data ?? []));
|
|
13
|
+
return [minX, maxX];
|
|
14
|
+
};
|
|
15
|
+
exports.getBaseExtremum = getBaseExtremum;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.default = void 0;
|
|
8
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
9
|
+
const formatter = params => {
|
|
10
|
+
const {
|
|
11
|
+
series,
|
|
12
|
+
seriesOrder
|
|
13
|
+
} = params;
|
|
14
|
+
const defaultizedSeries = {};
|
|
15
|
+
Object.keys(series).forEach(seriesId => {
|
|
16
|
+
defaultizedSeries[seriesId] = (0, _extends2.default)({
|
|
17
|
+
// Defaultize the data and the value formatter.
|
|
18
|
+
valueFormatter: v => v[2].toString(),
|
|
19
|
+
data: []
|
|
20
|
+
}, series[seriesId]);
|
|
21
|
+
});
|
|
22
|
+
return {
|
|
23
|
+
series: defaultizedSeries,
|
|
24
|
+
seriesOrder
|
|
25
|
+
};
|
|
26
|
+
};
|
|
27
|
+
var _default = exports.default = formatter;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
const getColor = (series, xAxis, yAxis, zAxis) => {
|
|
8
|
+
const zColorScale = zAxis?.colorScale;
|
|
9
|
+
if (zColorScale) {
|
|
10
|
+
return dataIndex => {
|
|
11
|
+
const value = series.data[dataIndex];
|
|
12
|
+
const color = zColorScale(value[2]);
|
|
13
|
+
if (color === null) {
|
|
14
|
+
return '';
|
|
15
|
+
}
|
|
16
|
+
return color;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
return () => '';
|
|
20
|
+
};
|
|
21
|
+
var _default = exports.default = getColor;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
|
|
4
|
+
Object.defineProperty(exports, "__esModule", {
|
|
5
|
+
value: true
|
|
6
|
+
});
|
|
7
|
+
exports.getHeatmapUtilityClass = getHeatmapUtilityClass;
|
|
8
|
+
exports.heatmapClasses = void 0;
|
|
9
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime/helpers/extends"));
|
|
10
|
+
var _utils = require("@mui/utils");
|
|
11
|
+
function getHeatmapUtilityClass(slot) {
|
|
12
|
+
// Those should be common to all charts
|
|
13
|
+
if (['highlighted', 'faded'].includes(slot)) {
|
|
14
|
+
return (0, _utils.unstable_generateUtilityClass)('Charts', slot);
|
|
15
|
+
}
|
|
16
|
+
return (0, _utils.unstable_generateUtilityClass)('MuiHeatmap', slot);
|
|
17
|
+
}
|
|
18
|
+
const heatmapClasses = exports.heatmapClasses = (0, _extends2.default)({}, (0, _utils.unstable_generateUtilityClasses)('MuiHeatmap', ['cell']), {
|
|
19
|
+
highlighted: 'Charts-highlighted',
|
|
20
|
+
faded: 'Charts-faded'
|
|
21
|
+
});
|