All files / app/analysis analysis.component.ts

100% Statements 17/17
100% Branches 5/5
100% Functions 3/3
100% Lines 17/17

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70                                                    1x     13x   13x 13x       13x 13x             6x 5x 5x   1x   1x 1x 1x         5x 5x   5x   5x              
import { Component, Input, SimpleChanges } from '@angular/core';
import { CommonModule } from '@angular/common';
import { ChartModule } from 'primeng/chart';
 
import { MatCardModule } from '@angular/material/card';
import { MatRadioModule } from '@angular/material/radio';
import { FormControl, FormsModule, ReactiveFormsModule } from '@angular/forms';
import { MatDividerModule } from '@angular/material/divider';
import { MatListModule } from '@angular/material/list';
import { CoTable } from '../wo-table';
import { WorkoutService } from '../Service/workout.service';
 
 
 
 
 
@Component({
  selector: 'app-analysis',
  standalone: true,
  imports: [CommonModule, ChartModule, MatCardModule, MatRadioModule, FormsModule, ReactiveFormsModule, MatListModule, MatDividerModule],
  templateUrl: './analysis.component.html',
  styleUrl: './analysis.component.css'
})
 
 
 
export class AnalysisComponent{
 
 
select = new FormControl();
 
heading: string = '';
names: string[] = this.service.names;
basicData: any; 
basicOptions: any;
 
constructor(public service:WorkoutService){
  this.basicOptions = this.service.basicOptions;
}
 
 
 @Input() updateData!: CoTable[];  // To receive updated graph data from search-form.component
                        
 ngOnChanges(changes: SimpleChanges) {    // detect changes in 'updateData' and then update graph
   if (changes['updateData'] && this.updateData[0]) {
     this.onSelection(this.updateData[0].name);
     this.select.setValue(this.updateData[0].name);
   }
   else if(!this.updateData[0])
   {
    this.names = [];
    this.basicData = {};
    this.service.heading = '';
   }
}
 
onSelection(name: string){  // This function trigger when click list of names and display the graph associated with the name
    this.service.handleListItemClick(this.updateData);
    this.service.SelectItemClick(name);
 
    this.basicData = this.service.basicData;
   
    this.names = this.service.names;
}
 
 
 
 
}