Page 1 of 1

Loading own data file into TChart

Posted: Tue May 13, 2008 9:24 am
by 10546084
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.

Posted: Tue May 13, 2008 12:05 pm
by narcis
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.

Posted: Wed May 14, 2008 7:50 am
by 10546084
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.

Posted: Wed May 14, 2008 8:53 am
by narcis
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 (';').

Posted: Wed May 14, 2008 11:32 am
by 10546084
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.

Posted: Wed May 14, 2008 11:40 am
by narcis
Hi bamboo,

Try setting tab as field separator:

Code: Select all

  SeriesTextSource1.FieldSeparator := #9;

Posted: Wed May 14, 2008 12:15 pm
by 10546084
I would like to attach an extract of one of the text data files.

Is it possible in this forum.

Thanks.

Posted: Wed May 14, 2008 1:05 pm
by narcis
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.

Posted: Thu May 15, 2008 7:48 am
by 10546084
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

Posted: Thu May 15, 2008 8:33 am
by 10546084
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

Posted: Fri May 16, 2008 1:53 pm
by narcis
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.

Posted: Mon May 19, 2008 8:54 am
by 10546084
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.

Posted: Mon May 19, 2008 9:12 am
by narcis
Hi bamboo,

You can use one single text source and change its properties at runtime as shown on the example here.