Page 1 of 1

Not able to Get Values at cursor position

Posted: Tue Nov 15, 2011 9:24 am
by 15055359
Hi,

We are BNF Technology Inc.
We have a licnese of Teechart Activex Version 8.0.0.7.

I am not able to get label member at Bottom Axis and value member on left axis on OnCursorToolChange event.
can you please help that how can i get those values.

My Bottom Axis lable member is Datetime.

Thanks in Advance.

TR,
BNF Technology Inc.

Re: Not able to Get Values at cursor position

Posted: Tue Nov 15, 2011 4:46 pm
by yeray
Hello,

You probably missed to convert from pixels to axis coordinates with CalcPosPoint function. The following seems to work fine for me here:

Code: Select all

Private Sub TChart1_OnCursorToolChange(ByVal Tool As Long, ByVal X As Long, ByVal Y As Long, ByVal XVal As Double, ByVal YVal As Double, ByVal Series As Long, ByVal ValueIndex As Long)
  With TChart1.Axis
    TChart1.Header.Text.Text = "X: " + Str$(.Bottom.CalcPosPoint(X)) + ", Y: " + Str$(.Left.CalcPosPoint(Y))
  End With
End Sub

Re: Not able to Get Values at cursor position

Posted: Wed Nov 16, 2011 9:16 am
by 15055359
Hello,

Thanks for your early reply. But still my problem is not resolved.

In attachment, you can see the Chart in which
Left Axis is Value Member
Bottom Axis is Lable Member which is datetime.

Now the problem is that i am not able to get the Bottom AXIS LABEL TEXT at any Cursor position on OnCursorToolChange event.

i am using VBScript in which i have written OnCursorToolChange event.
in that event i tried following thing but none of that has given me the solution.

as per your suggession i tried the first one,

1. form1.TChart1.Header.Text.Text = "X: " + Str$(.Bottom.CalcPosPoint(X)) + ", Y: " + Str$(.Left.CalcPosPoint(Y))
but Str$ is not workign in VBScript that is for VB.Net.

2. I have also created TChart1_OnCursorToolChange Event in C# code but that event is not executed on CursorToolChange..i dont know why.

3. form1.TChart1.GetLabelsSeries(0).get_PointLabel(0) // not working in VBScript

4. index = form1.TChart1.Series(0).Count - 1
TChart1.Series(0).XValues.Value(index)// i am getting unspecified exception

5. form1.TChart1.Header.Text.Text=InterpolateLineSeries(0, form1.TChart1.Series(0).FirstValueIndex, form1.TChart1.Series(0).LastValueIndex, XVal)
using this 5th one, i am getting Yvalue of Series at cursor postion..but i am still not getting that how can i get Xvalue at Cursor position.

Can u please help me to display Xvalue member(DateTime) onCursorToolChange Event using VBScript.
Thanks in advance.

Re: Not able to Get Values at cursor position

Posted: Mon Nov 21, 2011 8:43 pm
by yeray
Hello,

Excuse us for the delayed reply here.
BNF Tech Inc. wrote:1. form1.TChart1.Header.Text.Text = "X: " + Str$(.Bottom.CalcPosPoint(X)) + ", Y: " + Str$(.Left.CalcPosPoint(Y))but Str$ is not workign in VBScript that is for VB.Net.
In VBScript the integers are converted to strings automatically.
BNF Tech Inc. wrote:2. I have also created TChart1_OnCursorToolChange Event in C# code but that event is not executed on CursorToolChange..i dont know why.
Find attached a simple ASP example using the TChart1_OnCursorToolChange event.
AXtestASP.zip
(1.45 KiB) Downloaded 1336 times
BNF Tech Inc. wrote:3. form1.TChart1.GetLabelsSeries(0).get_PointLabel(0) // not working in VBScript
To get the top label from the left axis you could use this:

Code: Select all

TChart1.Axis.Left.Labels.Item(0).Text
BNF Tech Inc. wrote:4. index = form1.TChart1.Series(0).Count - 1 TChart1.Series(0).XValues.Value(index)// i am getting unspecified exception
I can put this, for example in the OnDoubleClick event and shows "Last X Value: 24" as expected:

Code: Select all

TChart1.Header.Text.Text = "Last X Value: " & (TChart1.Series(0).XValues.Value(TChart1.Series(0).Count - 1))
BNF Tech Inc. wrote:5. form1.TChart1.Header.Text.Text=InterpolateLineSeries(0, form1.TChart1.Series(0).FirstValueIndex, form1.TChart1.Series(0).LastValueIndex, XVal) using this 5th one, i am getting Yvalue of Series at cursor postion..but i am still not getting that how can i get Xvalue at Cursor position.
I think you are complicating things more than necessary. Checking the OnCursorToolChange event definition to be as in the example attached above will probably make it work.