WPF Charting Documentation - SciChart WPF Charts SDK v5.x
The Non-Uniform SurfaceMesh 3D Type

The surface mesh can also draw data with non-uniform spacing in Z and X with a slight variation in the code. We use a NonUniformGridDataSeries3D and pass X,Z Steppings to the constructor to space out the cells in the X and Z planes.

 

 

<s3D:SciChart3DSurface x:Name="sciChart" WorldDimensions="200,100,200" BorderThickness="0">
    <s3D:SciChart3DSurface.Camera>
        <s3D:Camera3D ZoomToFitOnAttach="True"/>
    </s3D:SciChart3DSurface.Camera>
    <s3D:SciChart3DSurface.RenderableSeries>
        <s3D:SurfaceMeshRenderableSeries3D x:Name="surfaceMeshRenderableSeries"
                                        DrawMeshAs="SolidWireFrame"
                                        Stroke="#77228B22"
                                        ContourStroke="#77228B22"
                                        StrokeThickness="2.0"
                                        DrawSkirt="False"
                                        Opacity="0.9">
           <s3D:SurfaceMeshRenderableSeries.MeshColorPalette>
              <s3D:GradientColorPalette>
                  <s3D:GradientColorPalette.GradientStops>
                     <GradientStop Offset="1" Color="DarkRed"/>
                     <GradientStop Offset="0.9" Color="Red"/>
                     <GradientStop Offset="0.7" Color="Yellow"/>
                     <GradientStop Offset="0.5" Color="GreenYellow"/>
                     <GradientStop Offset="0.3" Color="Cyan"/>
                     <GradientStop Offset="0.1" Color="Blue"/>
                     <GradientStop Offset="0.0" Color="#1D2C6B"/>
                  </s3D:GradientColorPalette.GradientStops>
              </s3D:GradientColorPalette>
           </s3D:SurfaceMeshRenderableSereis.MeshColorPalette>
        </s3D:SurfaceMeshRenderableSeries3D>
    </s3D:SciChart3DSurface.RenderableSeries>
    <s3D:SciChart3DSurface.XAxis>
        <s3D:NumericAxis3D />
    </s3D:SciChart3DSurface.XAxis>
    <s3D:SciChart3DSurface.YAxis>
        <s3D:NumericAxis3D VisibleRange="0,0.3"/>
    </s3D:SciChart3DSurface.YAxis>
    <s3D:SciChart3DSurface.ZAxis>
        <s3D:NumericAxis3D />
    </s3D:SciChart3DSurface.ZAxis>
</s3D:SciChart3DSurface>
int xSize = 25;
int zSize = 25;
var xSteppings = new double[25];
var ySteppings = new double[25];
// Create the stepping information for the X,Z cells
// The X-Z plane exists on the floor of the 3D Chart.
for (int i = 0; i < 25; i++)
{
    xSteppings[i] = Math.Log((i + 1) * 0.01);
    ySteppings[i] = 1 - xSteppings[i];
}
// Create the Nonuniform data series to hold the data
var meshDataSeries = new NonUniformGridDataSeries3D<double>(xSize, zSize, xIndex => xSteppings[xIndex], yIndex => ySteppings[yIndex])
{               
    SeriesName = "Nonuniform Surface Mesh",
};
// Now we populate our heights (The Y-values are up)
for (int x = 0; x < xSize; x++)
{
    for (int z = 0; z < zSize; z++)
    {
        double xVal = (double)x / (double)xSize * 25.0;
        double zVal = (double)z / (double)zSize * 25.0;
        double y = Math.Sin(xVal * 0.2) / ((zVal + 1) * 2);
        meshDataSeries[z, x] = y;
    }
}
// Assign the DataSeries to the chart
surfaceMeshRenderableSeries.DataSeries = meshDataSeries;

 

Data is stored in the NonUniformGridDataSeries3D Type. This represents a 2-dimensional array of arrays (or 2D Jagged array) typically of type Double (but can be defined with generics).

 

Some important points to note:

 

 

See Also

 

 


SCICHART ® is a Registered Trademark in the UK, US and EEC. Copyright SciChart Ltd 2011-2018.

Email us to give feedback!