Skip to content

Commit 176c94a

Browse files
committed
Fixed a bug: when no chip is selected it now shows empty
1 parent 4ee60de commit 176c94a

1 file changed

Lines changed: 18 additions & 15 deletions

File tree

src/app/component/circular-heatmap/circular-heatmap.component.ts

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ export class CircularHeatmapComponent implements OnInit {
224224

225225
// Update heatmap based on selection
226226
this.updateChips(true);
227-
this.reColorHeatmap();
228227
}
229228

230229
toggleTeamSelection(chip: MatChip) {
@@ -244,7 +243,6 @@ export class CircularHeatmapComponent implements OnInit {
244243
console.log('All chips', this.matChipsArray);
245244
// Update heatmap based on selection
246245
this.updateChips(prevSelectedChip);
247-
this.reColorHeatmap();
248246
}
249247

250248
ngAfterViewInit() {
@@ -253,6 +251,7 @@ export class CircularHeatmapComponent implements OnInit {
253251
setTimeout(() => {
254252
this.matChipsArray = this.chips.toArray();
255253
this.updateChips(true);
254+
this.reColorHeatmap();
256255
}, 100);
257256
}
258257
updateChips(fromTeamGroup: any) {
@@ -270,6 +269,7 @@ export class CircularHeatmapComponent implements OnInit {
270269
}
271270
}
272271
});
272+
this.reColorHeatmap();
273273
}
274274
// Team Filter ENDS
275275

@@ -687,6 +687,7 @@ export class CircularHeatmapComponent implements OnInit {
687687
link.remove();
688688
}
689689
reColorHeatmap() {
690+
console.log('recolor');
690691
for (var index = 0; index < this.ALL_CARD_DATA.length; index += 1) {
691692
let cntAll: number = 0;
692693
let cntTrue: number = 0;
@@ -709,20 +710,22 @@ export class CircularHeatmapComponent implements OnInit {
709710
}
710711
if (cntAll !== 0) {
711712
this.ALL_CARD_DATA[index]['Done%'] = cntTrue / cntAll;
712-
var color = d3
713-
.scaleLinear<string, string>()
714-
.domain([0, 1])
715-
.range(['white', 'green']);
716-
717-
d3.selectAll(
718-
'#segment-' +
719-
this.ALL_CARD_DATA[index]['SubDimension'].replace(/ /g, '-') +
720-
'-' +
721-
this.ALL_CARD_DATA[index]['Level'].replace(' ', '-')
722-
).attr('fill', function (p) {
723-
return color(_self.ALL_CARD_DATA[index]['Done%']);
724-
});
713+
} else {
714+
this.ALL_CARD_DATA[index]['Done%'] = 0;
725715
}
716+
var color = d3
717+
.scaleLinear<string, string>()
718+
.domain([0, 1])
719+
.range(['white', 'green']);
720+
721+
d3.selectAll(
722+
'#segment-' +
723+
this.ALL_CARD_DATA[index]['SubDimension'].replace(/ /g, '-') +
724+
'-' +
725+
this.ALL_CARD_DATA[index]['Level'].replace(' ', '-')
726+
).attr('fill', function (p) {
727+
return color(_self.ALL_CARD_DATA[index]['Done%']);
728+
});
726729
}
727730
// this.noTasktoGrey();
728731
}

0 commit comments

Comments
 (0)