0

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

blong
  • 2,815
  • 8
  • 44
  • 110
user614946
  • 599
  • 5
  • 10
  • 27
  • You wrote in your question: _i suspect it has something to do with the chart.updateOHLCSeries_ Actually, I think it may have something to do with your code. Are you using [swing timer](https://docs.oracle.com/javase/tutorial/uiswing/misc/timer.html) ? – Abra Apr 11 '20 at 05:50
  • Hi i said timer to make things easy, but in actual I am getting data from WSS onmessages and they are consistently sending me data in every 5 sec. – user614946 Apr 11 '20 at 05:52
  • @Abra I have updated the description with more details – user614946 Apr 11 '20 at 15:27

0 Answers0