Page 1 of 1

color grid or surface that has N grid cells (not N-1)

Posted: Mon Feb 14, 2005 7:08 pm
by 6927067
I am trying to make a color grid. I have a matrix of data with regular intervals. That is, the matrix looks like:

x11 x12 ... x1N
x21 x22 ... x2N
.. .. ..
xM1 xM2 ... xMN

I am basically trying to get a colored picture of the matrix, that is a grid that is NxM where each grid cell is colored according to the corresponging xij value.

The surface and color grid options in TeeChart create a surface with M-1 X N-1 grid cells. Each point, xij, therefore is a corner of on of the grid cells.

Is there any way to create the type of grid that I want?

Steve Bourne

Posted: Tue Feb 15, 2005 8:54 am
by narcis
Hi Steve,

There's only one way to fill ColorGrid series with data. As it has X,Y and Z values, the only "random" value is Y, X and Z have to be regular. You can see examples of this at the TeeChart features demo included with the installation. If you have search for the "ColorGrid Marks" example and click on "Edit Marks" and then click on the "Data" tab you will see how data works for this series type.

The TeeChart 3D series work on a grid that has a Y=Y(X,Z) format, meaning that data can be added in the following fashion:

Code: Select all

Private Sub Form_Load()
Dim x, y, z
TeeCommander1.Chart = TChart1
With TChart1
    .AddSeries scSurface
    y = 0
    For x = 0 To 15
        For z = 0 To 255
            If z Mod 35 = 0 Then
                y = y + 1
            End If
            .Series(0).asSurface.AddXYZ x, y, z, "", clTeeColor
        Next z
    Next x
End With
End Sub