Skip to content

Commit

Permalink
Update ShieldedPoolChart.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
zksquirrel authored Jul 31, 2024
1 parent 5008594 commit 8fd86b0
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/components/ShieldedPoolChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/**
Expand Down Expand Up @@ -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<ShieldedAmountDatum, Date>((d) => new Date(d.close ?? d.Date)).left;
const bisectDate = bisector<ShieldedAmountDatum, Date>((d) => new Date(d.Date)).left;

/**
* Default width for the chart. It will render 1000px wide, although if this
Expand Down

0 comments on commit 8fd86b0

Please sign in to comment.