Skip to content

Commit

Permalink
fix: tooltip formats as scale specifies on init
Browse files Browse the repository at this point in the history
  • Loading branch information
gregdan3 committed Aug 28, 2024
1 parent da627fb commit 1971992
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions src/utils/chart.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,11 +152,8 @@ async function initUsageChart(
return b.raw.occurrences - a.raw.occurrences;
},
callbacks: {
label: (ctx: TooltipItem<keyof ChartTypeRegistry>) => {
// @ts-expect-error: it doesn't know about `raw`
const occurrences = roundForGraph(ctx.raw.occurrences);
return `${ctx.dataset.label}: ${occurrences}`;
},
label: (ctx: TooltipItem<keyof ChartTypeRegistry>) =>
formatLabel(ctx, FORMATTERS[scale.tooltipNums]),
},
},
},
Expand Down

0 comments on commit 1971992

Please sign in to comment.