remove time from daily average tooltip

This commit is contained in:
saml33 2023-05-24 10:07:29 +10:00
parent b708d838d7
commit 5b4b30df0a
2 changed files with 13 additions and 2 deletions

View File

@ -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<any>(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'
)}
</p>
</div>
) : (
@ -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'
)}
</p>
</div>
)}

View File

@ -77,6 +77,7 @@ const AverageFundingChart = ({
yKey="funding_rate_hourly"
yDecimals={5}
chartType="bar"
tooltipDateFormat={daysToShow === '30' ? 'DD MMM YY' : ''}
/>
)
}