From 5b4b30df0a2af67e0df1181eab85c06d36da961b Mon Sep 17 00:00:00 2001 From: saml33 Date: Wed, 24 May 2023 10:07:29 +1000 Subject: [PATCH] remove time from daily average tooltip --- components/shared/DetailedAreaOrBarChart.tsx | 14 ++++++++++++-- components/stats/AverageFundingChart.tsx | 1 + 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/components/shared/DetailedAreaOrBarChart.tsx b/components/shared/DetailedAreaOrBarChart.tsx index b537e150..2e271f1a 100644 --- a/components/shared/DetailedAreaOrBarChart.tsx +++ b/components/shared/DetailedAreaOrBarChart.tsx @@ -58,6 +58,7 @@ interface DetailedAreaOrBarChartProps { yDecimals?: number yKey: string showZeroLine?: boolean + tooltipDateFormat?: string } export const formatDateAxis = (date: string, days: number) => { @@ -92,6 +93,7 @@ const DetailedAreaOrBarChart: FunctionComponent< yDecimals, yKey, showZeroLine, + tooltipDateFormat, }) => { const { t } = useTranslation('common') const [mouseData, setMouseData] = useState(null) @@ -244,7 +246,11 @@ const DetailedAreaOrBarChart: FunctionComponent< small ? 'text-xs' : 'text-sm' } text-th-fgd-4`} > - {dayjs(mouseData[xKey]).format('DD MMM YY, h:mma')} + {dayjs(mouseData[xKey]).format( + tooltipDateFormat + ? tooltipDateFormat + : 'DD MMM YY, h:mma' + )}

) : ( @@ -303,7 +309,11 @@ const DetailedAreaOrBarChart: FunctionComponent< > {dayjs( filteredData[filteredData.length - 1][xKey] - ).format('DD MMM YY, h:mma')} + ).format( + tooltipDateFormat + ? tooltipDateFormat + : 'DD MMM YY, h:mma' + )}

)} diff --git a/components/stats/AverageFundingChart.tsx b/components/stats/AverageFundingChart.tsx index 49e71de1..8d311d30 100644 --- a/components/stats/AverageFundingChart.tsx +++ b/components/stats/AverageFundingChart.tsx @@ -77,6 +77,7 @@ const AverageFundingChart = ({ yKey="funding_rate_hourly" yDecimals={5} chartType="bar" + tooltipDateFormat={daysToShow === '30' ? 'DD MMM YY' : ''} /> ) }