xchart在使用updateOHLCSeries时不能正确绘制数据。

huangapple 未分类评论50阅读模式
英文:

xchart java swing not drawing data correctly when using updateOHLCSeries

问题

嗨,我在使用Java Swing中的xChat库(org.knowm.xchart)时遇到了一个奇怪的问题。

我能够在第一次添加数据时创建一个图表(蜡烛图),但是当我在大约5秒后添加数据时,它不会绘制蜡烛。

1. 在初始化中,我使用了以下代码:`chart.addSeries("Candle", xData, openData, highData, lowData, closeData, volumeData);`
2. 在定时器中,在大约5秒后执行以下代码(通过WebSocket或其他方式接收消息后的5秒):`chart.updateOHLCSeries("Candle", xData, openData, highData, lowData, closeData, volumeData);`

结果:
[![enter image description here][1]][1]

我不明白为什么第一次可以绘制,但第二次不行,我怀疑与`chart.updateOHLCSeries`有关,但找不到解决方法。

在上面的图片中,前5个蜡烛是使用`chart.addSeries`绘制的,最后2个蜡烛是使用`chart.updateOHLCSeries`添加的。

  [1]: https://i.stack.imgur.com/9f7oN.png
英文:

Hi I have a weird issue with xChat lib(org.knowm.xchart) in java swing.

I am able to create a chart(Candle) when I first time add data to it, but when I add data to it say 5 sec after it is not drawing the candles.

  1. In Init i used chart.addSeries("Candle", xData, openData, highData, lowData, closeData, volumeData);
  2. In Timer 5 sec after(done by using WSS onmessages i.e. the message is recieving after few seconds) chart.updateOHLCSeries("Candle", xData, openData, highData, lowData, closeData, volumeData);

Result:
xchart在使用updateOHLCSeries时不能正确绘制数据。

I am not able to understand why it wors first time and not 2nd time, i suspect it has something to do with the chart.updateOHLCSeries but cannot find a solution for it.

In the image above, the first 5 candles are drawn using the chart.addSeries and last 2 are being addedd in using chart.updateOHLCSeries

huangapple
  • 本文由 发表于 2020年4月11日 13:23:10
  • 转载请务必保留本文链接:https://java.coder-hub.com/61152465.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定