Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update heatmap visualmap #66

Merged
merged 1 commit into from
Feb 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 4 additions & 10 deletions frontend/src/pages/Returns.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ function ReturnsHeatmapChart({ method }: ReturnsHeatmapChartProps) {
return <Alert severity="error">{error.message}</Alert>;
}

const max = Math.max(...data.returns.map(([_date, val]) => Math.abs(val)));
const max = Math.max(...data.returns.map(([label, val]) => (label.includes("-") ? Math.abs(val) : 0)));
const maxRounded = Math.round(max * 100) / 100;
const valueFormatter = method === "monetary" ? getIntegerCurrencyFormatter(targetCurrency) : percentFormatter;
const monthFormatter = new Intl.DateTimeFormat(undefined, { month: "short" }).format;
Expand All @@ -71,28 +71,22 @@ function ReturnsHeatmapChart({ method }: ReturnsHeatmapChartProps) {
valueFormatter,
},
grid: {
bottom: "100", // space for visualMap
bottom: 100, // space for visualMap
},
xAxis: {
type: "category",
splitArea: {
show: true,
},
},
yAxis: {
type: "category",
splitArea: {
show: true,
},
},
visualMap: {
min: -maxRounded,
max: maxRounded,
calculable: true, // show handles
orient: "horizontal",
left: "center",
bottom: "0", // place visualMap at bottom of chart
itemHeight: "400", // width
bottom: 0, // place visualMap at bottom of chart
itemHeight: 400, // width
inRange: {
color: [NEGATIVE_NUMBER_COLOR, "#fff", POSITIVE_NUMBER_COLOR],
},
Expand Down
Binary file modified frontend/tests/e2e/__image_snapshots__/returns_mdm.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified frontend/tests/e2e/__image_snapshots__/returns_twr.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading