ngOnInit() {
this.title = 'Efficiency of oil-fired power production';
this.range = false;
this.period = false;
this.periods = [
{ intervalType: 'Minutes', interval: 1, text: '1m' },
{ intervalType: 'Minutes', interval: 30, text: '30m', },
{ intervalType: 'Hours', interval: 1, text: '1H', selected: true },
{ intervalType: 'Hours', interval: 2, text: '2H' },
];
this.setTimeoutValue = 5000;
this.intervalId = setInterval(
() => {
let i: number;
if (getElement('chart-container') === null) {
clearInterval(this.intervalId);
} else {
this.date = new Date(this.date.getTime() + (1 * 60 * 1000));
this.series1.push( {
x: this.date,
high: Math.floor(Math.random() * (100 - 90 + 1) + 90),
low: Math.floor(Math.random() * (60 - 50 + 1) + 50),
close: Math.floor(Math.random() * (99 - 51 + 1) + 51),
open: Math.floor(Math.random() * (99 - 51 + 1) + 51)
});
this.i++;
this.stock.series[0].dataSource = this.series1;
this.stock.refresh();
}
},
1000);
}
ngOnDestroy() {
clearInterval(this.intervalId);
} |