Hi,
I need to get the y-values (the intensity) of several color grid series within my chart. Given values are Mouse x-coordinate and fix Z index.
First I thought getxzvalues might by the right method, but that doesn't work .
Kind regards,
Jan
Determine Y-values in a colorgrid series
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Jan,
You can use something like this code:
You can use something like this code:
Code: Select all
Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
Dim ValueIndex As Integer
For i = 0 To TChart1.SeriesCount - 1
ValueIndex = TChart1.Series(i).Clicked(X, Y)
If ValueIndex <> -1 Then
List1.AddItem CStr(TChart1.Series(i).YValues.Value(ValueIndex))
End If
Next
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Clicked does the trick, only one additional problem
My colorgrids have 64 lines (z-value). In order to use your code, I have to find out the y-coordinate of one of these lines (for the "clicked" method). Can you help there as well?
Thanks in advance,
Jan
Thanks in advance,
Jan
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Jan,
Once you retrieve the point where the mouse is (ValueIndex in my snippet) you can retrieve any value for this point, for example:
Once you retrieve the point where the mouse is (ValueIndex in my snippet) you can retrieve any value for this point, for example:
Code: Select all
Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
Dim ValueIndex As Integer
List1.Clear
For i = 0 To TChart1.SeriesCount - 1
ValueIndex = TChart1.Series(i).Clicked(X, Y)
If ValueIndex <> -1 Then
List1.AddItem "X: " & CStr(TChart1.Series(i).XValues.Value(ValueIndex))
List1.AddItem "Y: " & CStr(TChart1.Series(i).YValues.Value(ValueIndex))
List1.AddItem "Z: " & CStr(TChart1.Series(i).asColorGrid.ZValues.Value(ValueIndex))
End If
Next
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |
Some more details
Hi Narcís,
I should have told you, that these colorgrid series I ues are on different custom axis. The bottom axis represents the timeline, so no matter over which color grid the mouse is actually, I need to display the values of all colorgrids. The Y Value of the OnMouseMove Event is often outside of the series, so .clicked (x,y) would return -1.
Thanks for your fast answers.
Kind regards,
Jan
I should have told you, that these colorgrid series I ues are on different custom axis. The bottom axis represents the timeline, so no matter over which color grid the mouse is actually, I need to display the values of all colorgrids. The Y Value of the OnMouseMove Event is often outside of the series, so .clicked (x,y) would return -1.
Thanks for your fast answers.
Kind regards,
Jan
-
- Site Admin
- Posts: 14730
- Joined: Mon Jun 09, 2003 4:00 am
- Location: Banyoles, Catalonia
- Contact:
Hi Jan,
Ok, then try doing something like this:
Ok, then try doing something like this:
Code: Select all
Private Sub TChart1_OnMouseMove(ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
Dim ValueIndex, XVal As Integer
Dim HorizAxis As TeeChart.IAxis
List1.Clear
For i = 0 To TChart1.SeriesCount - 1
Select Case TChart1.Series(i).HorizontalAxis
Case 0 'aTopAxis = 0
Set HorizAxis = TChart1.Axis.Top
Case 1, 2 'aBottomAxis = 1, aBothHorizAxis = 2
Set HorizAxis = TChart1.Axis.Bottom
Case 3 'aCustomHorizAxis = 3
Set HorizAxis = TChart1.Axis.Custom(TChart1.Series(i).HorizontalAxisCustom)
End Select
XVal = HorizAxis.CalcPosPoint(X)
ValueIndex = TChart1.Series(i).XValues.Locate(XVal)
If ValueIndex <> -1 Then
List1.AddItem "X: " & CStr(TChart1.Series(i).XValues.Value(ValueIndex))
List1.AddItem "Y: " & CStr(TChart1.Series(i).YValues.Value(ValueIndex))
List1.AddItem "Z: " & CStr(TChart1.Series(i).asColorGrid.ZValues.Value(ValueIndex))
End If
Next
End Sub
Best Regards,
Narcís Calvet / Development & Support Steema Software Avinguda Montilivi 33, 17003 Girona, Catalonia Tel: 34 972 218 797 http://www.steema.com |
Instructions - How to post in this forum |