From 50800cc44f614c6cc2bc717adfa5ba1ce39c4b7f Mon Sep 17 00:00:00 2001 From: danilo neves cruz Date: Wed, 5 Jun 2024 19:50:05 -0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=92=84=20floating-chart:=20fit=20extreme?= =?UTF-8?q?=20utilizations?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- components/charts/UtilizationRateChart/index.tsx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/charts/UtilizationRateChart/index.tsx b/components/charts/UtilizationRateChart/index.tsx index ef80d51c7..6799abf91 100644 --- a/components/charts/UtilizationRateChart/index.tsx +++ b/components/charts/UtilizationRateChart/index.tsx @@ -24,13 +24,14 @@ const colorscale = [...Array(60)].map( `hsl(${360 * (1 - (i === length - 1 ? 1 : i / (length - 1)))} 100% 50%)`, ] satisfies [number, string], ); +const max = (a: bigint, b?: bigint) => (b == null || a > b ? a : b); function UtilizationRateChart({ type, symbol }: Props) { const { t } = useTranslation(); const { palette } = useTheme(); const globalUtilization = useGlobalUtilization(symbol); - const { data, loading } = useUtilizationRate(symbol, 0n, 95n * 10n ** 16n); + const { data, loading } = useUtilizationRate(symbol, 0n, max(95n * 10n ** 16n, globalUtilization)); const { borrowAPR } = useFloatingPoolAPR(symbol); const currentUtilization = useCurrentUtilizationRate('floating', symbol); const ref = useRef(null);