File tree Expand file tree Collapse file tree 1 file changed +6
-0
lines changed
web/src/pages/Home/CourtOverview Expand file tree Collapse file tree 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";
55import { Bar } from "react-chartjs-2" ;
66import "chartjs-adapter-moment" ;
77
8+ const formatter = new Intl . NumberFormat ( "en" , { notation : "compact" } ) ;
9+
810const 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 ,
You can’t perform that action at this time.
0 commit comments