Skip to content

Commit 9f9f80e

Browse files
committed
Add correct tooltip to account detail page.
1 parent aa14b70 commit 9f9f80e

File tree

2 files changed

+16
-3
lines changed

2 files changed

+16
-3
lines changed

src/components/dashboard/balance-chart.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ const BalanceChart = ({ range } : { range: DateRange }) => {
4646
tooltip: {
4747
callbacks: {
4848
title: (context: any) => {
49-
console.log(context)
5049
return context[0].dataset.label + ': ' + new Intl.DateTimeFormat(localStorage.getItem('language') || 'en')
5150
.format(context[0].parsed.x)
5251
},

src/components/graphs/balance-chart.tsx

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,30 @@ const BalanceChart: FC<BalanceChartProps> = ({ id, allMoney, accounts, height =
4747
<Chart height={ height }
4848
type={ 'line' }
4949
id={ id }
50-
options={ Service.mergeOptions({
50+
options={ Service.mergeOptions(DefaultChartConfig.line,{
5151
scales: {
5252
y: {
5353
ticks: {
5454
callback: (value: any) => `${currencySymbol}${value}`
5555
}
5656
}
57+
},
58+
plugins: {
59+
tooltip: {
60+
callbacks: {
61+
title: (context: any) => {
62+
return context[0].dataset.label + ': ' + new Intl.DateTimeFormat(localStorage.getItem('language') || 'en')
63+
.format(context[0].parsed.x)
64+
},
65+
label: (context: any) => {
66+
const value = context.parsed.y.toFixed(2)
67+
return `${ (RestAPI.user() as any).defaultCurrency?.symbol }${ value }`
68+
}
69+
}
70+
}
5771
}
5872

59-
}, DefaultChartConfig.line) }
73+
}) }
6074
data={ balanceSeries } />
6175
</>
6276
}

0 commit comments

Comments
 (0)