diff --git a/components/account_page/AccountPerformancePerToken.tsx b/components/account_page/AccountPerformancePerToken.tsx index db2a558a..e583a401 100644 --- a/components/account_page/AccountPerformancePerToken.tsx +++ b/components/account_page/AccountPerformancePerToken.tsx @@ -181,6 +181,18 @@ const AccountPerformance = () => { } }) + // Normalise chart to start from 0 (except for account value) + if (parseInt(performanceRange) !== 90 && chartToShow !== 'account-value') { + const startValues = Object.assign({}, stats[0]); + for (let i = 0; i < stats.length; i++ ) { + for (const key in stats[i]) { + if (key !== 'time') { + stats[i][key] = stats[i][key] - startValues[key]; + } + } + } + } + setChartData(stats) setChartToShow(chartToShow) } @@ -342,7 +354,7 @@ const AccountPerformance = () => {

{`${t( `account-performance:${chartToShow}` - )} ${t('account-performance:vs-time')}`}

+ )}`}