Loading own data file into TChart

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

Loading own data file into TChart

Post by bamboo » Tue May 13, 2008 9:24 am

I have a data file with 5 columns and many entries.
I wish to load it into my TChart.
Is there a way of loading this file at once specifying which two columns to use.
I intend using the TPointSeries.

Thanks.

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 May 13, 2008 12:05 pm

Hi bamboo,

Yes, this is possible. You can import data from a file as described in Tutorial 12 - Exporting and Importing Charts. You'll also find an example at All Features\Welcome!\Components\Text Source in the new features demo.

Tutorials and demo can be found at TeeChart's program group.
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

bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

Post by bamboo » Wed May 14, 2008 7:50 am

Thank you.

The TSeriesTextSource help me loading a txt file.

One more problem is the "FieldSeparator". The whitespace between the columns in the txt files generated are not consistent. How do I deal with this.

Thanks again.

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 May 14, 2008 8:53 am

Hi bamboo,

You can try using tab as FieldSeparator instead of blank space. You could also separate fields in the data file for comma (',') or semicolon (';').
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

bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

Post by bamboo » Wed May 14, 2008 11:32 am

Thanks.

These data text files are generated by another division for the last 20 years and it works well for them when integrated with other tools.

One solution is to change the format (whitespaces to commas) in the code once I have read the files.

Any other advise.

Thanks.

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 May 14, 2008 11:40 am

Hi bamboo,

Try setting tab as field separator:

Code: Select all

  SeriesTextSource1.FieldSeparator := #9;
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

bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

Post by bamboo » Wed May 14, 2008 12:15 pm

I would like to attach an extract of one of the text data files.

Is it possible in this forum.

Thanks.

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 May 14, 2008 1:05 pm

Hi bamboo,

You can either 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

bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

Post by bamboo » Thu May 15, 2008 7:48 am

I have uploaded the file called test_a.txt using your upload page.

Please see if you can read this file using the 'FieldSeparator'.

Thanks

bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

Post by bamboo » Thu May 15, 2008 8:33 am

I have uploaded the file called test_a.txt using your upload page.

Please see if you can read this file using the 'FieldSeparator'.

Thanks

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 May 16, 2008 1:53 pm

Hi bamboo,

Thanks for the file, we could reproduce the issue here. The only solutions we can think are:

1. Modify the data file or a temporary copy of it, replacing all what spaces for a single white space, comma or semicolon. That way data loads fine.

2. Manually parse each text line to extract the data to be populated to a series.
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

bamboo
Newbie
Newbie
Posts: 32
Joined: Thu Jul 12, 2007 12:00 am

Post by bamboo » Mon May 19, 2008 8:54 am

Thank you very much. That is what I have done.
I was hoping to use the file as is.

It also seems that I have to create multiple instances of the TSeriesTextSource to plot multiple series from the same data file. I was hoping to use only the one TSeriesTextSource which I placed on the form. I never know how many graphs the user wishes to display from the data file.

Please advise.

Thank you.

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

Post by Narcís » Mon May 19, 2008 9:12 am

Hi bamboo,

You can use one single text source and change its properties at runtime as shown on the example here.
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