Importing large charts is slow

TeeChart for Microsoft Visual Studio .NET, Xamarin Studio (Android, iOS & Forms) & Monodevelop.
Post Reply
JayG
Newbie
Newbie
Posts: 71
Joined: Mon Sep 04, 2006 12:00 am

Importing large charts is slow

Post by JayG » Tue Oct 30, 2007 7:50 pm

(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

JayG
Newbie
Newbie
Posts: 71
Joined: Mon Sep 04, 2006 12:00 am

Importing large charts is slow

Post by JayG » Tue Oct 30, 2007 10:26 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Wed Oct 31, 2007 11:17 am

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

JayG
Newbie
Newbie
Posts: 71
Joined: Mon Sep 04, 2006 12:00 am

Importing large charts is slow

Post by JayG » Thu Nov 01, 2007 7:49 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Fri Nov 02, 2007 10:24 am

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.
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

JayG
Newbie
Newbie
Posts: 71
Joined: Mon Sep 04, 2006 12:00 am

Importing large charts is slow

Post by JayG » Mon Nov 05, 2007 3:40 pm

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

Narcís
Site Admin
Site Admin
Posts: 14730
Joined: Mon Jun 09, 2003 4:00 am
Location: Banyoles, Catalonia
Contact:

Post by Narcís » Tue Nov 06, 2007 11:19 am

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!
Best Regards,
Narcís Calvet / Development & Support
Steema Software
Avinguda Montilivi 33, 17003 Girona, Catalonia
Tel: 34 972 218 797
http://www.steema.com
Image Image Image Image Image Image
Instructions - How to post in this forum

Post Reply