Page 1 of 1
Get Yval from Xval
Posted: Mon Jan 14, 2008 4:41 pm
by 9242178
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
Posted: Mon Jan 14, 2008 5:07 pm
by narcis
Hi John,
You could try using the interpolation example I posted
here?
Hope this helps!
Posted: Mon Jan 14, 2008 5:36 pm
by 9242178
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
Posted: Tue Jan 15, 2008 9:02 am
by narcis
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!
Posted: Tue Jan 15, 2008 5:03 pm
by 9242178
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
Posted: Wed Jan 16, 2008 10:04 am
by narcis
Hi John,
In that case the only solution I can think of is the interpolating example I pointed you.
Posted: Tue Feb 12, 2008 5:03 pm
by 9242178
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
Posted: Wed Feb 13, 2008 11:15 am
by narcis
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?