Skip to content

Commit b0f7b78

Browse files
committed
Heatmap: Added debug statements for coloring the heatmap
1 parent dc2def1 commit b0f7b78

1 file changed

Lines changed: 14 additions & 9 deletions

File tree

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

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,7 @@ export class CircularHeatmapComponent implements OnInit, OnDestroy {
137137
});
138138
// Reactively handle theme changes (if user toggles later)
139139
this.themeService.theme$.pipe(takeUntil(this.destroy$)).subscribe((theme: string) => {
140+
console.log('Theme changed to:', theme);
140141
const css = getComputedStyle(document.body);
141142
this.theme_colors = {
142143
background: css.getPropertyValue('--heatmap-background').trim(),
@@ -146,7 +147,8 @@ export class CircularHeatmapComponent implements OnInit, OnDestroy {
146147
stroke: css.getPropertyValue('--heatmap-stroke').trim(),
147148
};
148149

149-
this.reColorHeatmap(); // repaint segments with new theme
150+
// Repaint segments with new theme
151+
this.reColorHeatmap();
150152
});
151153
}
152154

@@ -320,6 +322,8 @@ export class CircularHeatmapComponent implements OnInit, OnDestroy {
320322
.segmentLabelHeight(segmentLabelHeight);
321323

322324
chart.accessor(function (sector: Sector) {
325+
let progressValue: number = _self.getSectorProgress(sector);
326+
if (progressValue) console.debug(`${perfNow()}s: Initial sector value ${progressValue.toFixed(2)} - '${sector.dimension}' Level ${sector.level}`); // eslint-disable-line
323327
return _self.getSectorProgress(sector);
324328
});
325329

@@ -666,25 +670,26 @@ export class CircularHeatmapComponent implements OnInit, OnDestroy {
666670
this.showFilters = !this.showFilters;
667671
}
668672

673+
reColorHeatmap() {
674+
console.debug(`${perfNow()}s: Recoloring heatmap of ${this.allSectors.length} sectors`);
675+
for (let index = 0; index < this.allSectors.length; index++) {
676+
this.recolorSector(index);
677+
}
678+
}
679+
669680
recolorSector(index: number) {
670-
// console.log('recolorSector', index);
671681
var colorSector = d3
672682
.scaleLinear<string, string>()
673683
.domain([0, 1])
674684
.range([this.theme_colors['background'], this.theme_colors['filled']]);
675685

676686
let progressValue: number = this.getSectorProgress(this.allSectors[index]);
687+
if (progressValue) console.debug(`${perfNow()}s: recolorSector #${index} sector: ${progressValue.toFixed(2)} (${this.theme_colors['filled']})`); // eslint-disable-line
688+
677689
d3.select('#index-' + index).attr(
678690
'fill',
679691
isNaN(progressValue) ? this.theme_colors['disabled'] : colorSector(progressValue)
680692
);
681-
// console.log(`Recolor sector ${index} with progress ${(progressValue*100).toFixed(1)}%`);
682-
}
683-
684-
reColorHeatmap() {
685-
for (let index = 0; index < this.allSectors.length; index++) {
686-
this.recolorSector(index);
687-
}
688693
}
689694

690695
exportTeamProgress() {

0 commit comments

Comments
 (0)