lousy performance for huge dataset, relying on Jfreechart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Guest

lousy performance for huge dataset, relying on Jfreechart

Post by Guest » Sun Apr 24, 2005 6:31 pm

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!

Jii
Posts: 128
Joined: Thu Apr 21, 2005 11:17 am

Post by Jii » Mon Apr 25, 2005 9:57 am

What are you using as the time perioid for the time series?

gumshoe
Posts: 80
Joined: Mon Jul 12, 2004 6:06 pm

Post by gumshoe » Mon Apr 25, 2005 3:47 pm

Are you turning off notifications (with JFreeChart.setNotify(false)) before loading the data and then turning them on again?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Apr 25, 2005 5:38 pm

gumshoe wrote:Are you turning off notifications (with JFreeChart.setNotify(false)) before loading the data and then turning them on again?
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.

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

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Guest

Post by Guest » Mon Apr 25, 2005 5:59 pm

Thanks for taking time to response.

I am using the set notify method to turn off the update before loading data and turnign it on after updating teh data to the chart.

I am using Millisecond.class to specify the time period.
How do I turn off anti aliasing?

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Mon Apr 25, 2005 6:02 pm

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)
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

gumshoe
Posts: 80
Joined: Mon Jul 12, 2004 6:06 pm

Post by gumshoe » Mon Apr 25, 2005 6:58 pm

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.

gumshoe
Posts: 80
Joined: Mon Jul 12, 2004 6:06 pm

Post by gumshoe » Mon Apr 25, 2005 7:02 pm

Another thing: if possible use Series.add() instead of addOrUpdate() as the latter takes longer as it has to perform comparisons.

ValeryN
Posts: 2
Joined: Sun Dec 23, 2012 8:24 am
antibot: No, of course not.

Re: lousy performance for huge dataset, relying on Jfreechar

Post by ValeryN » Sun Dec 23, 2012 8:37 am

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

GeniuZ
Posts: 9
Joined: Sun Apr 05, 2009 9:14 am

Re: lousy performance for huge dataset, relying on Jfreechar

Post by GeniuZ » Thu Jan 17, 2013 4:52 pm

Hello, what about this plan?
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
I have bar chart with hudge of candles and performance is very slow.

John Matthews
Posts: 513
Joined: Wed Sep 12, 2007 3:18 pm

Re: lousy performance for huge dataset, relying on Jfreechar

Post by John Matthews » Sat Jan 19, 2013 11:14 am

You can use a paging approach, illustrated here.

Locked