From 8fd86b0ece7f90a3df339889a4604cfdc42fb456 Mon Sep 17 00:00:00 2001 From: squirrel <47972284+zksquirrel@users.noreply.github.com> Date: Wed, 31 Jul 2024 21:26:00 +0100 Subject: [PATCH] Update ShieldedPoolChart.tsx --- src/components/ShieldedPoolChart.tsx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/components/ShieldedPoolChart.tsx b/src/components/ShieldedPoolChart.tsx index 5a5fcf7c..491178b5 100644 --- a/src/components/ShieldedPoolChart.tsx +++ b/src/components/ShieldedPoolChart.tsx @@ -16,15 +16,13 @@ import { timeFormat } from '@visx/vendor/d3-time-format'; * shielded at a given date. */ type ShieldedAmountDatum = { - close: string; - supply: number; - Date : string; - Hashrate : any + Date: string; + Hashrate: string; }; interface ShieldedPoolChartProps { dataUrl: string; - color : string; + color: string; } /** @@ -57,17 +55,19 @@ const formatDate = timeFormat("%b %d, '%y"); * @param d datum for measurement of shielded amount * @returns Date object */ -const getDate = (d: ShieldedAmountDatum): Date => new Date(d.close ?? d.Date); +const getDate = (d: ShieldedAmountDatum): Date => new Date(d.Date); /** * Returns the shielded amount from datum * @param d * @returns number */ -const getShieldedValue = (d: ShieldedAmountDatum): number => d.supply ?? d.Hashrate.replace(/,/g, '') / 100000000000000000000000000000000000; +const getShieldedValue = (d: ShieldedAmountDatum): number => { + return parseFloat(d.Hashrate.replace(/,/g, '')); +}; /** Bisector for date */ -const bisectDate = bisector((d) => new Date(d.close ?? d.Date)).left; +const bisectDate = bisector((d) => new Date(d.Date)).left; /** * Default width for the chart. It will render 1000px wide, although if this