Add point at the end of the serie

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Add point at the end of the serie

Post by franckgar » Tue Mar 08, 2005 9:42 am

Hi,

I want to add new X,Y points at the end of a serie. So I tried the function AddXY() ..... but it does not work correctly because this function insert points and not add points at the end of the serie.
Is there a function which I could used to do it simply ?

Thanks!
Franck
franckgar

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 Mar 08, 2005 9:46 am

Hi Franck,

Yes, you can use Series.Add(...). This method inserts new Series points when you do not have an X Value for the point. The new point added with the Add method only has Y values. The X values are automatically calculated (sequential index of 0,1,2,3,4..etc).
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

franckgar
Advanced
Posts: 109
Joined: Thu Nov 04, 2004 5:00 am

Post by franckgar » Tue Mar 08, 2005 12:00 pm

I can't use the function Series.Add(...) because I must add points with X and Y defined by a previous function. Is there any other solution ?

Franck

Marjan
Site Admin
Site Admin
Posts: 745
Joined: Fri Nov 07, 2003 5:00 am
Location: Slovenia
Contact:

Post by Marjan » Thu Mar 10, 2005 7:27 am

I can't use the function Series.Add(...) because I must add points with X and Y defined by a previous function. Is there any other solution ?
I'd use AddXY method to add point with specific (x,y) coordinate. The AddXY method does *not* insert a point in the chartlist(s) arrays, but it adds it to the end of the array. But if your newly added point x value is smaller than maximum x value then the end result (on screen) will be your newly added point won't be connected to it's predecessor. To fix this problem (override default behavoir), all you must do is set series XValues.Order property to loNone *before* you start adding points to series. In this case the points will be connected in the same order as they are added to series:

Code: Select all

// draw parametric plot
Series1.XValues.Order := loNone;
Series1.AddXY(2,3);
Series1.AddXY(1,5);
Series1.AddXY(2.3,3);
Series1.AddXY(2.2,-1);
Marjan Slatinek,
http://www.steema.com

Post Reply