Skip to content

Commit 8ad5c9f

Browse files
committed
fix: format PNK value
1 parent 395c8d8 commit 8ad5c9f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

web/src/pages/Home/CourtOverview/BarChart.tsx

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@ import ChartDataLabels from "chartjs-plugin-datalabels";
55
import { Bar } from "react-chartjs-2";
66
import "chartjs-adapter-moment";
77

8+
const formatter = new Intl.NumberFormat("en", { notation: "compact" });
9+
810
const BarContainer = styled.div`
911
height: 220px;
1012
margin-top: 16px;
@@ -28,6 +30,9 @@ const BarChart: React.FC<IBarChartProps> = ({ chartData }) => {
2830
(value: number) => `${Math.floor((value * 100) / chartData.total)} %`,
2931
[chartData]
3032
);
33+
34+
const formatPNKValue = useCallback((value: number) => formatter.format(value), []);
35+
3136
const tickSize = 5; // suggested, if that many labels can't fit, chart will use even labels
3237

3338
const options = {
@@ -62,6 +67,7 @@ const BarChart: React.FC<IBarChartProps> = ({ chartData }) => {
6267
font: {
6368
weight: "bold",
6469
},
70+
formatter: formatPNKValue,
6571
},
6672
tooltip: {
6773
backgroundColor: theme.whiteBackground,

0 commit comments

Comments
 (0)