Get Y value using X date-time value

TeeChart for ActiveX, COM and ASP
Post Reply
Alex
Newbie
Newbie
Posts: 9
Joined: Wed Mar 01, 2006 12:00 am

Get Y value using X date-time value

Post by Alex » Fri Jun 22, 2012 3:18 pm

Hi all,
I would like to obtain Y value using a X date-time value.
Does exist in TeeChart API a method to do this?

Best regards,
Alex

Alex
Newbie
Newbie
Posts: 9
Joined: Wed Mar 01, 2006 12:00 am

Re: Get Y value using X date-time value

Post by Alex » Mon Jun 25, 2012 1:48 pm

After some tests I think TeeChart API performs an interpolation using pixels values and axis values, and that return value is not related to the data series.
Obtain the index related to a given data serie is something easy to achieve using a binary search over data stored in the serie and is quick also(underlinear). So I have done this in my code.
Anyway, if exists a quicker way to do this with the API (using other precalculated data or whatever) it would be great.

Best regards,
Alex

Yeray
Site Admin
Site Admin
Posts: 9612
Joined: Tue Dec 05, 2006 12:00 am
Location: Girona, Catalonia
Contact:

Re: Get Y value using X date-time value

Post by Yeray » Mon Jun 25, 2012 3:29 pm

Hi Alex,

I'm afraid the only way to ensure you get the correct YValue from a given XValue is, as you've found, looking for it manually. Note that there can be several points with the same XValue but different YValue; or there can also be no points in a given XValue.
Of course, depending on the particularities of your values, the search can be optimized, but this example could help you to do what you want.
Best Regards,
ImageYeray Alonso
Development & Support
Steema Software
Av. Montilivi 33, 17003 Girona, Catalonia (SP)
Image Image Image Image Image Image Please read our Bug Fixing Policy

Post Reply