@perses-dev/heatmap-chart-plugin 0.2.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/LICENSE +201 -0
- package/README.md +23 -0
- package/__mf/css/async/341.2a93d99b.css +1 -0
- package/__mf/css/async/759.2a93d99b.css +1 -0
- package/__mf/font/lato-all-300-normal.322bdf14.woff +0 -0
- package/__mf/font/lato-all-400-normal.63513b00.woff +0 -0
- package/__mf/font/lato-all-700-normal.bb27db94.woff +0 -0
- package/__mf/font/lato-all-900-normal.a27049a3.woff +0 -0
- package/__mf/font/lato-latin-300-normal.c5195215.woff2 +0 -0
- package/__mf/font/lato-latin-400-normal.b7ffde23.woff2 +0 -0
- package/__mf/font/lato-latin-700-normal.d5eb20bc.woff2 +0 -0
- package/__mf/font/lato-latin-900-normal.d884a71c.woff2 +0 -0
- package/__mf/font/lato-latin-ext-300-normal.abcc64a9.woff2 +0 -0
- package/__mf/font/lato-latin-ext-400-normal.6ebed106.woff2 +0 -0
- package/__mf/font/lato-latin-ext-700-normal.8697d1d5.woff2 +0 -0
- package/__mf/font/lato-latin-ext-900-normal.20a2b415.woff2 +0 -0
- package/__mf/js/HeatMapChart.81916a67.js +5 -0
- package/__mf/js/async/173.c3418567.js +2 -0
- package/__mf/js/async/173.c3418567.js.LICENSE.txt +19 -0
- package/__mf/js/async/293.f3a89fef.js +1 -0
- package/__mf/js/async/469.15f49b0f.js +71 -0
- package/__mf/js/async/469.15f49b0f.js.LICENSE.txt +21 -0
- package/__mf/js/async/482.cd2ab58b.js +83 -0
- package/__mf/js/async/482.cd2ab58b.js.LICENSE.txt +61 -0
- package/__mf/js/async/774.0d1a003f.js +1 -0
- package/__mf/js/async/790.930331af.js +1 -0
- package/__mf/js/async/863.e810bfc4.js +2 -0
- package/__mf/js/async/863.e810bfc4.js.LICENSE.txt +9 -0
- package/__mf/js/async/934.6f607fed.js +2 -0
- package/__mf/js/async/934.6f607fed.js.LICENSE.txt +37 -0
- package/__mf/js/async/964.944e7b15.js +2 -0
- package/__mf/js/async/964.944e7b15.js.LICENSE.txt +9 -0
- package/__mf/js/async/981.75e172bb.js +2 -0
- package/__mf/js/async/981.75e172bb.js.LICENSE.txt +8 -0
- package/__mf/js/async/__federation_expose_HeatMapChart.ab402c3a.js +23 -0
- package/__mf/js/main.24d16ad6.js +5 -0
- package/lib/HeatMapChart.d.ts +8 -0
- package/lib/HeatMapChart.d.ts.map +1 -0
- package/lib/HeatMapChart.js +34 -0
- package/lib/HeatMapChart.js.map +1 -0
- package/lib/bootstrap.d.ts +2 -0
- package/lib/bootstrap.d.ts.map +1 -0
- package/lib/bootstrap.js +19 -0
- package/lib/bootstrap.js.map +1 -0
- package/lib/cjs/HeatMapChart.js +40 -0
- package/lib/cjs/bootstrap.js +26 -0
- package/lib/cjs/components/HeatMapChart.js +149 -0
- package/lib/cjs/components/HeatMapChartOptionsEditorSettings.js +85 -0
- package/lib/cjs/components/HeatMapChartPanel.js +178 -0
- package/lib/cjs/components/HeatMapTooltip.js +58 -0
- package/lib/cjs/components/index.js +32 -0
- package/lib/cjs/env.d.js +14 -0
- package/lib/cjs/getPluginModule.js +27 -0
- package/lib/cjs/heat-map-chart-model.js +56 -0
- package/lib/cjs/index-federation.js +55 -0
- package/lib/cjs/index.js +47 -0
- package/lib/cjs/setup-tests.js +19 -0
- package/lib/cjs/utils/data-transform.js +34 -0
- package/lib/cjs/utils/get-formatted-axis-label.js +48 -0
- package/lib/cjs/utils/index.js +32 -0
- package/lib/cjs/utils/thresholds.js +22 -0
- package/lib/components/HeatMapChart.d.ts +27 -0
- package/lib/components/HeatMapChart.d.ts.map +1 -0
- package/lib/components/HeatMapChart.js +141 -0
- package/lib/components/HeatMapChart.js.map +1 -0
- package/lib/components/HeatMapChartOptionsEditorSettings.d.ts +4 -0
- package/lib/components/HeatMapChartOptionsEditorSettings.d.ts.map +1 -0
- package/lib/components/HeatMapChartOptionsEditorSettings.js +72 -0
- package/lib/components/HeatMapChartOptionsEditorSettings.js.map +1 -0
- package/lib/components/HeatMapChartPanel.d.ts +7 -0
- package/lib/components/HeatMapChartPanel.d.ts.map +1 -0
- package/lib/components/HeatMapChartPanel.js +165 -0
- package/lib/components/HeatMapChartPanel.js.map +1 -0
- package/lib/components/HeatMapTooltip.d.ts +16 -0
- package/lib/components/HeatMapTooltip.d.ts.map +1 -0
- package/lib/components/HeatMapTooltip.js +50 -0
- package/lib/components/HeatMapTooltip.js.map +1 -0
- package/lib/components/index.d.ts +4 -0
- package/lib/components/index.d.ts.map +1 -0
- package/lib/components/index.js +17 -0
- package/lib/components/index.js.map +1 -0
- package/lib/env.d.js +15 -0
- package/lib/env.d.js.map +1 -0
- package/lib/getPluginModule.d.ts +6 -0
- package/lib/getPluginModule.d.ts.map +1 -0
- package/lib/getPluginModule.js +16 -0
- package/lib/getPluginModule.js.map +1 -0
- package/lib/heat-map-chart-model.d.ts +27 -0
- package/lib/heat-map-chart-model.d.ts.map +1 -0
- package/lib/heat-map-chart-model.js +30 -0
- package/lib/heat-map-chart-model.js.map +1 -0
- package/lib/index-federation.d.ts +1 -0
- package/lib/index-federation.d.ts.map +1 -0
- package/lib/index-federation.js +15 -0
- package/lib/index-federation.js.map +1 -0
- package/lib/index.d.ts +5 -0
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +18 -0
- package/lib/index.js.map +1 -0
- package/lib/setup-tests.d.ts +2 -0
- package/lib/setup-tests.d.ts.map +1 -0
- package/lib/setup-tests.js +17 -0
- package/lib/setup-tests.js.map +1 -0
- package/lib/utils/data-transform.d.ts +5 -0
- package/lib/utils/data-transform.d.ts.map +1 -0
- package/lib/utils/data-transform.js +18 -0
- package/lib/utils/data-transform.js.map +1 -0
- package/lib/utils/get-formatted-axis-label.d.ts +2 -0
- package/lib/utils/get-formatted-axis-label.d.ts.map +1 -0
- package/lib/utils/get-formatted-axis-label.js +41 -0
- package/lib/utils/get-formatted-axis-label.js.map +1 -0
- package/lib/utils/index.d.ts +4 -0
- package/lib/utils/index.d.ts.map +1 -0
- package/lib/utils/index.js +17 -0
- package/lib/utils/index.js.map +1 -0
- package/lib/utils/thresholds.d.ts +4 -0
- package/lib/utils/thresholds.d.ts.map +1 -0
- package/lib/utils/thresholds.js +14 -0
- package/lib/utils/thresholds.js.map +1 -0
- package/mf-manifest.json +169 -0
- package/mf-stats.json +202 -0
- package/package.json +52 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
DEFAULT_FORMAT: function() {
|
|
25
|
+
return DEFAULT_FORMAT;
|
|
26
|
+
},
|
|
27
|
+
DEFAULT_MAX_PERCENT: function() {
|
|
28
|
+
return DEFAULT_MAX_PERCENT;
|
|
29
|
+
},
|
|
30
|
+
DEFAULT_MAX_PERCENT_DECIMAL: function() {
|
|
31
|
+
return DEFAULT_MAX_PERCENT_DECIMAL;
|
|
32
|
+
},
|
|
33
|
+
DEFAULT_MIN_PERCENT: function() {
|
|
34
|
+
return DEFAULT_MIN_PERCENT;
|
|
35
|
+
},
|
|
36
|
+
DEFAULT_MIN_PERCENT_DECIMAL: function() {
|
|
37
|
+
return DEFAULT_MIN_PERCENT_DECIMAL;
|
|
38
|
+
},
|
|
39
|
+
createInitialHeatMapChartOptions: function() {
|
|
40
|
+
return createInitialHeatMapChartOptions;
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const DEFAULT_FORMAT = {
|
|
44
|
+
unit: 'decimal'
|
|
45
|
+
};
|
|
46
|
+
const DEFAULT_MIN_PERCENT = 0;
|
|
47
|
+
const DEFAULT_MAX_PERCENT = 100;
|
|
48
|
+
const DEFAULT_MIN_PERCENT_DECIMAL = 0;
|
|
49
|
+
const DEFAULT_MAX_PERCENT_DECIMAL = 1;
|
|
50
|
+
function createInitialHeatMapChartOptions() {
|
|
51
|
+
return {
|
|
52
|
+
yAxisFormat: DEFAULT_FORMAT,
|
|
53
|
+
countFormat: DEFAULT_FORMAT,
|
|
54
|
+
showVisualMap: true
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
function _getRequireWildcardCache(nodeInterop) {
|
|
15
|
+
if (typeof WeakMap !== "function") return null;
|
|
16
|
+
var cacheBabelInterop = new WeakMap();
|
|
17
|
+
var cacheNodeInterop = new WeakMap();
|
|
18
|
+
return (_getRequireWildcardCache = function(nodeInterop) {
|
|
19
|
+
return nodeInterop ? cacheNodeInterop : cacheBabelInterop;
|
|
20
|
+
})(nodeInterop);
|
|
21
|
+
}
|
|
22
|
+
function _interop_require_wildcard(obj, nodeInterop) {
|
|
23
|
+
if (!nodeInterop && obj && obj.__esModule) {
|
|
24
|
+
return obj;
|
|
25
|
+
}
|
|
26
|
+
if (obj === null || typeof obj !== "object" && typeof obj !== "function") {
|
|
27
|
+
return {
|
|
28
|
+
default: obj
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
var cache = _getRequireWildcardCache(nodeInterop);
|
|
32
|
+
if (cache && cache.has(obj)) {
|
|
33
|
+
return cache.get(obj);
|
|
34
|
+
}
|
|
35
|
+
var newObj = {
|
|
36
|
+
__proto__: null
|
|
37
|
+
};
|
|
38
|
+
var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor;
|
|
39
|
+
for(var key in obj){
|
|
40
|
+
if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) {
|
|
41
|
+
var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null;
|
|
42
|
+
if (desc && (desc.get || desc.set)) {
|
|
43
|
+
Object.defineProperty(newObj, key, desc);
|
|
44
|
+
} else {
|
|
45
|
+
newObj[key] = obj[key];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
newObj.default = obj;
|
|
50
|
+
if (cache) {
|
|
51
|
+
cache.set(obj, newObj);
|
|
52
|
+
}
|
|
53
|
+
return newObj;
|
|
54
|
+
}
|
|
55
|
+
Promise.resolve().then(()=>/*#__PURE__*/ _interop_require_wildcard(require("./bootstrap")));
|
package/lib/cjs/index.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
function _export(target, all) {
|
|
18
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: all[name]
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
_export(exports, {
|
|
24
|
+
HeatMapChartPanel: function() {
|
|
25
|
+
return _components.HeatMapChartPanel;
|
|
26
|
+
},
|
|
27
|
+
getPluginModule: function() {
|
|
28
|
+
return _getPluginModule.getPluginModule;
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
const _getPluginModule = require("./getPluginModule");
|
|
32
|
+
const _components = require("./components");
|
|
33
|
+
_export_star(require("./heat-map-chart-model"), exports);
|
|
34
|
+
_export_star(require("./HeatMapChart"), exports);
|
|
35
|
+
function _export_star(from, to) {
|
|
36
|
+
Object.keys(from).forEach(function(k) {
|
|
37
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
38
|
+
Object.defineProperty(to, k, {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function() {
|
|
41
|
+
return from[k];
|
|
42
|
+
}
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return from;
|
|
47
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
require("@testing-library/jest-dom");
|
|
18
|
+
// Always mock e-charts during tests since we don't have a proper canvas in jsdom
|
|
19
|
+
jest.mock('echarts/core');
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
function _export(target, all) {
|
|
6
|
+
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
get: all[name]
|
|
9
|
+
});
|
|
10
|
+
}
|
|
11
|
+
_export(exports, {
|
|
12
|
+
generateCompleteTimestamps: function() {
|
|
13
|
+
return generateCompleteTimestamps;
|
|
14
|
+
},
|
|
15
|
+
getCommonTimeScaleForQueries: function() {
|
|
16
|
+
return getCommonTimeScaleForQueries;
|
|
17
|
+
}
|
|
18
|
+
});
|
|
19
|
+
const _core = require("@perses-dev/core");
|
|
20
|
+
function getCommonTimeScaleForQueries(queries) {
|
|
21
|
+
const seriesData = queries.map((query)=>query.data);
|
|
22
|
+
return (0, _core.getCommonTimeScale)(seriesData);
|
|
23
|
+
}
|
|
24
|
+
function generateCompleteTimestamps(timescale) {
|
|
25
|
+
if (!timescale) {
|
|
26
|
+
return [];
|
|
27
|
+
}
|
|
28
|
+
const { startMs, endMs, stepMs } = timescale;
|
|
29
|
+
const timestamps = [];
|
|
30
|
+
for(let time = startMs; time <= endMs; time += stepMs){
|
|
31
|
+
timestamps.push(time);
|
|
32
|
+
}
|
|
33
|
+
return timestamps;
|
|
34
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
// Copyright 2024 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
Object.defineProperty(exports, "getFormattedHeatmapAxisLabel", {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: function() {
|
|
20
|
+
return getFormattedHeatmapAxisLabel;
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
const _components = require("@perses-dev/components");
|
|
24
|
+
function getFormattedHeatmapAxisLabel(rangeMs, timezone) {
|
|
25
|
+
return function(value) {
|
|
26
|
+
const dayMs = 86400000;
|
|
27
|
+
const monthMs = 2629440000;
|
|
28
|
+
const yearMs = 31536000000;
|
|
29
|
+
const timeStamp = new Date(Number(value));
|
|
30
|
+
// more than 5 years
|
|
31
|
+
if (rangeMs > yearMs * 5) {
|
|
32
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'yyy', timezone);
|
|
33
|
+
}
|
|
34
|
+
// more than 2 years
|
|
35
|
+
if (rangeMs > yearMs * 2) {
|
|
36
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'MMM yyy', timezone);
|
|
37
|
+
}
|
|
38
|
+
// between 5 days to 6 months
|
|
39
|
+
if (rangeMs > dayMs * 10 && rangeMs < monthMs * 6) {
|
|
40
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'dd.MM', timezone); // 12-01
|
|
41
|
+
}
|
|
42
|
+
// between 2 and 10 days
|
|
43
|
+
if (rangeMs > dayMs * 2 && rangeMs <= dayMs * 10) {
|
|
44
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'dd.MM HH:mm', timezone); // 12-01; // 12-01 12:30
|
|
45
|
+
}
|
|
46
|
+
return (0, _components.formatWithTimeZone)(timeStamp, 'HH:mm', timezone);
|
|
47
|
+
};
|
|
48
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
"use strict";
|
|
14
|
+
Object.defineProperty(exports, "__esModule", {
|
|
15
|
+
value: true
|
|
16
|
+
});
|
|
17
|
+
_export_star(require("./data-transform"), exports);
|
|
18
|
+
_export_star(require("./get-formatted-axis-label"), exports);
|
|
19
|
+
_export_star(require("./thresholds"), exports);
|
|
20
|
+
function _export_star(from, to) {
|
|
21
|
+
Object.keys(from).forEach(function(k) {
|
|
22
|
+
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
23
|
+
Object.defineProperty(to, k, {
|
|
24
|
+
enumerable: true,
|
|
25
|
+
get: function() {
|
|
26
|
+
return from[k];
|
|
27
|
+
}
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
return from;
|
|
32
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", {
|
|
3
|
+
value: true
|
|
4
|
+
});
|
|
5
|
+
Object.defineProperty(exports, "getColorFromThresholds", {
|
|
6
|
+
enumerable: true,
|
|
7
|
+
get: function() {
|
|
8
|
+
return getColorFromThresholds;
|
|
9
|
+
}
|
|
10
|
+
});
|
|
11
|
+
function getColorFromThresholds(value, thresholds, chartsTheme, defaultColor) {
|
|
12
|
+
if (thresholds?.steps) {
|
|
13
|
+
const matchingColors = thresholds.steps.map((step, index)=>{
|
|
14
|
+
if (value >= step.value) {
|
|
15
|
+
return step.color ?? chartsTheme.thresholds.palette[index] ?? thresholds.defaultColor ?? defaultColor;
|
|
16
|
+
}
|
|
17
|
+
return null;
|
|
18
|
+
}).filter((color)=>color !== null);
|
|
19
|
+
return matchingColors[matchingColors.length - 1] ?? thresholds.defaultColor ?? defaultColor;
|
|
20
|
+
}
|
|
21
|
+
return thresholds?.defaultColor ?? defaultColor;
|
|
22
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { FormatOptions, TimeScale } from '@perses-dev/core';
|
|
3
|
+
export type HeatMapData = [number, number, number | undefined];
|
|
4
|
+
export interface HeatMapDataItem {
|
|
5
|
+
value: HeatMapData;
|
|
6
|
+
label: string;
|
|
7
|
+
itemStyle?: {
|
|
8
|
+
color?: string;
|
|
9
|
+
borderColor?: string;
|
|
10
|
+
borderWidth?: number;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export interface HeatMapChartProps {
|
|
14
|
+
width: number;
|
|
15
|
+
height: number;
|
|
16
|
+
data: HeatMapDataItem[];
|
|
17
|
+
xAxisCategories: number[];
|
|
18
|
+
yAxisCategories: string[];
|
|
19
|
+
yAxisFormat?: FormatOptions;
|
|
20
|
+
countFormat?: FormatOptions;
|
|
21
|
+
countMin?: number;
|
|
22
|
+
countMax?: number;
|
|
23
|
+
timeScale?: TimeScale;
|
|
24
|
+
showVisualMap?: boolean;
|
|
25
|
+
}
|
|
26
|
+
export declare function HeatMapChart({ width, height, data, xAxisCategories, yAxisCategories, yAxisFormat, countFormat, countMin, countMax, timeScale, showVisualMap, }: HeatMapChartProps): ReactElement | null;
|
|
27
|
+
//# sourceMappingURL=HeatMapChart.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeatMapChart.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapChart.tsx"],"names":[],"mappings":"AAaA,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAyB5D,MAAM,MAAM,WAAW,GAAG,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;AAE/D,MAAM,WAAW,eAAe;IAC9B,KAAK,EAAE,WAAW,CAAC;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE;QACV,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,WAAW,CAAC,EAAE,MAAM,CAAC;KACtB,CAAC;CACH;AAED,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,eAAe,EAAE,CAAC;IACxB,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,eAAe,EAAE,MAAM,EAAE,CAAC;IAC1B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,WAAW,CAAC,EAAE,aAAa,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,aAAa,CAAC,EAAE,OAAO,CAAC;CAEzB;AAED,wBAAgB,YAAY,CAAC,EAC3B,KAAK,EACL,MAAM,EACN,IAAI,EACJ,eAAe,EACf,eAAe,EACf,WAAW,EACX,WAAW,EACX,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,aAAa,GACd,EAAE,iBAAiB,GAAG,YAAY,GAAG,IAAI,CAwGzC"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
14
|
+
import { useMemo } from 'react';
|
|
15
|
+
import { EChart, getFormattedAxis, useChartsTheme, useTimeZone } from '@perses-dev/components';
|
|
16
|
+
import { use } from 'echarts/core';
|
|
17
|
+
import { HeatmapChart as EChartsHeatmapChart } from 'echarts/charts';
|
|
18
|
+
import { useTheme } from '@mui/material';
|
|
19
|
+
import { getFormattedHeatmapAxisLabel } from '../utils';
|
|
20
|
+
import { generateTooltipHTML } from './HeatMapTooltip';
|
|
21
|
+
use([
|
|
22
|
+
EChartsHeatmapChart
|
|
23
|
+
]);
|
|
24
|
+
// The default coloring is a blue->yellow->red gradient
|
|
25
|
+
const DEFAULT_VISUAL_MAP_COLORS = [
|
|
26
|
+
'#313695',
|
|
27
|
+
'#4575b4',
|
|
28
|
+
'#74add1',
|
|
29
|
+
'#abd9e9',
|
|
30
|
+
'#e0f3f8',
|
|
31
|
+
'#ffffbf',
|
|
32
|
+
'#fee090',
|
|
33
|
+
'#fdae61',
|
|
34
|
+
'#f46d43',
|
|
35
|
+
'#d73027',
|
|
36
|
+
'#a50026'
|
|
37
|
+
];
|
|
38
|
+
export function HeatMapChart({ width, height, data, xAxisCategories, yAxisCategories, yAxisFormat, countFormat, countMin, countMax, timeScale, showVisualMap }) {
|
|
39
|
+
const chartsTheme = useChartsTheme();
|
|
40
|
+
const theme = useTheme();
|
|
41
|
+
const { timeZone } = useTimeZone();
|
|
42
|
+
const option = useMemo(()=>{
|
|
43
|
+
return {
|
|
44
|
+
tooltip: {
|
|
45
|
+
appendToBody: true,
|
|
46
|
+
formatter: (params)=>{
|
|
47
|
+
return generateTooltipHTML({
|
|
48
|
+
data: params.data.value,
|
|
49
|
+
label: params.data.label,
|
|
50
|
+
marker: params.marker,
|
|
51
|
+
xAxisCategories,
|
|
52
|
+
yAxisCategories,
|
|
53
|
+
theme,
|
|
54
|
+
yAxisFormat: yAxisFormat,
|
|
55
|
+
countFormat: countFormat
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
},
|
|
59
|
+
xAxis: {
|
|
60
|
+
type: 'category',
|
|
61
|
+
data: xAxisCategories,
|
|
62
|
+
axisLabel: {
|
|
63
|
+
hideOverlap: true,
|
|
64
|
+
formatter: getFormattedHeatmapAxisLabel(timeScale?.rangeMs ?? 0, timeZone)
|
|
65
|
+
}
|
|
66
|
+
},
|
|
67
|
+
yAxis: getFormattedAxis({
|
|
68
|
+
type: 'category',
|
|
69
|
+
data: yAxisCategories
|
|
70
|
+
}, yAxisFormat),
|
|
71
|
+
visualMap: {
|
|
72
|
+
show: showVisualMap ?? false,
|
|
73
|
+
type: 'continuous',
|
|
74
|
+
min: countMin,
|
|
75
|
+
max: countMax,
|
|
76
|
+
realtime: false,
|
|
77
|
+
itemHeight: height - 30,
|
|
78
|
+
itemWidth: 10,
|
|
79
|
+
orient: 'vertical',
|
|
80
|
+
left: 'right',
|
|
81
|
+
top: 'center',
|
|
82
|
+
inRange: {
|
|
83
|
+
color: DEFAULT_VISUAL_MAP_COLORS
|
|
84
|
+
},
|
|
85
|
+
textStyle: {
|
|
86
|
+
color: theme.palette.text.primary,
|
|
87
|
+
textBorderColor: theme.palette.background.default,
|
|
88
|
+
textBorderWidth: 5
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
series: [
|
|
92
|
+
{
|
|
93
|
+
name: 'Gaussian',
|
|
94
|
+
type: 'heatmap',
|
|
95
|
+
data: data,
|
|
96
|
+
emphasis: {
|
|
97
|
+
itemStyle: {
|
|
98
|
+
borderColor: '#333',
|
|
99
|
+
borderWidth: 1
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
progressive: 1000,
|
|
103
|
+
animation: false
|
|
104
|
+
}
|
|
105
|
+
]
|
|
106
|
+
};
|
|
107
|
+
}, [
|
|
108
|
+
xAxisCategories,
|
|
109
|
+
timeScale?.rangeMs,
|
|
110
|
+
timeZone,
|
|
111
|
+
yAxisCategories,
|
|
112
|
+
yAxisFormat,
|
|
113
|
+
showVisualMap,
|
|
114
|
+
countMin,
|
|
115
|
+
countMax,
|
|
116
|
+
height,
|
|
117
|
+
theme,
|
|
118
|
+
data,
|
|
119
|
+
countFormat
|
|
120
|
+
]);
|
|
121
|
+
const chart = useMemo(()=>/*#__PURE__*/ _jsx(EChart, {
|
|
122
|
+
sx: {
|
|
123
|
+
width: width,
|
|
124
|
+
height: height,
|
|
125
|
+
padding: `${chartsTheme.container.padding.default}px`
|
|
126
|
+
},
|
|
127
|
+
option: option,
|
|
128
|
+
theme: chartsTheme.echartsTheme
|
|
129
|
+
}), [
|
|
130
|
+
chartsTheme.container.padding.default,
|
|
131
|
+
chartsTheme.echartsTheme,
|
|
132
|
+
height,
|
|
133
|
+
option,
|
|
134
|
+
width
|
|
135
|
+
]);
|
|
136
|
+
return /*#__PURE__*/ _jsx(_Fragment, {
|
|
137
|
+
children: chart
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
//# sourceMappingURL=HeatMapChart.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/HeatMapChart.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { ReactElement, useMemo } from 'react';\nimport { FormatOptions, TimeScale } from '@perses-dev/core';\nimport { EChart, getFormattedAxis, useChartsTheme, useTimeZone } from '@perses-dev/components';\nimport { use, EChartsCoreOption } from 'echarts/core';\nimport { HeatmapChart as EChartsHeatmapChart } from 'echarts/charts';\nimport { useTheme } from '@mui/material';\nimport { getFormattedHeatmapAxisLabel } from '../utils';\nimport { generateTooltipHTML } from './HeatMapTooltip';\n\nuse([EChartsHeatmapChart]);\n\n// The default coloring is a blue->yellow->red gradient\nconst DEFAULT_VISUAL_MAP_COLORS = [\n '#313695',\n '#4575b4',\n '#74add1',\n '#abd9e9',\n '#e0f3f8',\n '#ffffbf',\n '#fee090',\n '#fdae61',\n '#f46d43',\n '#d73027',\n '#a50026',\n];\n\nexport type HeatMapData = [number, number, number | undefined]; // [x, y, value]\n\nexport interface HeatMapDataItem {\n value: HeatMapData;\n label: string;\n itemStyle?: {\n color?: string;\n borderColor?: string;\n borderWidth?: number;\n };\n}\n\nexport interface HeatMapChartProps {\n width: number;\n height: number;\n data: HeatMapDataItem[];\n xAxisCategories: number[];\n yAxisCategories: string[];\n yAxisFormat?: FormatOptions;\n countFormat?: FormatOptions;\n countMin?: number;\n countMax?: number;\n timeScale?: TimeScale;\n showVisualMap?: boolean;\n // TODO: exponential?: boolean;\n}\n\nexport function HeatMapChart({\n width,\n height,\n data,\n xAxisCategories,\n yAxisCategories,\n yAxisFormat,\n countFormat,\n countMin,\n countMax,\n timeScale,\n showVisualMap,\n}: HeatMapChartProps): ReactElement | null {\n const chartsTheme = useChartsTheme();\n const theme = useTheme();\n const { timeZone } = useTimeZone();\n\n const option: EChartsCoreOption = useMemo(() => {\n return {\n tooltip: {\n appendToBody: true,\n formatter: (params: { data: HeatMapDataItem; marker: string }) => {\n return generateTooltipHTML({\n data: params.data.value,\n label: params.data.label,\n marker: params.marker,\n xAxisCategories,\n yAxisCategories,\n theme,\n yAxisFormat: yAxisFormat,\n countFormat: countFormat,\n });\n },\n },\n xAxis: {\n type: 'category',\n data: xAxisCategories,\n axisLabel: {\n hideOverlap: true,\n formatter: getFormattedHeatmapAxisLabel(timeScale?.rangeMs ?? 0, timeZone),\n },\n },\n yAxis: getFormattedAxis(\n {\n type: 'category',\n data: yAxisCategories,\n },\n yAxisFormat\n ),\n visualMap: {\n show: showVisualMap ?? false,\n type: 'continuous',\n min: countMin,\n max: countMax,\n realtime: false,\n itemHeight: height - 30,\n itemWidth: 10,\n orient: 'vertical',\n left: 'right',\n top: 'center',\n inRange: {\n color: DEFAULT_VISUAL_MAP_COLORS,\n },\n textStyle: {\n color: theme.palette.text.primary,\n textBorderColor: theme.palette.background.default,\n textBorderWidth: 5,\n },\n },\n series: [\n {\n name: 'Gaussian',\n type: 'heatmap',\n data: data,\n emphasis: {\n itemStyle: {\n borderColor: '#333',\n borderWidth: 1,\n },\n },\n progressive: 1000,\n animation: false,\n },\n ],\n };\n }, [\n xAxisCategories,\n timeScale?.rangeMs,\n timeZone,\n yAxisCategories,\n yAxisFormat,\n showVisualMap,\n countMin,\n countMax,\n height,\n theme,\n data,\n countFormat,\n ]);\n\n const chart = useMemo(\n () => (\n <EChart\n sx={{\n width: width,\n height: height,\n padding: `${chartsTheme.container.padding.default}px`,\n }}\n option={option}\n theme={chartsTheme.echartsTheme}\n />\n ),\n [chartsTheme.container.padding.default, chartsTheme.echartsTheme, height, option, width]\n );\n\n return <>{chart}</>;\n}\n"],"names":["useMemo","EChart","getFormattedAxis","useChartsTheme","useTimeZone","use","HeatmapChart","EChartsHeatmapChart","useTheme","getFormattedHeatmapAxisLabel","generateTooltipHTML","DEFAULT_VISUAL_MAP_COLORS","HeatMapChart","width","height","data","xAxisCategories","yAxisCategories","yAxisFormat","countFormat","countMin","countMax","timeScale","showVisualMap","chartsTheme","theme","timeZone","option","tooltip","appendToBody","formatter","params","value","label","marker","xAxis","type","axisLabel","hideOverlap","rangeMs","yAxis","visualMap","show","min","max","realtime","itemHeight","itemWidth","orient","left","top","inRange","color","textStyle","palette","text","primary","textBorderColor","background","default","textBorderWidth","series","name","emphasis","itemStyle","borderColor","borderWidth","progressive","animation","chart","sx","padding","container","echartsTheme"],"mappings":"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"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { ReactElement } from 'react';
|
|
2
|
+
import { HeatMapChartOptionsEditorProps } from '../heat-map-chart-model';
|
|
3
|
+
export declare function HeatMapChartOptionsEditorSettings(props: HeatMapChartOptionsEditorProps): ReactElement;
|
|
4
|
+
//# sourceMappingURL=HeatMapChartOptionsEditorSettings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeatMapChartOptionsEditorSettings.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapChartOptionsEditorSettings.tsx"],"names":[],"mappings":"AAwBA,OAAO,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AACrC,OAAO,EAAuC,8BAA8B,EAAE,MAAM,yBAAyB,CAAC;AAE9G,wBAAgB,iCAAiC,CAAC,KAAK,EAAE,8BAA8B,GAAG,YAAY,CAiDrG"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
// Copyright 2025 The Perses Authors
|
|
2
|
+
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
3
|
+
// you may not use this file except in compliance with the License.
|
|
4
|
+
// You may obtain a copy of the License at
|
|
5
|
+
//
|
|
6
|
+
// http://www.apache.org/licenses/LICENSE-2.0
|
|
7
|
+
//
|
|
8
|
+
// Unless required by applicable law or agreed to in writing, software
|
|
9
|
+
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
10
|
+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
11
|
+
// See the License for the specific language governing permissions and
|
|
12
|
+
// limitations under the License.
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import { Switch } from '@mui/material';
|
|
15
|
+
import { FormatControls, OptionsEditorColumn, OptionsEditorControl, OptionsEditorGrid, OptionsEditorGroup } from '@perses-dev/components';
|
|
16
|
+
import { produce } from 'immer';
|
|
17
|
+
import merge from 'lodash/merge';
|
|
18
|
+
import { DEFAULT_FORMAT } from '../heat-map-chart-model';
|
|
19
|
+
export function HeatMapChartOptionsEditorSettings(props) {
|
|
20
|
+
const { onChange, value } = props;
|
|
21
|
+
const handleYAxisFormatChange = (newFormat)=>{
|
|
22
|
+
onChange(produce(value, (draft)=>{
|
|
23
|
+
draft.yAxisFormat = newFormat;
|
|
24
|
+
}));
|
|
25
|
+
};
|
|
26
|
+
const handleCountFormatChange = (newFormat)=>{
|
|
27
|
+
onChange(produce(value, (draft)=>{
|
|
28
|
+
draft.countFormat = newFormat;
|
|
29
|
+
}));
|
|
30
|
+
};
|
|
31
|
+
const handleShowVisualMapChange = (_, checked)=>{
|
|
32
|
+
onChange(produce(value, (draft)=>{
|
|
33
|
+
draft.showVisualMap = checked;
|
|
34
|
+
}));
|
|
35
|
+
};
|
|
36
|
+
// ensures decimalPlaces defaults to correct value
|
|
37
|
+
const yAxisFormat = merge({}, DEFAULT_FORMAT, value.yAxisFormat);
|
|
38
|
+
const countFormat = merge({}, DEFAULT_FORMAT, value.countFormat);
|
|
39
|
+
return /*#__PURE__*/ _jsxs(OptionsEditorGrid, {
|
|
40
|
+
children: [
|
|
41
|
+
/*#__PURE__*/ _jsx(OptionsEditorColumn, {
|
|
42
|
+
children: /*#__PURE__*/ _jsxs(OptionsEditorGroup, {
|
|
43
|
+
title: "Bucket Count",
|
|
44
|
+
children: [
|
|
45
|
+
/*#__PURE__*/ _jsx(FormatControls, {
|
|
46
|
+
value: countFormat,
|
|
47
|
+
onChange: handleCountFormatChange
|
|
48
|
+
}),
|
|
49
|
+
/*#__PURE__*/ _jsx(OptionsEditorControl, {
|
|
50
|
+
label: "Show Visual Map",
|
|
51
|
+
control: /*#__PURE__*/ _jsx(Switch, {
|
|
52
|
+
checked: !!value.showVisualMap,
|
|
53
|
+
onChange: handleShowVisualMapChange
|
|
54
|
+
})
|
|
55
|
+
})
|
|
56
|
+
]
|
|
57
|
+
})
|
|
58
|
+
}),
|
|
59
|
+
/*#__PURE__*/ _jsx(OptionsEditorColumn, {
|
|
60
|
+
children: /*#__PURE__*/ _jsx(OptionsEditorGroup, {
|
|
61
|
+
title: "Y Axis",
|
|
62
|
+
children: /*#__PURE__*/ _jsx(FormatControls, {
|
|
63
|
+
value: yAxisFormat,
|
|
64
|
+
onChange: handleYAxisFormatChange
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
})
|
|
68
|
+
]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
//# sourceMappingURL=HeatMapChartOptionsEditorSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/HeatMapChartOptionsEditorSettings.tsx"],"sourcesContent":["// Copyright 2025 The Perses Authors\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport { Switch, SwitchProps } from '@mui/material';\nimport {\n FormatControls,\n FormatControlsProps,\n OptionsEditorColumn,\n OptionsEditorControl,\n OptionsEditorGrid,\n OptionsEditorGroup,\n} from '@perses-dev/components';\nimport { produce } from 'immer';\nimport merge from 'lodash/merge';\nimport { ReactElement } from 'react';\nimport { DEFAULT_FORMAT, HeatMapChartOptions, HeatMapChartOptionsEditorProps } from '../heat-map-chart-model';\n\nexport function HeatMapChartOptionsEditorSettings(props: HeatMapChartOptionsEditorProps): ReactElement {\n const { onChange, value } = props;\n\n const handleYAxisFormatChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.yAxisFormat = newFormat;\n })\n );\n };\n\n const handleCountFormatChange: FormatControlsProps['onChange'] = (newFormat) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.countFormat = newFormat;\n })\n );\n };\n\n const handleShowVisualMapChange: SwitchProps['onChange'] = (_: unknown, checked: boolean) => {\n onChange(\n produce(value, (draft: HeatMapChartOptions) => {\n draft.showVisualMap = checked;\n })\n );\n };\n\n // ensures decimalPlaces defaults to correct value\n const yAxisFormat = merge({}, DEFAULT_FORMAT, value.yAxisFormat);\n const countFormat = merge({}, DEFAULT_FORMAT, value.countFormat);\n\n return (\n <OptionsEditorGrid>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Bucket Count\">\n <FormatControls value={countFormat} onChange={handleCountFormatChange} />\n <OptionsEditorControl\n label=\"Show Visual Map\"\n control={<Switch checked={!!value.showVisualMap} onChange={handleShowVisualMapChange} />}\n />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n <OptionsEditorColumn>\n <OptionsEditorGroup title=\"Y Axis\">\n <FormatControls value={yAxisFormat} onChange={handleYAxisFormatChange} />\n </OptionsEditorGroup>\n </OptionsEditorColumn>\n </OptionsEditorGrid>\n );\n}\n"],"names":["Switch","FormatControls","OptionsEditorColumn","OptionsEditorControl","OptionsEditorGrid","OptionsEditorGroup","produce","merge","DEFAULT_FORMAT","HeatMapChartOptionsEditorSettings","props","onChange","value","handleYAxisFormatChange","newFormat","draft","yAxisFormat","handleCountFormatChange","countFormat","handleShowVisualMapChange","_","checked","showVisualMap","title","label","control"],"mappings":"AAAA,oCAAoC;AACpC,kEAAkE;AAClE,mEAAmE;AACnE,0CAA0C;AAC1C,EAAE;AACF,6CAA6C;AAC7C,EAAE;AACF,sEAAsE;AACtE,oEAAoE;AACpE,2EAA2E;AAC3E,sEAAsE;AACtE,iCAAiC;;AAEjC,SAASA,MAAM,QAAqB,gBAAgB;AACpD,SACEC,cAAc,EAEdC,mBAAmB,EACnBC,oBAAoB,EACpBC,iBAAiB,EACjBC,kBAAkB,QACb,yBAAyB;AAChC,SAASC,OAAO,QAAQ,QAAQ;AAChC,OAAOC,WAAW,eAAe;AAEjC,SAASC,cAAc,QAA6D,0BAA0B;AAE9G,OAAO,SAASC,kCAAkCC,KAAqC;IACrF,MAAM,EAAEC,QAAQ,EAAEC,KAAK,EAAE,GAAGF;IAE5B,MAAMG,0BAA2D,CAACC;QAChEH,SACEL,QAAQM,OAAO,CAACG;YACdA,MAAMC,WAAW,GAAGF;QACtB;IAEJ;IAEA,MAAMG,0BAA2D,CAACH;QAChEH,SACEL,QAAQM,OAAO,CAACG;YACdA,MAAMG,WAAW,GAAGJ;QACtB;IAEJ;IAEA,MAAMK,4BAAqD,CAACC,GAAYC;QACtEV,SACEL,QAAQM,OAAO,CAACG;YACdA,MAAMO,aAAa,GAAGD;QACxB;IAEJ;IAEA,kDAAkD;IAClD,MAAML,cAAcT,MAAM,CAAC,GAAGC,gBAAgBI,MAAMI,WAAW;IAC/D,MAAME,cAAcX,MAAM,CAAC,GAAGC,gBAAgBI,MAAMM,WAAW;IAE/D,qBACE,MAACd;;0BACC,KAACF;0BACC,cAAA,MAACG;oBAAmBkB,OAAM;;sCACxB,KAACtB;4BAAeW,OAAOM;4BAAaP,UAAUM;;sCAC9C,KAACd;4BACCqB,OAAM;4BACNC,uBAAS,KAACzB;gCAAOqB,SAAS,CAAC,CAACT,MAAMU,aAAa;gCAAEX,UAAUQ;;;;;;0BAIjE,KAACjB;0BACC,cAAA,KAACG;oBAAmBkB,OAAM;8BACxB,cAAA,KAACtB;wBAAeW,OAAOI;wBAAaL,UAAUE;;;;;;AAKxD"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { TimeSeriesData } from '@perses-dev/core';
|
|
2
|
+
import { PanelProps } from '@perses-dev/plugin-system';
|
|
3
|
+
import { ReactElement } from 'react';
|
|
4
|
+
import { HeatMapChartOptions } from '../heat-map-chart-model';
|
|
5
|
+
export type HeatMapChartPanelProps = PanelProps<HeatMapChartOptions, TimeSeriesData>;
|
|
6
|
+
export declare function HeatMapChartPanel(props: HeatMapChartPanelProps): ReactElement | null;
|
|
7
|
+
//# sourceMappingURL=HeatMapChartPanel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HeatMapChartPanel.d.ts","sourceRoot":"","sources":["../../../src/components/HeatMapChartPanel.tsx"],"names":[],"mappings":"AAcA,OAAO,EAAyB,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,2BAA2B,CAAC;AAEvD,OAAO,EAAE,YAAY,EAAW,MAAM,OAAO,CAAC;AAC9C,OAAO,EAAkB,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAO9E,MAAM,MAAM,sBAAsB,GAAG,UAAU,CAAC,mBAAmB,EAAE,cAAc,CAAC,CAAC;AAErF,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,sBAAsB,GAAG,YAAY,GAAG,IAAI,CAmKpF"}
|