Using DBChart with text data

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
Errol
Newbie
Newbie
Posts: 29
Joined: Mon Jul 08, 2019 12:00 am

Using DBChart with text data

Post by Errol » Wed Feb 12, 2020 7:42 pm

Good morning

I use DBChart to access data from a database and/or a memory table, using XValues, YValues and DataSource in TSeries. Now I wish to add a series with the data either in an array or from calculations. Is there a straightforward way to do this, or do I have to populate a memory table with the data points?

Thank you for your attention

Regards

Errol

Marc
Site Admin
Site Admin
Posts: 1263
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Using DBChart with text data

Post by Marc » Fri Feb 14, 2020 10:32 am

Hello Errol,

Yes, you could use code similar to this:

Code: Select all

var vals : array of double;
    i : Integer;
begin
  SetLength(vals, 8);
  for i := 0 to 7 do
     vals[i] := Random(10);

  Series1.AddArray(vals);
end;
You could send x and y arrays to the method:
ie.

Code: Select all

Series1.AddArray(xVals,yVals);
Regards,
Marc
Steema Support

Errol
Newbie
Newbie
Posts: 29
Joined: Mon Jul 08, 2019 12:00 am

Re: Using DBChart with text data

Post by Errol » Mon Feb 17, 2020 7:00 am

Hi Marc
Thanks for the solution to my problem. However, I am trying to plot a closed polygon, and I can only plot values in an increasing-X direction. How can I plot the data in array index order.
Thanks and regards
Errol

Marc
Site Admin
Site Admin
Posts: 1263
Joined: Thu Oct 16, 2003 4:00 am
Location: Girona
Contact:

Re: Using DBChart with text data

Post by Marc » Mon Feb 17, 2020 4:42 pm

Hello Errol,

It sounds like the ValueList Order may be what you need here.

Before you add the data, set:

Code: Select all

Series1.XValues.Order := loNone;
Series1.YValues.Order := loNone;
Regards,
Marc
Steema Support

Errol
Newbie
Newbie
Posts: 29
Joined: Mon Jul 08, 2019 12:00 am

Re: Using DBChart with text data

Post by Errol » Mon Feb 17, 2020 9:32 pm

Thanks Marc

That did the trick. I had set the Orders, but after I had loaded the data.

Best regards

Errol

Post Reply