diff --git a/src/app/home/home.component.ts b/src/app/home/home.component.ts index e635cc9..c500d38 100644 --- a/src/app/home/home.component.ts +++ b/src/app/home/home.component.ts @@ -18,7 +18,7 @@ interface KeyInterface { export class HomeComponent implements OnInit { keys: KeyInterface[] = []; - isActiveKey: { [key: string]: boolean } = {}; // object to check if key is currently active + isActiveKey: { [key: string]: boolean } = {}; // Object to check if key is currently active myChart: Chart; constructor( @@ -27,11 +27,11 @@ export class HomeComponent implements OnInit { ) { } ngOnInit() { - // fetch all available groups + // Fetch all available groups this.fetchData('/material/groups', data => this.createGroup(data)); } - // api access with callback + // Api access with callback async fetchData(URL: string, processor: any) { this.api.get(URL, (sData, err, headers) => { processor(sData); @@ -48,10 +48,10 @@ export class HomeComponent implements OnInit { this.keys = temp; // invoke update in rb-multiselect this.initChart(); - // only neccesary if keys get preselected + // Only neccesary if keys get preselected //this.calcFieldSelectKeys(); - // fetch all samples populated with according group + // Fetch all samples populated with according group this.getSamples(); } @@ -70,7 +70,7 @@ export class HomeComponent implements OnInit { } } - // loop through samples and count + // Loop through samples and count countSamples(data: any) { this.keys.map(key => key.count = 0); for (var i = 0; i < data.length; i++) { @@ -83,14 +83,14 @@ export class HomeComponent implements OnInit { this.updateGraph(); } - // preset select + // Preset select calcFieldSelectKeys() { this.keys.forEach(key => { this.isActiveKey[key.id] = key.active; }); } - // update keys based on select + // Update keys based on select updateGroups(activeKeys: any) { this.keys.forEach(key => { if (activeKeys.hasOwnProperty(key.id)) { @@ -100,7 +100,7 @@ export class HomeComponent implements OnInit { this.getSamples(); } - // get data for graph based on active keys + // Get data for graph based on active keys updateGraph() { let nameList: string[] = []; let dataList: number[] = []; @@ -116,7 +116,7 @@ export class HomeComponent implements OnInit { this.myChart.update(); } - // draw graph + // Initialize graph async initChart() { this.myChart = new Chart("myChart", { type: 'bar',