Hi all,
I am using a DynamicTimeSeriesCollection dataset in a TimeSeriesChart to show live data on a chart.
The rate of getting new data is only one per second, but the requirement is that the chart should scroll smoothly. To achieve that, in the chart updater thread I calculate the data point between the new data and the latest one, and keep adding the interpolated values to the chart for example 20 times in a second.
This works well on a small resolution chart, but when I put the window on a FHD or bigger monitor the chart became sluggish.
Any idea how to speed up chart drawing?
Or is there any solution to implement a smooth scrolling chart with value updates coming in just in every 1 second (maybe some trick to not to draw the already drawn point just scroll them somehow)?
Things I tried:
- decrease chart resolution by:
chartpanel.setMaximumDrawWidth(myGUI.throughPutChartPanel.getWidth()/2);
chartpanel.setMaximumDrawHeight(myGUI.throughPutChartPanel.getHeight()/2);
(not helping)
- using -Dsun.java2d.opengl=true - no visible difference in speed
- not adding shadowgenerator: it helped a bit, so now there is no shadows, but that is still OK
Thansk a lot in advance
goldie
edit:
oh and I tried XChart and the chart library in the VisualVM java profiler, both claim that they are faster for real time charts then jfreechart, but they are much slower.
edit2:
btw the datasets are not big, only 3 lines showing 1 minutes of data (so 3 dataset each with 20 x 60 data) (20fps during 60 seconds)
improve realtime chart performance
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Re: improve realtime chart performance
Each chart repaint will redraw everything, so it isn't the most efficient. There aren't any optimisations available to make it faster, unfortunately. There was a project that was optimising for realtime updates:
https://sourceforge.net/projects/jrobin/
I don't think it is maintained anymore (I might be wrong though) but it could be worth a look.
https://sourceforge.net/projects/jrobin/
I don't think it is maintained anymore (I might be wrong though) but it could be worth a look.
David Gilbert
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
JFreeChart Project Leader
Read my blog
Support JFree via the Github sponsorship program
Re: improve realtime chart performance
Hi David,
thanks for the answer!
btw. I tried with a more powerful hardware and now it looks kind of OK.
have a nice day
thanks for the answer!
btw. I tried with a more powerful hardware and now it looks kind of OK.
have a nice day