lousy performance for huge dataset, relying on Jfreechart
lousy performance for huge dataset, relying on Jfreechart
David,
I have a CombinedDomainXY with 12 series.
Requirement:
Need to load 12 hours of timeseries dataset (0.5MB ?). Should be able to scroll through the dataset.
Problem:
Both data loading and scrolling through the dataset is taking lot of time.
Please advise if there is an efficient way to improve the performance as I am relying greatly on Jfreechart. Thanks in anticipation for your time and any immediate help!
I have a CombinedDomainXY with 12 series.
Requirement:
Need to load 12 hours of timeseries dataset (0.5MB ?). Should be able to scroll through the dataset.
Problem:
Both data loading and scrolling through the dataset is taking lot of time.
Please advise if there is an efficient way to improve the performance as I am relying greatly on Jfreechart. Thanks in anticipation for your time and any immediate help!
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
That is a good point, each addition to the dataset will trigger a chart redraw, so when you are initially populating the dataset, make sure you do it before you assign the dataset to the chart, or use setNotify(false), then setNotify(true) afterwards as suggested above.gumshoe wrote:Are you turning off notifications (with JFreeChart.setNotify(false)) before loading the data and then turning them on again?
Some other ideas:
- make sure you aren't generating tooltips or URLs for the chart, this will create lots of new objects and slow things down;
- try turning off anti-aliasing, this speeds things up noticeably (but the charts usually don't look as nice);
- the TimePeriod subclasses are flexible but not so efficient, try using FixedMillisecond or just a plain XYSeries/XYSeriesCollection where the x-value is in milliseconds since 1-Jan-1970. There have been some suggestions made about improving the TimeSeries efficiency - I haven't had time to look at the issue closely yet, but I plan to since there is a problem in there.
Another area where JFreeChart is inefficient is that the XYPlot cycles through all the data points even in cases where only a subset of the values are displayed on the chart. I've added a getDomainOrder() method to the XYDataset interface to allow the plot to determine when a dataset is "ordered" (not all of them will be, but TimeSeries is). I plan to add some code to XYPlot to skip the values that are not in view for the chart, but this hasn't been done yet. It should make a big difference in cases where you have say 10 years of data but you are currently only looking at 1 years worth on the chart.
Some people have reported good results from modifying the renderer to only draw data items when the x-value has "advanced" sufficiently from the last x-value drawn. This makes use of the fact that there is no value in drawing 10 points (say) within 1 pixel along the x-axis, but you need to take care about the values you are skipping to ensure that the chart remains as accurate as it need to be.
I'm open to other suggestions about improving performance, but bear in mind that any changes that go into JFreeChart have to either work in the general case or, for "special case" optimisations, automatically detect the cases where they apply.
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
-
- JFreeChart Project Leader
- Posts: 11734
- Joined: Fri Mar 14, 2003 10:29 am
- antibot: No, of course not.
- Contact:
Try switching from Millisecond to FixedMillisecond - that will avoid a lot of date translations.
For switching off antialiasing:
http://www.jfree.org/jfreechart/api/org ... s(boolean)
For switching off antialiasing:
http://www.jfree.org/jfreechart/api/org ... s(boolean)
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
FYI: the thread about reducing unecessary draw operations is http://www.jfree.org/phpBB2/viewtopic.p ... 30&start=0, look for "StandardXYItemRenderer" for the source.
Re: lousy performance for huge dataset, relying on Jfreechar
Hey guys, first all, I wanted to thank you for this amazing charting library.
I'm not really an expect in swing, and probably for most of you it will sound pretty obvious, but for people like me, I wanted to mention one pretty strange thing regarding performance:
When I wrap ChartPanel with JPanel overall application performance is way better (~x10 times faster for pretty complex chart with not much of data points).
I have 5 charts within CombinedDomainXYPlot with 2-3 data series each and 100 data points per data series, some markers and some annotations...
Doesn't sound like something challenging to calculate.. but UI was terribly slow during resize / maximize window / zoom operations. Every visible resize step took about 1-2 seconds. 2-3 seconds for maximize.
Didn't change anything except wrapped the JPannel to add some botton for UI configuration, and now resize / maximize delays are less than 200 ms.
Machine: MacOS 10.8, 2.6 Gz, 8 gb. memory
I'm not really an expect in swing, and probably for most of you it will sound pretty obvious, but for people like me, I wanted to mention one pretty strange thing regarding performance:
When I wrap ChartPanel with JPanel overall application performance is way better (~x10 times faster for pretty complex chart with not much of data points).
I have 5 charts within CombinedDomainXYPlot with 2-3 data series each and 100 data points per data series, some markers and some annotations...
Doesn't sound like something challenging to calculate.. but UI was terribly slow during resize / maximize window / zoom operations. Every visible resize step took about 1-2 seconds. 2-3 seconds for maximize.
Didn't change anything except wrapped the JPannel to add some botton for UI configuration, and now resize / maximize delays are less than 200 ms.
Machine: MacOS 10.8, 2.6 Gz, 8 gb. memory
Re: lousy performance for huge dataset, relying on Jfreechar
Hello, what about this plan?
I have bar chart with hudge of candles and performance is very slow.I plan to add some code to XYPlot to skip the values that are not in view for the chart, but this hasn't been done yet
-
- Posts: 513
- Joined: Wed Sep 12, 2007 3:18 pm
Re: lousy performance for huge dataset, relying on Jfreechar
You can use a paging approach, illustrated here.