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 | |
---|---|
|
C# | |
---|---|
MeshSurfaceSeries s = (MeshSurfaceSeries)chart.Series.Add(SeriesType.MeshSurface); s.FrameStyle = SurfaceFrameStyle.Mesh; s.Name = "Mesh Surface"; s.Data.SetValue(0, 0, 0.8, 0.0, 1.1); |
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