Page 1 of 1
Get Y value using X date-time value
Posted: Fri Jun 22, 2012 3:18 pm
by 9530490
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
Re: Get Y value using X date-time value
Posted: Mon Jun 25, 2012 1:48 pm
by 9530490
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
Re: Get Y value using X date-time value
Posted: Mon Jun 25, 2012 3:29 pm
by yeray
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.