File tree Expand file tree Collapse file tree 1 file changed +15
-5
lines changed
app/[locale]/[state]/analytics/components Expand file tree Collapse file tree 1 file changed +15
-5
lines changed Original file line number Diff line number Diff line change @@ -71,20 +71,29 @@ export const MapComponent = ({
7171 const max = Math . max ( ...values ) ;
7272 const step = ( max - min ) / 3 ;
7373 const grades = Array . from ( { length : 3 + 1 } , ( _ , i ) => min + step * i ) ;
74+
7475 for ( let i = 0 ; i < grades . length ; i ++ ) {
7576 const from = grades [ i ] ;
7677 const to = grades [ i + 1 ] ;
7778
79+ const formatValue = ( num : any ) => {
80+ if ( num < 1 ) {
81+ return num < 0.001 ? '0' : num . toFixed ( 3 ) ;
82+ }
83+ // return num > 1
84+ // ? Math.round(num).toString()
85+ // : formatNumberToIndianSystem(Math.round(num));
86+ return formatNumberToIndianSystem ( Math . round ( num ) ) ;
87+ } ;
88+
7889 const isDuplicate = customLegendData . some (
79- ( entry ) =>
80- formatNumberToIndianSystem ( Math . round ( from ) ) ===
81- entry . label . split ( ' ' ) [ 0 ]
90+ ( entry ) => formatValue ( from ) === entry . label . split ( ' ' ) [ 0 ]
8291 ) ;
8392
8493 if ( ! isDuplicate ) {
8594 customLegendData . push ( {
8695 color : colorScale ( from ) ,
87- label : `${ formatNumberToIndianSystem ( Math . round ( from ) ) } ${ to ? ` - ${ formatNumberToIndianSystem ( Math . round ( to ) ) } ` : '+' } ` ,
96+ label : `${ formatValue ( from ) } ${ to ? ` - ${ formatValue ( to ) } ` : '+' } ` ,
8897 } ) ;
8998 }
9099 }
@@ -240,7 +249,8 @@ export const MapComponent = ({
240249 map &&
241250 map ?. getContainer ( ) &&
242251 currentSelectedState . center &&
243- ! districtCode
252+ ! districtCode &&
253+ currentSelectedState . code !== '18'
244254 ) {
245255 map ?. setView ( currentSelectedState . center , 7.4 ) ;
246256 }
You can’t perform that action at this time.
0 commit comments