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
Problem while plotting huge data, pls help, Urgent.....
-
- Posts: 1634
- Joined: Sat Feb 17, 2007 1:51 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
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
JDBC Datasets
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?
how big is the dataset?
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
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
Hi, I also found this post for you:
http://www.jfree.org/phpBB2/viewtopic.php?t=12788
It says:
http://www.jfree.org/phpBB2/viewtopic.php?t=12788
It says:
Let us know how it goes...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);
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
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