Is JFreeChart a practical answer

Discussion about JFreeChart related to stockmarket charts.
Locked
TXAggie
Posts: 8
Joined: Thu Aug 03, 2006 4:35 pm

Is JFreeChart a practical answer

Post by TXAggie » Wed Jan 03, 2007 6:09 pm

I am using JFreeChart to do some backtesting in the Forex market. I have a csv sheet containing 1 years worth of 1 minute data. In all about 370,825 entries. I have loaded this data into a time series chart(obviously using Minute() for the time period), but the performance is horrible. I profiled my application and here are my results that use up all my memory:

org.jfree.date.SpreadsheetDate ->1,250,144 B
org.jfree.data.time.TimeSeriesDataItem ->625,840 B
org.jfree.data.time.Hour ->624,992 B
org.jfree.data.time.Day ->623,760 B
org.jfree.data.time.Minute ->623,648 B

This is just one chart. I need two more, but there is no way this will be possible. Is there anyway to reuse the objects needed for the data? As the subject title asked... Is JFreeChart a practical answer for this kind of application?

Thanks,
Scott

oscar
Posts: 26
Joined: Fri May 28, 2004 10:01 am
Location: Switzerland

Post by oscar » Wed Jan 10, 2007 2:11 pm

On a one-minute interval with 10 hours of data per day, 250 days/year that's about 150,000 points on the x-axis. My screen has 1280 pixels across the way so that would mean I would cram about 120 points into each pixel.

Put it another way, you only need to plot points every two hours over the course of a year to completely use the full resolution of the screen - in practice, for a year chart, each day's closing price would be perfectly adequate.

So basically, I'm saying that obviously the thing doesn't work because you are grossly overdoing the resolution.

Then again, maybe I'm mistaken - how big, exactly, is your screen?

TXAggie
Posts: 8
Joined: Thu Aug 03, 2006 4:35 pm

Post by TXAggie » Wed Jan 10, 2007 6:02 pm

So basically, I'm saying that obviously the thing doesn't work because you are grossly overdoing the resolution.
Actually it does work. Regardless of resolution, my performance is bad because of how much data objects I am creating (as seen from my previous post).

But I did do an experiment to test your little theory. I did a one month chart on my computer. I have two 20 inch monitors (1680x1050). I profiled each of the following: The first part I made my chart screen about half the size of one monitor and the second part I utilized both screens (3360) and the results.... there was absolutely nothing different. The performance and memory usage was exactly the same.

Thanks you for your response, but that's really not the answer to my question.

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 » Fri Jan 12, 2007 12:32 pm

The TimeSeries/TimeSeriesCollection classes are very flexible, but a little heavy on memory usage. In JFreeChart 1.0.2, a more lightweight dataset (org.jfree.data.xy.DefaultXYDataset) which uses a double[][] array as the underlying storage, was added. Maybe that will help you here. For the x-values, just use the "milliseconds since 1-Jan-1970" encoding defined by java.util.Date.
David Gilbert
JFreeChart Project Leader

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

TXAggie
Posts: 8
Joined: Thu Aug 03, 2006 4:35 pm

Post by TXAggie » Fri Jan 12, 2007 6:45 pm

Thank you David! I will give it a shot and see if that'll work for me

Thanks

oscar
Posts: 26
Joined: Fri May 28, 2004 10:01 am
Location: Switzerland

Post by oscar » Mon Jan 15, 2007 8:33 am

I don't think you understand what I'm saying...

Your problem is that your data objects are too large and take too long to create - correct?

My point is that you can't see all the information in your charts anyway so you might as well make them smaller, then they'll be quicker to generate. A one-year chart with data points every minute has over a hundred data points in every pixel - so that's pointless resolution. In other words, you could reduce the number of points on the x-axis by a factor of 100 and teh chart would look *exactly* the same on the screen, but it would consume only 1% of the memory and fill 100 times faster...

raghrao
Posts: 2
Joined: Tue Apr 10, 2007 5:29 pm

Size of X-axis in TimeSeriesCollection

Post by raghrao » Tue Apr 10, 2007 5:35 pm

how could I reduce the number of points on the x-axis by a factor of 100..in TimeSeriesCollection..
Kind request for reply

jwenting
Posts: 157
Joined: Sat Jul 15, 2006 7:46 am

Post by jwenting » Fri Apr 13, 2007 8:08 am

by retrieving less data and thus putting less data into the collection...

In our system I can simply tell the engine to give me points at specified intervals (minute, hour, day, for example) and I get a filtered set as a result.
If your system doesn't have something like that, maybe it's time to add it :)

raghrao
Posts: 2
Joined: Tue Apr 10, 2007 5:29 pm

Post by raghrao » Fri Apr 13, 2007 2:07 pm

Even if I take little data...the distance between one point and other point is more.. the point is ...I have to set some method in time series object or time series collection object.....
Please provide some pointer....

jwenting
Posts: 157
Joined: Sat Jul 15, 2006 7:46 am

Post by jwenting » Thu Apr 26, 2007 11:54 am

filter the data between retrieval and insertion in the data to be plotted...

qn
Posts: 2
Joined: Thu May 31, 2007 12:41 am

Post by qn » Thu May 31, 2007 12:46 am

370,825 entries is no problem for QN Plot:

//quies.net/java/math/plot/

jwenting
Posts: 157
Joined: Sat Jul 15, 2006 7:46 am

Post by jwenting » Thu May 31, 2007 6:58 am

the problem isn't the number of points per se but the memory and CPU cycles needed to extract and store them...

Using another product you signed up here to spam about isn't going to help that.

qn
Posts: 2
Joined: Thu May 31, 2007 12:41 am

Post by qn » Thu May 31, 2007 9:59 am

Eazy man! What's that attitude for? It's free software.

You misunderstood. My implementation uses QN CSV and is able to parse and render 420,000 coordinates within 2 seconds on a 2.4GHz Xeon.

Locked