import { Component , OnInit } from '@angular/core' ; @ Component ( { selector : 'app-home' , templateUrl : './home.component.html' , styleUrls : [ './home.component.css' ] } ) export class HomeComponent implements OnInit { private chartData : Array < any > ; constructor ( ) { } ngOnInit ( ) { setTimeout ( ( ) => { this . generateData ( ) ; setInterval ( ( ) => this . generateData ( ) , 3000 ) ; } , 1000 ) ; } generateData ( ) { this . chartData = [ ] ; for ( let i = 0 ; i < ( 8 + Math . floor ( Math . random ( ) * 10 ) ) ; i ++ ) { this . chartData . push ( [ `Index ${ i }` , Math . floor ( Math . random ( ) * 100 ) ] ) ; } } }