Skip to content

Commit b84f0f4

Browse files
committed
adding ~All~ value and single select functionality
1 parent 7c9291f commit b84f0f4

3 files changed

Lines changed: 74 additions & 65 deletions

File tree

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

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
font-weight: 700;
1717
}
1818

19-
.example-card {
19+
.right-panel {
2020
float: right;
2121
width: 25%;
2222
margin: 5%;
@@ -74,13 +74,10 @@
7474
margin: 0;
7575
padding: 0 1em;
7676
}
77-
.team-filter {
78-
/* padding: 1em; */
77+
/* .team-filter {
7978
padding: 0;
80-
/* margin: 0 2em; */
8179
width: 60%;
82-
/* position: absolute; */
83-
}
80+
} */
8481
.team-filter > .mat-form-field {
8582
display: block;
8683
}

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

Lines changed: 55 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -186,54 +186,62 @@ <h2>Nothing to show</h2>
186186
</ng-template>
187187
</div>
188188
<div id="chart" class="heatmapClass">
189-
<div class="team-filter">
190-
<mat-form-field class="team-chip-list">
191-
<mat-label>TeamList Filter</mat-label>
192-
<mat-chip-list #teams selectable multiple>
193-
<mat-chip
194-
#c="matChip"
195-
*ngFor="let team of filterTeamList"
196-
[value]="team"
197-
selected>
198-
{{ team }}
199-
</mat-chip>
200-
</mat-chip-list>
201-
</mat-form-field>
189+
<div class="right-panel">
190+
<div class="team-filter">
191+
<mat-form-field class="team-chip-list">
192+
<mat-label>Team Filter</mat-label>
193+
<mat-chip-list selectable>
194+
<mat-chip
195+
#c="matChip"
196+
(click)="toggleTeamSelection(c)"
197+
selected>
198+
All
199+
</mat-chip>
200+
<mat-chip
201+
#c="matChip"
202+
*ngFor="let team of teamList"
203+
(click)="toggleTeamSelection(c)">
204+
{{ team }}
205+
</mat-chip>
206+
</mat-chip-list>
207+
</mat-form-field>
208+
</div>
209+
<mat-card class="example-card" *ngIf="showTaskCard">
210+
<mat-card-title-group>
211+
<mat-card-title>{{ cardHeader }}</mat-card-title>
212+
<mat-card-subtitle>{{ cardSubheader }}</mat-card-subtitle>
213+
</mat-card-title-group>
214+
<mat-card-content
215+
*ngFor="let task of tasksData; index as taskIndex">
216+
<mat-expansion-panel>
217+
<mat-expansion-panel-header>
218+
<mat-panel-title>
219+
<button
220+
class="normal-button"
221+
(click)="
222+
$event.preventDefault();
223+
navigate(currentDimension, cardHeader, task['taskName'])
224+
">
225+
{{ task['taskName'] }}
226+
</button>
227+
</mat-panel-title>
228+
</mat-expansion-panel-header>
229+
<ng-template matExpansionPanelContent>
230+
<ul class="team-list">
231+
<li *ngFor="let item of task.teamsImplemented | keyvalue">
232+
<mat-checkbox
233+
[checked]="item.value === true"
234+
color="primary"
235+
(click)="this.teamCheckbox(taskIndex, item.key)">
236+
{{ item.key }}
237+
</mat-checkbox>
238+
</li>
239+
</ul>
240+
</ng-template>
241+
</mat-expansion-panel>
242+
</mat-card-content>
243+
</mat-card>
202244
</div>
203-
<mat-card class="example-card" *ngIf="showTaskCard">
204-
<mat-card-title-group>
205-
<mat-card-title>{{ cardHeader }}</mat-card-title>
206-
<mat-card-subtitle>{{ cardSubheader }}</mat-card-subtitle>
207-
</mat-card-title-group>
208-
<mat-card-content *ngFor="let task of tasksData; index as taskIndex">
209-
<mat-expansion-panel>
210-
<mat-expansion-panel-header>
211-
<mat-panel-title>
212-
<button
213-
class="normal-button"
214-
(click)="
215-
$event.preventDefault();
216-
navigate(currentDimension, cardHeader, task['taskName'])
217-
">
218-
{{ task['taskName'] }}
219-
</button>
220-
</mat-panel-title>
221-
</mat-expansion-panel-header>
222-
<ng-template matExpansionPanelContent>
223-
<ul class="team-list">
224-
<li *ngFor="let item of task.teamsImplemented | keyvalue">
225-
<mat-checkbox
226-
[checked]="item.value === true"
227-
color="primary"
228-
(click)="this.teamCheckbox(taskIndex, item.key)">
229-
{{ item.key }}
230-
</mat-checkbox>
231-
</li>
232-
</ul>
233-
</ng-template>
234-
</mat-expansion-panel>
235-
</mat-card-content>
236-
</mat-card>
237245

238246
<button
239247
class="normal-button"

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

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { ymlService } from '../../service/yaml-parser/yaml-parser.service';
33
import * as d3 from 'd3';
44
import * as yaml from 'js-yaml';
55
import { Router, NavigationExtras } from '@angular/router';
6+
import { MatChip } from '@angular/material/chips';
67

78
export interface taskSchema {
89
taskName: string;
@@ -36,7 +37,7 @@ export class CircularHeatmapComponent implements OnInit {
3637
radial_labels: string[] = [];
3738
YamlObject: any;
3839
teamList: any;
39-
filterTeamList: any;
40+
filteredTeamView: string = 'All';
4041
segment_labels: string[] = [];
4142
taskDetails: any;
4243
showOverlay: boolean;
@@ -58,13 +59,6 @@ export class CircularHeatmapComponent implements OnInit {
5859
this.maxLevelOfTasks = y;
5960
}
6061
this.teamList = this.YamlObject['strings']['en']['teams'];
61-
this.filterTeamList = ['All'];
62-
for (let i = 0; i < this.teamList.length; i += 1) {
63-
this.filterTeamList.push(this.teamList[i]);
64-
}
65-
66-
console.log(this.filterTeamList);
67-
// this.filterTeamList = ["All,"...teamList]
6862
});
6963
this.yaml.setURI('./assets/YAML/generated/generated.yaml');
7064
// Function sets data
@@ -117,10 +111,7 @@ export class CircularHeatmapComponent implements OnInit {
117111
if (lvlOfCurrentTask == l + 1) {
118112
totalTaskTeams += 1;
119113
var nameOfTask: string = allTaskInThisSubDimension[k];
120-
var Status: boolean =
121-
this.YamlObject[allDimensionNames[i]][
122-
allSubDimensionInThisDimension[j]
123-
][allTaskInThisSubDimension[k]]['isImplemented'];
114+
124115
// Create an object from an array from meta data
125116
const teams = this.teamList;
126117

@@ -179,6 +170,19 @@ export class CircularHeatmapComponent implements OnInit {
179170
});
180171
}
181172

173+
// Team Filter BEGINS
174+
175+
toggleTeamSelection(chip: MatChip) {
176+
chip.toggleSelected();
177+
this.filteredTeamView = chip.value;
178+
console.log(this.filteredTeamView);
179+
console.log(this.teamList);
180+
181+
// Update heatmap based on selection
182+
this.reColorHeatmap();
183+
}
184+
// Team Filter ENDS
185+
182186
teamCheckbox(taskIndex: number, teamKey: any) {
183187
let _self = this;
184188
var index = 0;

0 commit comments

Comments
 (0)