Skip to content

Commit

Permalink
fix: create formatter once
Browse files Browse the repository at this point in the history
  • Loading branch information
frectonz committed Jun 17, 2024
1 parent 4df10ae commit 7eb274d
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions ui/src/routes/index.lazy.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,11 @@ type TheBarChartProps = {
}[];
};

const compactrer = Intl.NumberFormat("en-US", {
notation: "compact",
maximumFractionDigits: 1,
});

export function TheBarChart({ counts }: TheBarChartProps) {
return (
<ResponsiveContainer width="100%" height={350}>
Expand All @@ -190,12 +195,7 @@ export function TheBarChart({ counts }: TheBarChartProps) {
fontSize={12}
tickLine={false}
axisLine={false}
tickFormatter={(number) =>
Intl.NumberFormat("en-US", {
notation: "compact",
maximumFractionDigits: 1,
}).format(number)
}
tickFormatter={(number) => compactrer.format(number)}
/>
<Bar
dataKey="count"
Expand Down

0 comments on commit 7eb274d

Please sign in to comment.