Xceed Chart for WinForms v4.4 Documentation
Mesh Surface

Welcome to Xceed Chart for WinForms v4.4 > User Guide > Series > Surface Series > Mesh Surface

The mesh surface chart displays a surface with user-defined elevation, x-position, and z-position values for each data point. Mesh surface series are created with the MeshSurfaceSeries class. It is derived from the SurfaceSeriesBase class and inherits its functionality. The following figure represents a mesh surface chart. 

Mesh Surface Data

The surface data is managed with the help of an MeshSurfaceData object, which is accessible through the Data property of the MeshSurfaceSeries class. The data is stored in a two-dimensional array of data points, where each data point has an elevation value, an x-position value, and an z-position value. 

The number of surface data points is controlled with the SetGridSize method of the MeshSurfaceData class. It accepts two integer parameters: sizeX (defines the number of data points in the X dimension) and sizeZ (defines the number of data points in the Z dimension). 

The surface data is supplied with the following methods: 

SetValueY: For elevation values.
SetValueX: For X-position values.
SetValueZ: For Z-position values. 

The SetValue method sets all three values at a specified X and Z index. The supplied values must be of type System.Double. If you need to specify an invalid data point at some position you have to use DBNull.Value instead of a double value. The following example creates a mesh surface series with 9 data points (4 segments) and fills it with some data.

VB.NET  

Dim s As MeshSurfaceSeries = CType(chart.Series.Add(SeriesType.MeshSurface), MeshSurfaceSeries)

 

s.FrameStyle = SurfaceFrameStyle.Mesh

 

s.Name = "Mesh Surface"

s.Data.SetGridSize(3, 3)

 

s.Data.SetValue(0, 0, 0.8, 0.0, 1.1)

s.Data.SetValue(1, 0, 0.0, 12.7, 0.0)

s.Data.SetValue(2, 0, 0.0, 17.0, 1.2)

s.Data.SetValue(0, 1, 1.0, 5.0, 12.0)

s.Data.SetValue(1, 1, 1.2, 10.0, 11.0)

s.Data.SetValue(2, 1, 0.5, 18.0, 10.0)

s.Data.SetValue(0, 2, 4.0, 2.1, 22.0)

s.Data.SetValue(1, 2, 2.0, 11.0, 21.0)

s.Data.SetValue(2, 2, 1.3, 20.0, 20.0)

C#  
MeshSurfaceSeries s = (MeshSurfaceSeries)chart.Series.Add(SeriesType.MeshSurface);
s.FrameStyle = SurfaceFrameStyle.Mesh;
s.Name = "Mesh Surface"; 
s.Data.SetGridSize(3, 3);
s.Data.SetValue(0, 0, 0.8, 0.0, 1.1);
s.Data.SetValue(1, 0, 0.0, 12.7, 0.0);
s.Data.SetValue(2, 0, 0.0, 17.0, 1.2);
s.Data.SetValue(0, 1, 1.0, 5.0, 12.0);
s.Data.SetValue(1, 1, 1.2, 10.0, 11.0);
s.Data.SetValue(2, 1, 0.5, 18.0, 10.0);
s.Data.SetValue(0, 2, 4.0, 2.1, 22.0);
s.Data.SetValue(1, 2, 2.0, 11.0, 21.0);
s.Data.SetValue(2, 2, 1.3, 20.0, 20.0);

The following figure displays the generated surface, as well as the order of the X and Z indices in a surface grid. 

The GetValueY, GetValueX, and GetValueZ methods help you read the value at the specified X and Z indices. It returns either an object of type System.Double or DBNull.Value (in case of invalid value). The GridSizeX and GridSizeZ properties can be used to retrieve, respectively, the current X and Z size of the surface data.

Mesh Surface Formatting Commands

The mesh surface series supports two additional formatting commands for tooltip texts.

<xvalue> - X-position value of a data point.
<zvalue> - Z-position value of a data point. 

The formatting of the x-position values is controlled by a ValueFormatting object accessible through the ValueFormattingX property. The formatting of the z-position values is controlled by a ValueFormatting object accessible through the ValueFormattingZ property.

Related Examples

Windows Forms: Series\Mesh Surface\General
Windows Forms: Series\Mesh Surface\Intersected Surfaces
Windows Forms: Series\Mesh Surface\Empty Data Points
Windows Forms: Series\Mesh Surface\Fill Effect

See Also

SurfaceSeriesBase | MeshSurfaceSeries | Common Surface Functionality