微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

如何使用TradingView轻量级库绘制具有不同颜色的多个图表?

如何解决如何使用TradingView轻量级库绘制具有不同颜色的多个图表?

我正在尝试使用以下代码绘制两个不同的图表(长度不同),但不知道如何为图表指定颜色?还不确定下面的代码是否会在同一TradingView窗口中绘制两个图表?

this.apiService.predictor(this.selectedStock,this.startDay,this.endDay).subscribe((results) => {
  const lineseries = this.chart.addLineseries()

    for(let result of results[0]['prediction_value']) {
      console.log("the result1 is",result);
      lineseries.update({time : result.time,value : result.price})
    }
  const lineseries2 = this.chart.addLineseries()

    for(let result of results[0]['real_value']) {
      console.log("the result2 is",result);

      lineseries.update({time : result.time,value : result.price})
    }

result数组如下所示:

the result1 is {price: 18,time: "2019-09-28"}
the result1 is {price: 68,time: "2019-10-01"}
the result1 is {price: 5,time: "2019-10-04"}
the result1 is {price: 11,time: "2019-10-07"}
the result1 is {price: 8,time: "2019-10-11"}
the result1 is {price: 14,time: "2019-10-14"}

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。