From b94856319ceb8ef231f9750d21cdce18aee0eae1 Mon Sep 17 00:00:00 2001 From: Zygimantas <5236121+Zygimantass@users.noreply.github.com> Date: Thu, 28 Dec 2023 22:31:16 +0200 Subject: [PATCH 1/3] feat(main-chart): add minimum max scale for main chart --- src/components/pages/home/MainChart.tsx | 9 +++++++++ src/constants.ts | 5 +++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/components/pages/home/MainChart.tsx b/src/components/pages/home/MainChart.tsx index 81afdea..1fcc0c0 100644 --- a/src/components/pages/home/MainChart.tsx +++ b/src/components/pages/home/MainChart.tsx @@ -1,4 +1,5 @@ import CustomTooltip from "@/components/CustomTooltip"; +import { MAIN_CHART_DATA_MAX } from "@/constants"; import { useMainChartData, useValidatorsWithStatsQuery } from "@/hooks"; import { toggleSelectedMoniker, useHomeStore } from "@/store/home"; import clsx from "clsx"; @@ -44,6 +45,13 @@ export const MainChart = () => { ); } + const points = chartData + const lastPoint = points[points.length - 1] + + const largestDatapoint = Math.max(...Object.entries(lastPoint).map( + ([key, value]) => key === "key" ? 0 : value + ), MAIN_CHART_DATA_MAX) + return ( @@ -62,6 +70,7 @@ export const MainChart = () => { /> Date: Thu, 28 Dec 2023 22:43:28 +0200 Subject: [PATCH 2/3] fix: constants --- src/constants.ts | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/constants.ts b/src/constants.ts index c084c8f..e8eed85 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -1,6 +1,6 @@ export const API_URL = process.env.NEXT_PUBLIC_API_URL || "https://dydx-mev-api-dev.skip.money"; -export const MAIN_CHART_DATAPOINT_LIMIT = 1000; -export const MAIN_CHART_DATAPOINT_EVERY = 1; -export const MAIN_CHART_DATA_MAX = 400; +export const MAIN_CHART_DATAPOINT_LIMIT = 5000; +export const MAIN_CHART_DATAPOINT_EVERY = 5; +export const MAIN_CHART_DATA_MAX = 4000; export const PROBABILITY_THRESHOLD = 0.67; From 7582cda330f435a17b78444e66ecd5a8cbb505f6 Mon Sep 17 00:00:00 2001 From: Zygimantas <5236121+Zygimantass@users.noreply.github.com> Date: Tue, 9 Jan 2024 15:45:22 -0500 Subject: [PATCH 3/3] fix: max 4000 -> 10000 --- src/constants.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/constants.ts b/src/constants.ts index e8eed85..cb3de90 100644 --- a/src/constants.ts +++ b/src/constants.ts @@ -2,5 +2,5 @@ export const API_URL = process.env.NEXT_PUBLIC_API_URL || "https://dydx-mev-api-dev.skip.money"; export const MAIN_CHART_DATAPOINT_LIMIT = 5000; export const MAIN_CHART_DATAPOINT_EVERY = 5; -export const MAIN_CHART_DATA_MAX = 4000; +export const MAIN_CHART_DATA_MAX = 10000; export const PROBABILITY_THRESHOLD = 0.67;