Thread ID: |
Created: |
Updated: |
Platform: |
Replies: |
150556 | Jan 10,2020 07:34 PM UTC | Jan 13,2020 07:21 AM UTC | Angular - EJ 2 | 1 |
![]() |
Tags: Stock Chart |
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);
} |
This post will be permanently deleted. Are you sure you want to continue?
Sorry, An error occured while processing your request. Please try again later.
This page will automatically be redirected to the sign-in page in 10 seconds.