.Locate funtion is not precise
Posted: Fri Jan 09, 2004 11:10 am
TeeChart Pro v6.0.0.4
I use Annotation Tool with Pointer to manually show the current value of series on MouseMove event. I ve got a series (scLine) with values range: 10-30 on X and 0.123-0.125 on Y. Furthermore this is quite steep line on the screen.
I pass XY mouse coordinates to my function in witch I use following:
idx = TChart.Series(0).XValues.Locate(Round(TChart.Series(0).XScreenToValue(X)))
ValueX = TChart.Series(0).XScreenToValue(X)
ValueY = TChart.Series(0).YValues.Value(idx)
With TChart.Tools(0).asAnnotation.Callout
.XPosition = X
.YPosition = TChart.Series(0).CalcYPos(idx)
End with
The problem is:
I cannot pass double with decimal places to .Locate function because the return value is always -1. Only integer numbers are accepted. Therefore I use Round() function. Of course this is not sufficient.
The problem produce the effect of pointer step walking on screen.
Furthermore I checked the following:
TChart.Series(0).XValues.Value(mIndex)
where mIndex was eg. 338,339,340,...
This does not return numbers with decimal places eg. for mIndex range of 339-348 function returns the same value 26 and beyond 348 returns 27 and so on.
I tested also Cursor Tool and the problem is similar. XVal returns only integer numbers.
I need to show pointer precisely. Any ideas?
Thanks.
Andrzej
I use Annotation Tool with Pointer to manually show the current value of series on MouseMove event. I ve got a series (scLine) with values range: 10-30 on X and 0.123-0.125 on Y. Furthermore this is quite steep line on the screen.
I pass XY mouse coordinates to my function in witch I use following:
idx = TChart.Series(0).XValues.Locate(Round(TChart.Series(0).XScreenToValue(X)))
ValueX = TChart.Series(0).XScreenToValue(X)
ValueY = TChart.Series(0).YValues.Value(idx)
With TChart.Tools(0).asAnnotation.Callout
.XPosition = X
.YPosition = TChart.Series(0).CalcYPos(idx)
End with
The problem is:
I cannot pass double with decimal places to .Locate function because the return value is always -1. Only integer numbers are accepted. Therefore I use Round() function. Of course this is not sufficient.
The problem produce the effect of pointer step walking on screen.
Furthermore I checked the following:
TChart.Series(0).XValues.Value(mIndex)
where mIndex was eg. 338,339,340,...
This does not return numbers with decimal places eg. for mIndex range of 339-348 function returns the same value 26 and beyond 348 returns 27 and so on.
I tested also Cursor Tool and the problem is similar. XVal returns only integer numbers.
I need to show pointer precisely. Any ideas?
Thanks.
Andrzej