Example 38: XYZ surface chart (from random points)
This sampe code will plot
a surface chart from any number of random
X/Y/Z points. The library uses Delaunay
triangulation algorithm to achieve this.
Steps:
1. Create a new Windows
application project (VB.NET)
2. Add Super 2d/3d Graph
Library to the toolbox pallete and drag it
to Form1.
3. Copy and paste de
following code:
Form Code
Imports
Super2d3dGraphLibrary
Public
Class
Form1
Private
Sub
Form1_Load(ByVal
sender
As
System.Object,
ByVal e
As
System.EventArgs)
Handles
MyBase.Load
Dim sf
As
New
SeriesFactory
Dim x,
y, z
As
Integer
For x =
0
To 100
Step
5
For z =
0
To 100
Step
5
y = 30 - Math.Sqrt((x - 50) * (x - 50) + (z
- 50) * (z - 50)) + Rnd() * 5
If y < 0
Then
y = 0
End
If
sf.AddPoint(x, y, z)
Next
Next
sf.GenerateMesh()
With
Super2d3dGraph1
.LicenseeIdentifier =
"PROF"
.Title =
"Surface chart from random X/Y/Z points"
.Style =
Super2d3dGraphLibrary.STYLE2D3D.STYLE3D_XYZ_SURFACE_TRIANGLE
.BackStyle =
STYLEBACKGROUND.STYLEBACKGROUND_GRADIENT
.ShowXAxis =
True
.XAxisTitle =
"X-Axis"
.XAxisScaleMaximum
= 100
.XAxisScaleMinimum
= 0
.XAxisScaleMode
= SCALEMODE.SCALEMODE_FIXED
.XAxisNumericFormat
=
"0"
.ShowDividersX =
True
.ShowYAxis =
True
.YAxisTitle =
"Y-Axis"
.YAxisNumericFormat =
"0"
.ShowZAxis =
True
.ZAxisTitle =
"Z-Axis"
.ZAxisScaleMaximum
= 100
.ZAxisScaleMinimum
= 0
.ZAxisScaleMode
= SCALEMODE.SCALEMODE_FIXED
.ZAxisNumericFormat
=
"0"
.ShowDividersZ =
True
.ShowLegend =
False
.ShowValues =
False
.ShowDataTable =
False
.SurfaceBrushStyle =
New
SolidBrush(Color.LightGreen)
.SurfaceBrushMinBrightness
= 30
.SeriesLineStyle
=
New Pen()
{New
Pen(Color.Black)}
sf.ApplyTo(Super2d3dGraph1)
End
With
End
Sub
End
Class
Result:

|