File tree 1 file changed +6
-0
lines changed
web/src/pages/Home/CourtOverview
1 file changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,8 @@ import ChartDataLabels from "chartjs-plugin-datalabels";
5
5
import { Bar } from "react-chartjs-2" ;
6
6
import "chartjs-adapter-moment" ;
7
7
8
+ const formatter = new Intl . NumberFormat ( "en" , { notation : "compact" } ) ;
9
+
8
10
const BarContainer = styled . div `
9
11
height: 220px;
10
12
margin-top: 16px;
@@ -28,6 +30,9 @@ const BarChart: React.FC<IBarChartProps> = ({ chartData }) => {
28
30
( value : number ) => `${ Math . floor ( ( value * 100 ) / chartData . total ) } %` ,
29
31
[ chartData ]
30
32
) ;
33
+
34
+ const formatPNKValue = useCallback ( ( value : number ) => formatter . format ( value ) , [ ] ) ;
35
+
31
36
const tickSize = 5 ; // suggested, if that many labels can't fit, chart will use even labels
32
37
33
38
const options = {
@@ -62,6 +67,7 @@ const BarChart: React.FC<IBarChartProps> = ({ chartData }) => {
62
67
font : {
63
68
weight : "bold" ,
64
69
} ,
70
+ formatter : formatPNKValue ,
65
71
} ,
66
72
tooltip : {
67
73
backgroundColor : theme . whiteBackground ,
You can’t perform that action at this time.
0 commit comments