Problem while plotting huge data, pls help, Urgent.....

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
sarin
Posts: 10
Joined: Mon Dec 17, 2007 1:29 pm

Problem while plotting huge data, pls help, Urgent.....

Post by sarin » Wed Jan 30, 2008 12:04 pm

Hello,

Pls respond to this mail.

I am using Jfreechart(for line chart) to plot about 1 lakh data points. But it takes almost 20 min. I don't why it should take this amount of time. I used in applet and server side. But almost same time taken and the browser also becomes hang.

I took the value from database and in the result set i did this method to
add the value to dataset.

while(rsToArray.next()){

dataset.addValue(rsToArray.getDouble(2),"Type1",rsToArray.getString(1));

i++;
}


I checked process time for this operation but it is also high. It takes 1/3 rd of the total time.

and this code

JFreeChart chart = ChartFactory.createLineChart(
"Temperature vs. Time", // chart title
null, // domain axis label
"Temperature", // range axis label
dataset, // data
PlotOrientation.VERTICAL, // orientation
false, // include legend
true, // tooltips
false // urls
);

and took double time to process .

ie creating dataset took 1/3 rd time
and chart creation took remaining 2/3 rd time and almost took 20 min to
complete the chart.

I know that this will never happen.


Pls suggest me what can i do to reduce the time, pls hepl. I am creating a line chart now.

But i want to use almost all chart types. Please respond.




Thanks in Advance

Bye

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Post by paradoxoff » Wed Jan 30, 2008 8:20 pm

Hi,
You are using a CategoryDataset to prerare a line chart. I assume that an XYDataset and a XYPlot would be much better for huge amounts of data. 100.000 categories surely take time.
Have you checked you much time you are spending in JFreeChart related methods and how much time you are spending with (e.g.) waiting for the database? Have you tried to stuff the data that you are getting from the database into a simpler data structure to see how long that takes?
Regards
Paradoxoff

nimowy
Posts: 19
Joined: Fri Jan 25, 2008 10:16 pm

JDBC Datasets

Post by nimowy » Thu Jan 31, 2008 5:35 pm

Have you considered using JDBCCategoryDataset or JDBCXYDataset? It will load data from the database for you. I don't know if it's quicker, but it might speed things up a little.

how big is the dataset?

mkivinie
Posts: 51
Joined: Wed Jul 06, 2005 8:35 am

Post by mkivinie » Fri Feb 01, 2008 9:17 am

Also note that tooltip generation takes an awful lot of time when using big datasets. All tooltips for all datapoints are generated during initialization. :(

Search the forum for FastXYPlot for a faster plotter that also improves tooltip generation speed.

Tom
Posts: 32
Joined: Mon Dec 11, 2006 2:50 pm

Post by Tom » Fri Feb 01, 2008 11:21 am

If you add all Datapoints at once and don't need to update the Chart, set notifications off before inserting data, because a DatasetChangeEvent is fired for each and every Datapoint that is added.

For example, you can override the addValue-Method and comment out the last line fireDatasetChanged.

After all Points are added do a

fireDatasetChanged(); by yourself, so that the DatasetChanged-Event is fired only once fpr all Points.

That reduced working time (in my case) form 5 minutes to 10 seconds.

Hope that helps,

Tom

P.S. for more Info on that have a look at:

http://www.jfree.org/phpBB2/viewtopic.php?t=18592

nimowy
Posts: 19
Joined: Fri Jan 25, 2008 10:16 pm

Post by nimowy » Mon Feb 04, 2008 5:34 pm

Hi, I also found this post for you:
http://www.jfree.org/phpBB2/viewtopic.php?t=12788

It says:
david.gilbert wrote:Make sure you have tooltips and URLs disabled, those will use a lot of memory at drawing time. If you are displaying the chart in a ChartPanel, you may also need to disable the collection of chart entities:

Code: Select all

        chartPanel.getChartRenderingInfo().setEntityCollection(null);
Let us know how it goes...

sarin
Posts: 10
Joined: Mon Dec 17, 2007 1:29 pm

Post by sarin » Wed Feb 13, 2008 12:57 pm

Thanks for your mails.


I given the code
chartPanel.getChartRenderingInfo().setEntityCollection(null);

But not much improvement.

I want to plot not just one chart but to plot pie, bar etc with this large amount of dataset. So i have to use categorydataset to plot the other graphs.

The problem in using the XYSeries is
i am using date in the x axis. So i think i can't give it on XY Series. So i tried the TimeSeries, but couldn't give it yet.

Pls anyone tell how i can give the date in the

yy/mm/dd hh:mm:ss format . how i can give this in TimeSeries????


2)Performance??

Should it take 20 min of amount of thme to plot 1 lakh data. Is there any method to reduce it. Should i customize the source code with the things described in the above mails. Pls guide me to this problem


Pls help

Sarin

Locked