Skip to content

Commit a854582

Browse files
committed
Heatmap: Display level and subdimension as title on hover
1 parent afd60f8 commit a854582

5 files changed

Lines changed: 82 additions & 17 deletions

File tree

src/app/app.component.css

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@
88
align-items: center;
99
}
1010
.tag-title {
11-
font-size: 1.2rem;
11+
font-size: 0.9em;
1212
}
1313
.tag-subtitle {
14-
font-size: 0.7rem;
14+
font-size: 0.7em;
1515
}
1616

1717
/* --- experimental branch end --- */

src/app/app.component.ts

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,22 @@
1-
import { Component, OnInit } from '@angular/core';
1+
import { Component, OnInit, OnDestroy } from '@angular/core';
2+
import { Subject, takeUntil } from 'rxjs';
23
import { ThemeService } from './service/theme.service';
4+
import { TitleService } from './service/title.service';
35

46
@Component({
57
selector: 'app-root',
68
templateUrl: './app.component.html',
79
styleUrls: ['./app.component.css'],
810
})
9-
export class AppComponent implements OnInit {
11+
export class AppComponent implements OnInit, OnDestroy {
1012
title = '';
1113
defaultTitle = 'DSOMM beta edition';
1214
subtitle = '';
1315
menuIsOpen: boolean = true;
1416

15-
constructor(private themeService: ThemeService) {
17+
private destroy$ = new Subject<void>();
18+
19+
constructor(private themeService: ThemeService, private titleService: TitleService) {
1620
this.themeService.initTheme();
1721
}
1822

@@ -23,6 +27,17 @@ export class AppComponent implements OnInit {
2327
this.menuIsOpen = false;
2428
}, 600);
2529
}
30+
31+
// Subscribe to title changes
32+
this.titleService.titleInfo$.pipe(takeUntil(this.destroy$)).subscribe(titleInfo => {
33+
this.title = titleInfo?.dimension || '';
34+
this.subtitle = titleInfo?.level ? 'Level ' + titleInfo?.level : '';
35+
});
36+
}
37+
38+
ngOnDestroy(): void {
39+
this.destroy$.next();
40+
this.destroy$.complete();
2641
}
2742

