Page 1 of 1
Importing large charts is slow
Posted: Tue Oct 30, 2007 7:50 pm
by 9792387
(TeeChart version 3)
Hi,
I am working on exporting and importing some very large charts. For example, one of them has 160 series, each with over 17000 points. The TEN file size (with data) is over 150 MB. Importing it takes over 15 minutes on a P4 3GHz system with 1.25GB RAM (WinXP Pro).
I am trying several work-arounds, such as saving the data separately, but before I spent a lot of time on it I was wondering if anyone has found a way to speed up importing charts this large.
Jay
Importing large charts is slow
Posted: Tue Oct 30, 2007 10:26 pm
by 9792387
Here's my workaround so far:
I wrote my own code to export the data to a text file using a StreamWriter (in VB).
Then, to export the chart, I do this:
Code: Select all
For WhichSeries = 0 To ChartForm.TChart1.Series.Count - 1
ChartForm.TChart1.Series(WhichSeries).Clear()
Next WhichSeries
ChartForm.TChart1.Export.Template.IncludeData = False
ChartForm.TChart1.Export.Template.Save(SaveFileDialog1.FileName)
For WhichSeries = 0 To ChartForm.TChart1.Series.Count - 1
ChartForm.TChart1.Series(WhichSeries).CheckDataSource()
Next WhichSeries
To import, I fill the data table from the text file, then import the TEN file and set the data source info.
This combination works for me because I am not using colors or labels for individual points in the series.
The TEN file is down to 176 KB (instead of > 150 MB). My text data file is about 17 MB. The total time to import both the data and the chart file is about 25 seconds.
Jay
Posted: Wed Oct 31, 2007 11:17 am
by narcis
Hi Jay,
To be able to give a more accurate reply, would you be so kind to answer some questions?
1. Are you running the test at designtime or runtime?
2. Where is the data coming from?
3. How long does it take to load the original data into the chart?
Thanks in advance!
Importing large charts is slow
Posted: Thu Nov 01, 2007 7:49 pm
by 9792387
The testing is done at runtime.
The original data comes from an SQL Server query that fills a VB DataTable. Then I add lines to the chart (most start out with Visible set to false) and set their DataSource and DataMember properties.
Running the query and filling the DataTable takes about 2 minutes 20 seconds (most of that is query time, it is a complicated query). Adding the lines to the chart and setting the DataSource and DataMember properties takes about 15 seconds.
Jay
Posted: Fri Nov 02, 2007 10:24 am
by narcis
Hi Jay,
Thanks for the information.
You could try loading data into the chart, export the chart to a .ten file without data and finally export the data separately as a text or XML file. For further information on exporting possibilities please read Tutorial 12 - Exporting and Importing Charts. You'll find the tutorials at TeeChart's program group.
We understand that this is effectively what you've done yourself, but we'd like to see if doing the same with TeeChart code produces a significant time saving and if so, of what magnitude.
Importing large charts is slow
Posted: Mon Nov 05, 2007 3:40 pm
by 9792387
Exporting the chart without data produced a 106 MB .ten file, and exporting the data produced a 136 MB .txt file. Importing the chart and adding the data to it took about 12 minutes. Importing the chart, adding the data to a DataTable, and linking the chart to the DataTable took about 11 minutes.
Note that the file sizes and import times are still significantly longer than what I get using my workaround. I developed my workaround because the files were still so large and still took a long time to import. One thing I noticed is that the data exported from TeeChart to a text file used dual byte characters instead of ASCII single byte characters. When I create my own text file, I use ASCII single byte characters, which cuts the file size in half (I also did some other things to reduce the size even more).
Jay
Posted: Tue Nov 06, 2007 11:19 am
by narcis
Hi Jay,
Thanks for the information.
First of all, the text file is double-byte to support double-byte charsets (like Japanese, Chinese, ...).
We are also wondering if you are setting AutoRepaint to false before loading data and then setting it back to true as shown in the example I posted
here.
Finally, could you please send us a data text file so that we can run some tests here?
You can post your files at news://
www.steema.net/steema.public.attachments newsgroup or at our
upload page.
Thanks in advance!