Page 1 of 1

Getting Z values from ColorGrid

Posted: Thu Apr 07, 2005 3:28 pm
by 6925645
I have a colorgrid control and now want to extract a horizontal and vertical cross section from the plotted data. How does one extract all the Z values from a whole row and all the Z values from a column.

On another note, why does the colorgrid controls axes seem to be the wrong orientation. When I look at the control I would expect X to be horizontal, Y to be vertical and Z to be the intensity. But in reality X is
horizonal, Z is vertical and Y is the intensity.

Posted: Fri Apr 08, 2005 9:54 am
by narcis
Hi John,
I have a colorgrid control and now want to extract a horizontal and vertical cross section from the plotted data. How does one extract all the Z values from a whole row and all the Z values from a column.
Yes, this can be done using some code like:

Code: Select all

Private Sub Form_Load()
    TChart1.Series(0).FillSampleValues 10
    
    Label1.Caption = ""
    Label2.Caption = ""
End Sub

Private Sub TChart1_OnClickSeries(ByVal SeriesIndex As Long, ByVal ValueIndex As Long, ByVal Button As TeeChart.EMouseButton, ByVal Shift As TeeChart.EShiftState, ByVal X As Long, ByVal Y As Long)
    
    Label1.Caption = "Row Z Values: "
    Label2.Caption = "Col. Z Values: "
    
    Dim xval, zval As Integer
    
    xval = TChart1.Series(SeriesIndex).XValues.Value(ValueIndex)
    zval = TChart1.Series(SeriesIndex).asColorGrid.ZValues.Value(ValueIndex)
    
    For i = 0 To TChart1.Series(SeriesIndex).Count - 1
    
        If TChart1.Series(SeriesIndex).XValues.Value(i) = xval Then
            Label2.Caption = Label2.Caption + " " _
                + CStr(TChart1.Series(SeriesIndex).asColorGrid.ZValues.Value(i))
        End If
        
        If TChart1.Series(SeriesIndex).asColorGrid.ZValues.Value(i) = zval Then
            Label1.Caption = Label1.Caption + " " _
                + CStr(TChart1.Series(SeriesIndex).asColorGrid.ZValues.Value(i))
        End If
        
    Next i
End Sub
On another note, why does the colorgrid controls axes seem to be the wrong orientation. When I look at the control I would expect X to be horizontal, Y to be vertical and Z to be the intensity. But in reality X is
horizonal, Z is vertical and Y is the intensity.
The TeeChart 3D series work on a grid that has a Y=Y(X,Z) format.