Skip to content

Commit

Permalink
Show percentage unit more clearly
Browse files Browse the repository at this point in the history
  • Loading branch information
jotjern committed Nov 6, 2024
1 parent f67526d commit 0d10863
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
5 changes: 5 additions & 0 deletions components/graphs/LineChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ const LineChart = ({ onlineFondet, osebx }: Props) => {
legend: {
position: 'top' as const,
},
tooltip: {
callbacks: {
label: (ctx) => `${Math.round(ctx.raw * 100) / 100}%`
}
},
},
scales: {
y: {
Expand Down
8 changes: 6 additions & 2 deletions components/graphs/PieChart.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ const PieChart = ({ composition }: Props) => {
labels: labels,
datasets: [
{
label: 'Prosent',
data: dataValues,
backgroundColor: [
'rgba(255, 99, 132, 0.6)',
Expand Down Expand Up @@ -56,7 +55,12 @@ const PieChart = ({ composition }: Props) => {
legend: {
position: 'top' as const,
},
},
tooltip: {
callbacks: {
label: (ctx) => `${Math.round(ctx.raw * 100) / 100}%`
}
},
}
};

return (
Expand Down

0 comments on commit 0d10863

Please sign in to comment.