简体   繁体   English

(Tradingview轻量级)切换数据时弯曲的折线图arrays

[英](Tradingview lightweight) Crooked line graph when switch data arrays

I'am trying to display 2 different graphs on the same canvas upon click of an onclick function.我试图在单击 onclick function 后在同一个 canvas 上显示 2 个不同的图表。

My page defaults to the 1 Min line graph and a volume(histogram) graph at the bottom.我的页面默认为 1 Min 折线图和底部的体积(直方图)图。 The lightweight charts can draw the line and volume graphs without any issue.轻量级图表可以毫无问题地绘制折线图和体积图。

When I switch my graph to a 3 Min graph, the volume graph gets displayed without any issue but my line graph gets crooked.当我将图表切换到 3 分钟图表时,体积图表会毫无问题地显示,但我的折线图会弯曲。 As shown in the attached image.如附图所示。

Before I draw the 3 Min graph I would remove both the 1 Min line and volume serieses, after that I would create the 3 Min line and volume serieses and add in the 3 Min line and volume data arrays.在绘制 3 分钟图之前,我将删除 1 分钟线和体积系列,之后我将创建 3 分钟线和体积系列并添加 3 分钟线和体积数据 arrays。

How can I solve this issue?我该如何解决这个问题?

弯曲线图

In my original code, I had four serieses:在我的原始代码中,我有四个系列:

  • 1 min candles 1分钟蜡烛
  • 1 min volume 1 分钟音量
  • 3 min line 3分钟线
  • 3 min volume 3 分钟音量

I modified my code to have only 3 serieses:我将代码修改为只有 3 个系列:

  • candle蜡烛
  • volume体积
  • line线

And change the datasets accordingly using the series.setData method.并使用series.setData方法相应地更改数据集。

The graph now shows the data properly.图表现在正确显示了数据。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM