@@ -3,8 +3,8 @@ import { ymlService } from '../../service/yaml-parser/yaml-parser.service';
33import * as d3 from 'd3' ;
44
55export interface taskSchema {
6- name :string
7- done :boolean
6+ taskName :string
7+ ifTaskDone :boolean
88}
99
1010export interface cardSchema {
@@ -20,12 +20,12 @@ export interface cardSchema{
2020 styleUrls : [ './circular-heatmap.component.css' ]
2121} )
2222export class CircularHeatmapComponent implements OnInit {
23- maxLevel :number = - 1
24- show :boolean = false
25- header :string = ''
26- subheader :string = ''
27- tasks :any [ ] = [ ]
28- data :cardSchema [ ] = [ ] ;
23+ maxLevelOfTasks :number = - 1
24+ showTaskCard :boolean = false
25+ taskHeader :string = ''
26+ taskSubheader :string = ''
27+ tasksData :any [ ] = [ ]
28+ ALL_CARD_DATA :cardSchema [ ] = [ ] ;
2929 radial_labels :string [ ] = [ ] ;
3030 YamlObject :any ;
3131 segment_labels :string [ ] = [ ] ;
@@ -41,7 +41,7 @@ export class CircularHeatmapComponent implements OnInit {
4141 for ( let x in this . YamlObject [ 'strings' ] [ 'en' ] [ 'maturity_levels' ] ) {
4242 var y = parseInt ( x ) + 1
4343 this . radial_labels . push ( 'Level ' + y )
44- this . maxLevel = y
44+ this . maxLevelOfTasks = y
4545 }
4646
4747 } ) ;
@@ -55,7 +55,7 @@ export class CircularHeatmapComponent implements OnInit {
5555 for ( var x in this . YamlObject [ 'dimension' ] ) {
5656 this . segment_labels . push ( this . YamlObject [ 'dimension' ] [ x ] [ 'subdimension' ] [ 'name' ] )
5757 }
58- for ( var l = 0 ; l < this . maxLevel ; l ++ ) {
58+ for ( var l = 0 ; l < this . maxLevelOfTasks ; l ++ ) {
5959 for ( var x in this . YamlObject [ 'dimension' ] ) {
6060 var tempdata :cardSchema = {
6161 "Name" : "" ,
@@ -73,53 +73,53 @@ export class CircularHeatmapComponent implements OnInit {
7373 if ( Status ) {
7474 totalImplemented += 1
7575 }
76- tempdata [ "Task" ] . push ( { "name " :nameOfTask , "done " :Status } )
76+ tempdata [ "Task" ] . push ( { "taskName " :nameOfTask , "ifTaskDone " :Status } )
7777 }
7878 tempdata [ "Done%" ] = totalImplemented / this . YamlObject [ 'dimension' ] [ x ] [ 'subdimension' ] [ 'level-' + ( l + 1 ) ] . length
7979 }
8080 catch {
8181 tempdata [ "Done%" ] = - 1
8282 }
83- this . data . push ( tempdata )
83+ this . ALL_CARD_DATA . push ( tempdata )
8484 }
8585 }
86- console . log ( this . data )
87- this . loadCircularHeatMap ( this . data , "#chart" , this . radial_labels , this . segment_labels ) ;
86+ console . log ( this . ALL_CARD_DATA )
87+ this . loadCircularHeatMap ( this . ALL_CARD_DATA , "#chart" , this . radial_labels , this . segment_labels ) ;
8888 this . noTasktoGrey ( )
8989 } )
9090 }
9191
92- checkboxToggle ( taskIndex :number ) {
92+ toggleCheckbox ( taskIndex :number ) {
9393 //console.log('fo')
9494 let _self = this
9595 var index = 0 ;
9696 var cnt = 0 ;
97- for ( var i = 0 ; i < this . data . length ; i ++ ) {
98- if ( this . data [ i ] [ "Name" ] === this . header && this . data [ i ] [ "Level" ] === this . subheader ) {
97+ for ( var i = 0 ; i < this . ALL_CARD_DATA . length ; i ++ ) {
98+ if ( this . ALL_CARD_DATA [ i ] [ "Name" ] === this . taskHeader && this . ALL_CARD_DATA [ i ] [ "Level" ] === this . taskSubheader ) {
9999 index = i
100100 break ;
101101 }
102102 }
103- if ( this . data [ index ] [ "Task" ] [ taskIndex ] [ "done " ] ) {
104- this . data [ index ] [ "Task" ] [ taskIndex ] [ "done " ] = false
103+ if ( this . ALL_CARD_DATA [ index ] [ "Task" ] [ taskIndex ] [ "ifTaskDone " ] ) {
104+ this . ALL_CARD_DATA [ index ] [ "Task" ] [ taskIndex ] [ "ifTaskDone " ] = false
105105 }
106106 else {
107- this . data [ index ] [ "Task" ] [ taskIndex ] [ "done " ] = true
107+ this . ALL_CARD_DATA [ index ] [ "Task" ] [ taskIndex ] [ "ifTaskDone " ] = true
108108 }
109109 //console.log(this.data[i]["Task"][taskIndex]["done"])
110- for ( var i = 0 ; i < this . data [ index ] [ "Task" ] . length ; i ++ ) {
111- console . log ( this . data [ index ] [ "Task" ] [ i ] [ "done " ] )
112- if ( this . data [ index ] [ "Task" ] [ i ] [ "done " ] ) {
110+ for ( var i = 0 ; i < this . ALL_CARD_DATA [ index ] [ "Task" ] . length ; i ++ ) {
111+ console . log ( this . ALL_CARD_DATA [ index ] [ "Task" ] [ i ] [ "ifTaskDone " ] )
112+ if ( this . ALL_CARD_DATA [ index ] [ "Task" ] [ i ] [ "ifTaskDone " ] ) {
113113 cnt += 1
114114 }
115115 }
116- this . data [ index ] [ 'Done%' ] = cnt / this . data [ index ] [ "Task" ] . length
116+ this . ALL_CARD_DATA [ index ] [ 'Done%' ] = cnt / this . ALL_CARD_DATA [ index ] [ "Task" ] . length
117117 //console.log(this.data[index]['Done%'],cnt)
118118 var color = d3 . scaleLinear < string , string > ( ) . domain ( [ 0 , 1 ] ) . range ( [ "white" , "green" ] ) ;
119119
120- this . loadCircularHeatMap ( this . data , "#chart" , this . radial_labels , this . segment_labels ) ;
121- d3 . selectAll ( "#segment-" + this . data [ index ] [ "Name" ] + '-' + this . data [ index ] [ "Level" ] . replace ( ' ' , '-' ) ) . attr ( "fill" , function ( p ) {
122- return color ( _self . data [ index ] [ "Done%" ] )
120+ this . loadCircularHeatMap ( this . ALL_CARD_DATA , "#chart" , this . radial_labels , this . segment_labels ) ;
121+ d3 . selectAll ( "#segment-" + this . ALL_CARD_DATA [ index ] [ "Name" ] + '-' + this . ALL_CARD_DATA [ index ] [ "Level" ] . replace ( ' ' , '-' ) ) . attr ( "fill" , function ( p ) {
122+ return color ( _self . ALL_CARD_DATA [ index ] [ "Done%" ] )
123123 } ) ;
124124
125125 }
@@ -177,11 +177,11 @@ export class CircularHeatmapComponent implements OnInit {
177177
178178 svg . selectAll ( "path" )
179179 . on ( 'click' , function ( d ) {
180- _self . subheader = d . explicitOriginalTarget . __data__ . Level
181- _self . tasks = d . explicitOriginalTarget . __data__ . Task ;
182- _self . header = d . explicitOriginalTarget . __data__ . Name
183- _self . show = true
184- console . log ( _self . tasks )
180+ _self . taskSubheader = d . explicitOriginalTarget . __data__ . Level
181+ _self . tasksData = d . explicitOriginalTarget . __data__ . Task ;
182+ _self . taskHeader = d . explicitOriginalTarget . __data__ . Name
183+ _self . showTaskCard = true
184+ console . log ( _self . tasksData )
185185 } )
186186 . on ( 'mouseover' , function ( d ) {
187187
@@ -384,9 +384,9 @@ export class CircularHeatmapComponent implements OnInit {
384384 }
385385
386386 noTasktoGrey ( ) :void {
387- for ( var x in this . data ) {
388- if ( this . data [ x ] [ "Done%" ] == - 1 ) {
389- d3 . selectAll ( "#segment-" + this . data [ x ] [ "Name" ] + '-' + this . data [ x ] [ "Level" ] . replace ( ' ' , '-' ) ) . attr ( "fill" , "#DCDCDC" ) ;
387+ for ( var x in this . ALL_CARD_DATA ) {
388+ if ( this . ALL_CARD_DATA [ x ] [ "Done%" ] == - 1 ) {
389+ d3 . selectAll ( "#segment-" + this . ALL_CARD_DATA [ x ] [ "Name" ] + '-' + this . ALL_CARD_DATA [ x ] [ "Level" ] . replace ( ' ' , '-' ) ) . attr ( "fill" , "#DCDCDC" ) ;
390390 }
391391 }
392392 }
0 commit comments