@@ -21,6 +21,8 @@ import LanguagePeopleGroupDisability from '#components/LanguagePeopleGroupDisabi
2121
2222import { transformSoi } from '#utils/transform' ;
2323
24+ import DonutChartRecharts from '../../CommonCharts/DonutChart' ;
25+
2426import styles from './styles.scss' ;
2527
2628const propTypes = {
@@ -40,6 +42,8 @@ const defaultProps = {
4042const droppedKey = 'total_no_of_rc_records_dropped_during_the_month' ;
4143const rcAwayKey = 'total_rc_temporarily_away' ;
4244
45+ const donutChartHeight = 120 ;
46+
4347const ageKeyMap = {
4448 '<=6' : '0 - 6' ,
4549 '7-12' : '7 - 12' ,
@@ -70,6 +74,7 @@ const legendColorSelector = d => d.color;
7074
7175const donutColor = [ '#41cf76' , '#f44336' ] ;
7276const soiColorScheme = [ '#ef5350' , '#fff176' , '#81c784' ] ;
77+
7378const sectionPercents = [ 0.75 , 0.1 , 0.15 ] ;
7479
7580const getPercent = ( data ) => {
@@ -352,7 +357,7 @@ export default class Summary extends PureComponent {
352357 } ;
353358
354359 const primaryUneducated = {
355- key : 'PrimaryEducated ' ,
360+ key : 'PrimaryUneducated ' ,
356361 value : this . getValueFromMap ( educationMap , '@PrimarySchoolAgeNoEducation' ) || 0 ,
357362 label : 'Primary School Age RC Not Involved in Education' ,
358363 } ;
@@ -383,7 +388,7 @@ export default class Summary extends PureComponent {
383388
384389 const educated = education . filter ( values => (
385390 values . key === 'PrimaryEducated'
386- || values . key === 'SecondaryEducated'
391+ || values . key === 'SecondaryEducated'
387392 ) ) . reduce ( ( a , b ) => ( { ...a , value : a . value + b . value } ) , {
388393 value : 0 ,
389394 key : 'educated' ,
@@ -392,7 +397,7 @@ export default class Summary extends PureComponent {
392397
393398 const uneducated = education . filter ( values => (
394399 values . key === '@SecondarySchoolAgeNoEducation'
395- || values . key === '@PrimarySchoolAgeNoEducation'
400+ || values . key === '@PrimarySchoolAgeNoEducation'
396401 ) ) . reduce ( ( a , b ) => ( { ...a , value : a . value + b . value } ) , {
397402 value : 0 ,
398403 key : 'uneducated' ,
@@ -423,6 +428,18 @@ export default class Summary extends PureComponent {
423428 return getAgeDistribution ( male [ 0 ] ) ;
424429 } ) ;
425430
431+ getDonutDataWithName = memoize ( ( donutData ) => {
432+ if ( isFalsy ( donutData ) ) {
433+ return [ ] ;
434+ }
435+
436+ const dataWithName = donutData . map ( data => ( {
437+ ...data ,
438+ name : data . label ,
439+ } ) ) ;
440+ return dataWithName ;
441+ } ) ;
442+
426443 render ( ) {
427444 const {
428445 className,
@@ -462,6 +479,10 @@ export default class Summary extends PureComponent {
462479 const maleRCAgeDistribution = this . getMaleRcAge ( registerChildByAgeAndGender ) ;
463480 const rcData = this . getRcData ( rc , presenceAndParticipation ) ;
464481
482+ const healthNutritionWithName = this . getDonutDataWithName ( healthNutrition ) ;
483+ const educationInvolvementWithName = this . getDonutDataWithName ( educationInvolvement ) ;
484+ const childMonitoringVizDataWithName = this . getDonutDataWithName ( childMonitoringVizData ) ;
485+
465486 const infoText = `The data below is
466487 aggregated from sponsorship
467488 management report from ${ noOfProjects }
@@ -497,7 +518,14 @@ export default class Summary extends PureComponent {
497518 < div className = { styles . item } >
498519 < h3 > Health / Nutrition</ h3 >
499520 < div className = { styles . itemTableViz } >
500- < DonutChart
521+ < DonutChartRecharts
522+ donutChartHeight = { donutChartHeight }
523+ data = { healthNutritionWithName }
524+ colorScheme = { donutColor }
525+ className = { styles . viz }
526+ donutChartWidth = "50%"
527+ />
528+ { /* <DonutChart
501529 className={styles.viz}
502530 data={healthNutrition}
503531 sideLengthRatio={0.2}
@@ -506,7 +534,7 @@ export default class Summary extends PureComponent {
506534 labelSelector={Summary.labelSelector}
507535 labelModifier={Summary.labelModifierSelector}
508536 colorScheme={donutColor}
509- />
537+ /> */ }
510538 < ListView
511539 className = { styles . table }
512540 data = { percentHealth }
@@ -519,7 +547,13 @@ export default class Summary extends PureComponent {
519547 < div className = { styles . item } >
520548 < h3 > Education</ h3 >
521549 < div className = { styles . itemTableViz } >
522- < DonutChart
550+ < DonutChartRecharts
551+ donutChartHeight = { donutChartHeight }
552+ data = { educationInvolvementWithName }
553+ colorScheme = { donutColor }
554+ donutChartWidth = "50%"
555+ />
556+ { /* <DonutChart
523557 className={styles.viz}
524558 data={educationInvolvement}
525559 sideLengthRatio={0.2}
@@ -528,20 +562,31 @@ export default class Summary extends PureComponent {
528562 labelSelector={Summary.labelSelector}
529563 labelModifier={Summary.labelModifierSelector}
530564 colorScheme={donutColor}
531- />
565+ /> */ }
532566 < ListView
533567 className = { styles . table }
534568 data = { educationValues }
535569 rendererParams = { this . tableParams }
536570 keySelector = { Summary . tableKeySelector }
537571 renderer = { KeyValue }
538572 />
573+
539574 </ div >
540575 </ div >
541576 < div className = { styles . item } >
542577 < h3 > Child Monitoring Status</ h3 >
543578 < div className = { styles . itemTableViz } >
544- < DonutChart
579+ < DonutChartRecharts
580+ donutChartHeight = { donutChartHeight }
581+ data = { childMonitoringVizDataWithName }
582+ colorScheme = { [
583+ '#41cf76' ,
584+ '#ef8c00' ,
585+ '#f44336' ,
586+ ] }
587+ donutChartWidth = "50%"
588+ />
589+ { /* <DonutChart
545590 className={styles.viz}
546591 data={childMonitoringVizData}
547592 hideLabel
@@ -554,7 +599,7 @@ export default class Summary extends PureComponent {
554599 '#ef8c00',
555600 '#f44336',
556601 ]}
557- />
602+ /> */ }
558603 < ListView
559604 className = { styles . table }
560605 data = { percentChild }
0 commit comments