Page 1 of 1

Have a problem with 3d surface plot in .net 2003

Posted: Wed Jul 26, 2006 2:31 pm
by 8119969
I add a chart

add a 3d surface plot

in a button click event

I process the following code

Dim a As Integer
Dim b As Integer
Dim c As Integer
For a = 0 To 9
For b = 0 To 9
For c = 0 To 9
TChart1.Series(0).Add(a, b, c)
Next
Next
Next

I get no plot. I made no changes to the chart other than adding a 3d surface series.

any ideas what I am doing wrong

Posted: Wed Jul 26, 2006 3:06 pm
by narcis
Hi John,

This is because you should type cast the series so that an Add(X,Y,Z) method for surface series is recognised.

However, please notice that surface series need to have a grid structure where columns are defined by x values, rows by z values and each cell value is defined by y values. If x and z values are not equidistant you should also set the IrregularGrid property to true. According to this the working code could be something like this:

Code: Select all

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim a As Integer
        'Dim b As Integer
        Dim c As Integer

        Dim b As New Random

        For a = 0 To 9
            'For b = 0 To 9
            For c = 0 To 9
                Surface1.Add(a, b.Next(), c)

                'or
                'CType(TChart1.Series(0), Steema.TeeChart.Styles.Surface).Add(a, b.Next(), c)
            Next
            'Next
        Next
    End Sub