xchart java swing not drawing data correctly when using updateOHLCSeries

200 views Asked by At

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: enter image description here

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

0

There are 0 answers