Skip to content

Commit

Permalink
Update ShieldedPoolChart.tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
zksquirrel authored Aug 1, 2024
1 parent 005d417 commit f81512d
Showing 1 changed file with 6 additions and 8 deletions.
14 changes: 6 additions & 8 deletions src/components/ShieldedPoolChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { timeFormat } from '@visx/vendor/d3-time-format';

// Define types for data
type ShieldedAmountDatum = {
close: string;
supply: number;
Date: string;
Hashrate: string;
};
Expand Down Expand Up @@ -47,7 +45,7 @@ const tooltipStyles = {
const formatDate = timeFormat("%b %d, '%y");

// Function to extract Date from data
const getDate = (d: ShieldedAmountDatum): Date => new Date(d.close ?? d.Date);
const getDate = (d: ShieldedAmountDatum): Date => new Date(d.Date);

// Function to extract and convert hashrate value from data
const getShieldedValue = (d: ShieldedAmountDatum): number => {
Expand All @@ -56,7 +54,7 @@ const getShieldedValue = (d: ShieldedAmountDatum): number => {
};

// 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;

const DEFAULT_WIDTH = 1000;
const DEFAULT_HEIGHT = 500;
Expand Down Expand Up @@ -211,7 +209,7 @@ const ShieldedPoolChart = withTooltip<AreaProps & ShieldedPoolChartProps, Shield
stroke="url(#area-gradient)"
fill="url(#area-gradient)"
curve={curveMonotoneX}
aria-label="Area under line of the chart"
aria-label="Closed area showing shielded pool value over time"
/>
<Bar
x={margin.left}
Expand All @@ -224,7 +222,7 @@ const ShieldedPoolChart = withTooltip<AreaProps & ShieldedPoolChartProps, Shield
onTouchMove={handleTooltip}
onMouseMove={handleTooltip}
onMouseLeave={() => hideTooltip()}
aria-label="Shielded pooling over time"
aria-label="Hover overlay"
/>
{tooltipData && (
<g>
Expand All @@ -235,7 +233,7 @@ const ShieldedPoolChart = withTooltip<AreaProps & ShieldedPoolChartProps, Shield
strokeWidth={2}
pointerEvents="none"
strokeDasharray="5,2"
aria-label="Line for tooltip of mouse on x axis"
aria-label="Line showing x axis"
/>
<circle
cx={tooltipLeft}
Expand Down Expand Up @@ -270,7 +268,7 @@ const ShieldedPoolChart = withTooltip<AreaProps & ShieldedPoolChartProps, Shield
opacity={0.8}
aria-label="Watermark"
>
ZECHUB DASHBOARD
ZECHUB DASHBOARD
</text>
<image
x={width - 60}
Expand Down

0 comments on commit f81512d

Please sign in to comment.