@@ -125,6 +125,7 @@ export class CircularHeatmapComponent implements OnInit {
125125
126126 checkboxToggle ( taskIndex :number ) {
127127 //console.log('fo')
128+ let _self = this
128129 var index = 0 ;
129130 var cnt = 0 ;
130131 for ( var i = 0 ; i < this . data . length ; i ++ ) {
@@ -148,7 +149,12 @@ export class CircularHeatmapComponent implements OnInit {
148149 }
149150 this . data [ index ] [ 'Done%' ] = cnt / this . data [ index ] [ "Task" ] . length
150151 //console.log(this.data[index]['Done%'],cnt)
152+ var color = d3 . scaleLinear < string , string > ( ) . domain ( [ 0 , 1 ] ) . range ( [ "white" , "green" ] ) ;
153+
151154 this . loadCircularHeatMap ( this . data , "#chart" , this . radial_labels , this . segment_labels ) ;
155+ d3 . selectAll ( "#segment-" + this . data [ index ] [ "Name" ] + '-' + this . data [ index ] [ "Level" ] . replaceAll ( ' ' , '-' ) ) . attr ( "fill" , function ( p ) {
156+ return color ( _self . data [ index ] [ "Done%" ] )
157+ } ) ;
152158
153159 }
154160
@@ -223,9 +229,7 @@ export class CircularHeatmapComponent implements OnInit {
223229 } ) ;
224230
225231 } )
226- . on ( 'mousemove' , function ( d , event ) {
227-
228- } )
232+
229233 . on ( 'mouseout' , function ( d ) {
230234 //console.log(d.explicitOriginalTarget.__data__.Day)
231235
@@ -236,16 +240,12 @@ export class CircularHeatmapComponent implements OnInit {
236240 // segment.style("fill", fillcolor);
237241
238242 d3 . selectAll ( "#segment-" + curr . Name + '-' + curr . Level . replaceAll ( ' ' , '-' ) ) . attr ( "fill" , function ( p ) {
239- return d . target . textContent
243+ var color = d3 . scaleLinear < string , string > ( ) . domain ( [ 0 , 1 ] ) . range ( [ "white" , "green" ] ) ;
244+ // how to access a function within reusable charts
245+ //console.log(color(d.Done));
246+ return color ( curr [ "Done%" ] ) ;
240247 } ) ;
241248 } )
242- . append ( "desc" ) //append the current color as a desc element
243- . text ( function ( d :any ) {
244- var color = d3 . scaleLinear < string , string > ( ) . domain ( [ 0 , 1 ] ) . range ( [ "white" , "green" ] ) ;
245- // how to access a function within reusable charts
246- console . log ( color ( d . Done ) ) ;
247- return color ( d [ "Done%" ] ) ;
248- } ) ;
249249 }
250250
251251 circularHeatChart ( num_of_segments :number ) {
0 commit comments