HI,
I am trying to continuously update 4 XYBarcharts within a panel, but as soon as I start the plotting, my CPU usage jumps to 100%. AM I overlooking something?Anyone with any suggestions, I would appreciate any help
Cassidy
100% CPU usage problem
Heavy load
I found the same thing in using the plotting package. I found it best to lower the priority of the program doing the plotting so other tasks could get some CPU time.
Rick Bier
pbier2@seistl.com
pbier2@seistl.com
CPU time issue
Hi
I found the bug that caused my bottleneck. I was processing all data in my incoming, including 0s. SO everytime I added data to my series, I also added zeros. Once I put in a simple if(data!=0){ series.add(data)} all my problems have also disappeared. You might want to also check for something so simple as that for getting CPU performance up.
Cass
I found the bug that caused my bottleneck. I was processing all data in my incoming, including 0s. SO everytime I added data to my series, I also added zeros. Once I put in a simple if(data!=0){ series.add(data)} all my problems have also disappeared. You might want to also check for something so simple as that for getting CPU performance up.
Cass
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
If you are adding multiple new values to a dataset, be aware that each 'add' will trigger a DatasetChangeEvent and repaint the chart. You can avoid that by using this approach:
The same applies to any other changes you make to the chart, plot(s), axes, renderers, titles etc.
Code: Select all
chart.setNotify(false);
// do multiple dataset updates here
chart.setNotify(true);
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
To speed up points added to series
Taking a hint from another post to your message, I found that when adding points to a series (which I do before creating the chart), the following speeds things up by a factor of 4:
XYSeries s1 = new XYSeries(...);
s1.setNotify(false);
add all points to the series
s1.setNotify(true);
XYSeries s1 = new XYSeries(...);
s1.setNotify(false);
add all points to the series
s1.setNotify(true);
Rick Bier
pbier2@seistl.com
pbier2@seistl.com
CPU
Thanks a lot,
I tried the setnotify, and it seems to be working fine. I also had to make sure to call the series.clear() before updating the chart
I tried the setnotify, and it seems to be working fine. I also had to make sure to call the series.clear() before updating the chart