2843
toggleMenu(): void {

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ import { Sector } from 'src/app/model/sector';
2626
import { perfNow } from 'src/app/util/util';
2727
import { downloadYamlFile } from 'src/app/util/download';
2828
import { ThemeService } from '../../service/theme.service';
29+
import { TitleService } from '../../service/title.service';
2930
import { SettingsService } from 'src/app/service/settings/settings.service';
3031

3132
@Component({
@@ -65,6 +66,7 @@ export class CircularHeatmapComponent implements OnInit, OnDestroy {
6566
private sectorService: SectorService,
6667
private settings: SettingsService,
6768
private themeService: ThemeService,
69+
private titleService: TitleService,
6870
private router: Router,
6971
private route: ActivatedRoute,
7072
private location: Location,
@@ -149,6 +151,7 @@ export class CircularHeatmapComponent implements OnInit, OnDestroy {
149151
}
150152

151153
ngOnDestroy(): void {
154+
this.titleService.clearTitle();
152155
this.destroy$.next();
153156
this.destroy$.complete();
154157
}
@@ -358,12 +361,21 @@ export class CircularHeatmapComponent implements OnInit, OnDestroy {
358361
var index = parseInt(hoveredId.replace('index-', ''));
359362
if (dataset[index]?.activities?.length) {
360363
_self.setSectorCursor(svg, '#hover', hoveredId);
364+
// Update title with sector info
365+
const sector = dataset[index];
366+
_self.titleService.setTitle({
367+
level: sector.level,
368+
dimension: sector.dimension,
369+
subdimension: sector.subdimension,
370+
});
361371
} else {
362372
_self.setSectorCursor(svg, '#hover', '');
363373
}
364374
})
365375
.on('mouseout', function () {
366376
_self.setSectorCursor(svg, '#hover', '');
377+
// Clear title on mouseout
378+
_self.titleService.clearTitle();
367379
});
368380
}
369381

src/app/service/title.service.ts

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
import { Injectable } from '@angular/core';
2+
import { BehaviorSubject } from 'rxjs';
3+
4+
export interface TitleInfo {
5+
level?: number;
6+
dimension?: string;
7+
subdimension?: string;
8+
}
9+
10+
@Injectable({ providedIn: 'root' })
11+
export class TitleService {
12+
private titleSubject = new BehaviorSubject<TitleInfo | null>(null);
13+
public readonly titleInfo$ = this.titleSubject.asObservable();
14+
15+
constructor() {}
16+
17+
setTitle(titleInfo: TitleInfo | null): void {
18+
this.titleSubject.next(titleInfo);
19+
}
20+
21+
clearTitle(): void {
22+
this.titleSubject.next(null);
23+
}
24+
25+
formatTitle(titleInfo: TitleInfo | null, defaultTitle: string): string {
26+
if (!titleInfo) {
27+
return defaultTitle;
28+
}
29+
30+
let parts: string[] = [];
31+
32+
if (titleInfo.dimension) {
33+
parts.push(titleInfo.dimension);
34+
}
35+
36+
if (titleInfo.level !== undefined) {
37+
parts.push(`Level ${titleInfo.level}`);
38+
}
39+
40+
if (titleInfo.subdimension) {
41+
parts.push(titleInfo.subdimension);
42+
}
43+
44+
return parts.length > 0 ? parts.join(' - ') : defaultTitle;
45+
}
46+
}

src/assets/Markdown Files/TODO-v4.md

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@
99
- DSOMM: Read latest "activities.yaml" from DSOMM-data's github repo, to check for any new releases
1010

1111

12-
### Settings
13-
- Settings: Terms: Allow custom names for: team, group, etc
14-
1512
### Activity view
1613
- Activity: Shorten very long ISO references
1714
- Activity: Show Team Evidence from yaml file
@@ -43,7 +40,6 @@
4340
- Heatmap: Read previous local storage for backwards compatibility
4441
- Heatmap: Outer rim: Increase subdimension to be two lines (and increase size)
4542
- Heatmap: Outer rim: Make hover display Dimension (over subdimension)
46-
- Heatmap: Show a dimension label in title when hovering (especially for the up-side down dimension)
4743
### Activity view
4844
- Activity: Input Teams' evidence
4945
### Documentation
@@ -52,6 +48,9 @@
5248
- Doc: Update `About Us`
5349
- Doc: Update `Development.md`
5450
- Doc: Update `INSTALL.md`
51+
### Settings
52+
- Settings: Terms: Allow custom names for: 'Team' and 'Group' (e.g. to 'App' and 'Portfolio')
53+
5554
### Misc
5655
- Refactor ProgressDefinitions to MetaStore to get definitions for 0%, 100% etc
5756
- Move About Us, last, renaming to About DSOMM
@@ -60,24 +59,17 @@
6059
- Move META_FILE constant from data service to main app
6160
- Check if loader can be optimized by load in yaml in parallel
6261

63-
6462
# Later
6563
- App: Search activities, across title description etc
6664
- Export to Excel. Move from Mapping, to just progress data
6765
- Filter: Bug: SPACE key does not trigger
6866
- Heatmap, Card: Add Complete-symbol per activity
69-
- Heatmap: Update url on open details + read querystring on open
7067
- Heatmap: Add 'Not applicable' as a status for a team
71-
- Matrix: Brushup layout of details page
72-
- Matrix: Remember filters, when moving back from details
73-
- Matrix: Dependency graph: Make it clickable
7468
- Matrix: Go through tags: remove, add and rename
75-
- Misc: What is the activities.yaml comment field for? Should it be displayed to the user?
76-
- Teams: View active initiatives for a team (>0% and <100%)
7769
- Teams: View timeline for a team
78-
- Meta.yaml: Allow admins to customize the terms 'Team' and 'Group' (e.g. to 'App' and 'Portfolio')
7970

8071
# Done
72+
- Heatmap: Show a dimension label in title when hovering (especially for the up-side down dimension)
8173
- Settings: Proper text under Progress
8274
- Settings: Progress Definition: Make customizable stage: Name, Percentage, Definition (free text)
8375
- Settings: Make settings page

0 commit comments

Comments
 (0)