Skip to content

Commit daff4e5

Browse files
[#698] Fix 2 driver heatmap give 2 same range value
1 parent 975bdf8 commit daff4e5

File tree

1 file changed

+31
-17
lines changed

1 file changed

+31
-17
lines changed

frontend/src/pages/cases/visualizations/ChartTwoDriverHeatmap.js

Lines changed: 31 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import React, { useMemo, useState } from "react";
22
import Chart from "../../../components/chart";
3-
import { range } from "lodash";
43
import { getFunctionDefaultValue } from "../../../lib";
54
import { Row, Col, Space, Card } from "antd";
65
import { thousandFormatter } from "../../../components/chart/options/common";
76
import { VisualCardWrapper } from "../components";
7+
// import { range } from "lodash";
88

99
// Withhout bin value calculation from ChartBinningHeatmapSensitivityAnalysis
1010

@@ -22,22 +22,36 @@ const getOptions = ({
2222
target = 0,
2323
origin = [],
2424
}) => {
25-
const xAxisData = [
26-
...range(
27-
xAxis.min,
28-
xAxis.max,
29-
(xAxis.max - xAxis.min) / (HEATMAP_SIZE - 1)
30-
).map((x) => x.toFixed(2)),
31-
xAxis.max.toFixed(2),
32-
];
33-
const yAxisData = [
34-
...range(
35-
yAxis.min,
36-
yAxis.max,
37-
(yAxis.max - yAxis.min) / (HEATMAP_SIZE - 1)
38-
).map((x) => x.toFixed(2)),
39-
yAxis.max.toFixed(2),
40-
];
25+
// TODO:: Remove after task ENG-2487 marked as DONE
26+
// const xAxisData = [
27+
// ...range(
28+
// xAxis.min,
29+
// xAxis.max,
30+
// (xAxis.max - xAxis.min) / (HEATMAP_SIZE - 1)
31+
// ).map((x) => x.toFixed(2)),
32+
// xAxis.max.toFixed(2),
33+
// ];
34+
// const yAxisData = [
35+
// ...range(
36+
// yAxis.min,
37+
// yAxis.max,
38+
// (yAxis.max - yAxis.min) / (HEATMAP_SIZE - 1)
39+
// ).map((x) => x.toFixed(2)),
40+
// yAxis.max.toFixed(2),
41+
// ];
42+
// EOL TODO::
43+
44+
const xAxisData = Array.from({ length: HEATMAP_SIZE }, (_, i) => {
45+
const value =
46+
xAxis.min + (i * (xAxis.max - xAxis.min)) / (HEATMAP_SIZE - 1);
47+
return value.toFixed(2);
48+
});
49+
50+
const yAxisData = Array.from({ length: HEATMAP_SIZE }, (_, i) => {
51+
const value =
52+
yAxis.min + (i * (yAxis.max - yAxis.min)) / (HEATMAP_SIZE - 1);
53+
return value.toFixed(2);
54+
});
4155

4256
const dt = xAxisData
4357
.map((h) => {

0 commit comments

Comments
 (0)