如何使用 websocket feed 绘制高图表?

问题描述 投票:0回答:1
javascript angular websocket highcharts real-time
1个回答
0
投票

使用setData可以解决这个问题。

ngOnInit() {
    console.log(this.Highcharts_bt);

    this.rate_bt = this.subject_bt.pipe(
      concatMap(item => of (item).pipe(delay(0)))
    ).subscribe(data => {
      this.rate_bt = data;
      let curr_rate = Number(this.rate_bt.bitcoin);
      this.chardata_bt.push(curr_rate);

      let a_chart = this.Highcharts_bt.charts[0];
      if (a_chart) {
        a_chart.series[0].setData(this.chardata_bt, true);
      }
    });
}

这也来自 Highcharts - redraw() 与新的 Highcharts.chart

© www.soinside.com 2019 - 2024. All rights reserved.