@@ -131,18 +131,21 @@ export const createEffectifsSpecifiquesChartOptions = (
131131 {
132132 name : "Formations d'IUT" ,
133133 y : data . effectif_sans_cpge_iut || 0 ,
134+ percentage : data . part_effectif_sans_cpge_iut || 0 ,
134135 has : data . has_effectif_iut ,
135136 color : getCssColor ( "scale-1" ) ,
136137 } ,
137138 {
138139 name : "Formations d'ingénieurs" ,
139140 y : data . effectif_sans_cpge_ing || 0 ,
141+ percentage : data . part_effectif_sans_cpge_ing || 0 ,
140142 has : data . has_effectif_ing ,
141143 color : getCssColor ( "scale-2" ) ,
142144 } ,
143145 {
144146 name : "Formation de santé" ,
145147 y : data . effectif_sans_cpge_sante || 0 ,
148+ percentage : data . part_effectif_sans_cpge_sante || 0 ,
146149 has : data . has_effectif_sante ,
147150 color : getCssColor ( "scale-3" ) ,
148151 } ,
@@ -153,6 +156,7 @@ export const createEffectifsSpecifiquesChartOptions = (
153156 y : item . y ,
154157 color : item . color ,
155158 name : item . name ,
159+ percentage : item . percentage ,
156160 } ) ) ;
157161
158162 return createChartOptions ( "column" , {
@@ -175,7 +179,7 @@ export const createEffectifsSpecifiquesChartOptions = (
175179 tooltip : {
176180 formatter : function ( ) {
177181 const point = this as any ;
178- return `<strong>${ point . name } </strong><br/>${ Highcharts . numberFormat ( point . y , 0 , "," , " " ) } étudiants` ;
182+ return `<strong>${ point . name } </strong><br/>${ Highcharts . numberFormat ( point . y , 0 , "," , " " ) } étudiants<br/> ${ point . percentage . toFixed ( 1 ) } % du total ` ;
179183 } ,
180184 } ,
181185 plotOptions : {
@@ -358,11 +362,14 @@ export const createEffectifsDegreesChartOptions = (
358362 } ,
359363 ] . filter ( ( item ) => item . y > 0 ) ;
360364
365+ const total = degrees . reduce ( ( sum , item ) => sum + item . y , 0 ) ;
366+
361367 const categories = degrees . map ( ( item ) => item . name ) ;
362368 const values = degrees . map ( ( item ) => ( {
363369 y : item . y ,
364370 color : item . color ,
365371 name : item . name ,
372+ percentage : total > 0 ? ( item . y / total ) * 100 : 0 ,
366373 } ) ) ;
367374
368375 return createChartOptions ( "column" , {
@@ -391,7 +398,7 @@ export const createEffectifsDegreesChartOptions = (
391398 tooltip : {
392399 formatter : function ( ) {
393400 const point = this as any ;
394- return `<strong>${ point . name } </strong><br/>${ Highcharts . numberFormat ( point . y , 0 , "," , " " ) } étudiants` ;
401+ return `<strong>${ point . name } </strong><br/>${ Highcharts . numberFormat ( point . y , 0 , "," , " " ) } étudiants<br/> ${ point . percentage . toFixed ( 1 ) } % du total ` ;
395402 } ,
396403 } ,
397404 plotOptions : {
0 commit comments