[Chartjs]-Angular 2: How to pass my API data to graph and Display the Graph with data

0👍

you can use async pipe

dataSourceObservable :Observable<any>

constructor(private serverService: ServerService) { 
 this.dataSourceObservable  = this.serverService.getServers()
  .map(response => response.json());  
}

...

 <div *ngIf=getGraphClicked>
        <fusioncharts
          [id]="id"
          [width]="width"
          [height]="height"
          [type]="type"
          [dataFormat]="dataFormat"
          [dataSource]="dataSourceObservable | async">
        </fusioncharts>      
      </div>

Leave a comment