Get Yval from Xval

TeeChart VCL for Borland/CodeGear/Embarcadero RAD Studio, Delphi and C++ Builder.
Post Reply
John
Newbie
Newbie
Posts: 26
Joined: Fri Aug 11, 2006 12:00 am

Get Yval from Xval

Post by John » Mon Jan 14, 2008 4:41 pm

Hi,
How can I get yval from another series xval? For example, if I have two series,
Series1->AddXY(0, 0);
Series1->AddXY(.25, 1);
With what function return a yval I want to get from Series1's yvals in the range 0 to .25 for Series2 or if I want to get a yvalue from Series1 at x = 0.20, what can I do?

Thanks
John

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 Jan 14, 2008 5:07 pm

Hi John,

You could try using the interpolation example I posted here?

Hope this helps!
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

John
Newbie
Newbie
Posts: 26
Joined: Fri Aug 11, 2006 12:00 am

Post by John » Mon Jan 14, 2008 5:36 pm

Hi Narcís,

Thanks for a quick response. The example in the link seems too slow for me to search for a point from a series. Let say for each quarter of second(250 msecs) I have to show:

Series 1 has two points:
x1 = 0.0 y1= 0.0
x2 = 0.25 y2= 3.456

Series2 has 6000 points:
x2 = 0.0 y2 = y1(at x2) + a random number
...
x2 = 0.25 y2 = y1(at x2) + a random number

Does tchart has something like float y1 = Series1->GetY(x2) so I don't need to go through a loop to find out the value of index first.

Thanks
John

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 Jan 15, 2008 9:02 am

Hi John,

Ok, in that case you can try doing something like this:

Code: Select all

  index:=Series1.XValues.Locate(x2);
  y1:=Series1.YValue[index];
Hope this helps!
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

John
Newbie
Newbie
Posts: 26
Joined: Fri Aug 11, 2006 12:00 am

Post by John » Tue Jan 15, 2008 5:03 pm

Hi Narcís,

If I have line series with only two points. Let say
x1 = 0.0 y1= 0.0
x2 = 0.25 y2= 3.456

The question is how I can do to get Y VALUE at x = 0.1 or x = 0.2 or x = 0.21 or at any x value in the range from x = 0.0 to x 0.25?

Thanks for your help
John

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 Jan 16, 2008 10:04 am

Hi John,

In that case the only solution I can think of is the interpolating example I pointed you.
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

John
Newbie
Newbie
Posts: 26
Joined: Fri Aug 11, 2006 12:00 am

Post by John » Tue Feb 12, 2008 5:03 pm

Hi Narcís,

Could you explain more about this. I could not read the Delphi code from the link you gave me. Do you have C++ source code for this example?

Regards,
John

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 Feb 13, 2008 11:15 am

Hi John,

This example basically consists on interpolating series's y values from cursor's XValue. For this interpolation, the series's points before and after the cursor's position are used.

We don't have a C++ example of this at the moment. Are you having any specific problem porting the code?
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