Page 1 of 1

Importing text data - many series

Posted: Sun Dec 17, 2006 12:42 pm
by 9242699
Dear all

I'm having trouble importing data from text file. I am aware there is a tutorial on how to import ONE series from file (http://www.teechart.net/reference/modul ... cle&sid=10) but I cannot figure out how to import MULTIPLE series from a SINGLE flat file.
Would anyone have an idea or even better a sample code on how to accomplish that ?

A related problem (I probably will have to issue another thread, but I mention it here anyway as it is closely related) is how to import data not from text but from a binary file.
An example is given in the demo "BigFlatFile.exe" - but again, this is designed for only one and not multiple series.

Every help is highly appreciated.

Posted: Mon Dec 18, 2006 10:12 am
by narcis
Hi dr. vodca,
I'm having trouble importing data from text file. I am aware there is a tutorial on how to import ONE series from file (http://www.teechart.net/reference/modul ... cle&sid=10) but I cannot figure out how to import MULTIPLE series from a SINGLE flat file.
Would anyone have an idea or even better a sample code on how to accomplish that ?
You can populate multiple series from a single text file provided you set different file columns for each series Y values.
A related problem (I probably will have to issue another thread, but I mention it here anyway as it is closely related) is how to import data not from text but from a binary file.
An example is given in the demo "BigFlatFile.exe" - but again, this is designed for only one and not multiple series.
The same would apply as in the previous question.

Posted: Mon Dec 18, 2006 7:56 pm
by 9242699
Dear NarcĂ­s

I hate to say that, but I'm still struggeling with the basics. would you also have a little piece of code I could chew on, for adding at least 2 line series from text file (by code) ?

I would reeeealy appreciate.

cheers
stefano

Posted: Tue Dec 19, 2006 9:29 am
by narcis
Hi stefano,

Yes, you can do something like this:

Code: Select all

procedure TForm1.FormCreate(Sender: TObject);
begin
   With SeriesTextSource1 do
    begin
      HeaderLines:=0;
      FieldSeparator:=',';
      Fields.Clear;
      AddField('X',1);
      AddField('Bar',2);
      AddField('Text',4);
      Series:=Series1;
      LoadFromFile('c:\temp\test.txt');
    end;

   With SeriesTextSource2 do
    begin
      HeaderLines:=0;
      FieldSeparator:=',';
      Fields.Clear;
      AddField('X',1);
      AddField('Bar',3);
      AddField('Text',4);
      Series:=Series2;
      LoadFromFile('c:\temp\test.txt');
    end;
end;

Posted: Tue Dec 19, 2006 5:14 pm
by 9242699
Hi Narcis

Thanks, this is a hint - now I understand that with seriestextsource it is necessary to create a new "source" for every series. I was presuming that you could accomplish that with only one.

Cheers
Stefano