SciChart® the market leader in Fast WPF Charts, WPF 3D Charts, iOS Chart, Android Chart and JavaScript Chart Components
Please note! These examples are new to SciChart Mobile v3 release! SciChart iOS & Android ship with Xamarin.iOS and Xamarin.Android bindings around our native iOS & Android Chart controls, allowing you to create fast & feature rich charts to your Xamarin applications. We include ~90 native iOS examples and 90 Android examples, but now also ~60 Xamarin Chart Examples to help you get started with SciChart. You can download the source for our Xamarin Chart Examples from Github, or browse the source code below.
This example showcases how to add Contours Meshes to the floor and ceiling in 3D with Xamarin.iOS and Xamarin.Android.
See more in the documentation:Create a 3D Chart with Xamarin.AndroidCreate a 3D Chart with Xamarin.iOSContours and Wireframe on a Surface Meshes 3D Chart Type in AndroidContours and Wireframe on a Surface Meshes 3D Chart Type in iOS
The C#/Xamarin.iOS/Xamarin.Android source code for the Xamarin Surface Mesh Floor and Ceiling 3D Chart example is included below (Scroll down!).
Did you know you can also view the source code from one of the following sources as well?
using SciChart.iOS.Charting;
using Xamarin.Examples.Demo.Utils;
namespace Xamarin.Examples.Demo.iOS
{
[Example3DDefinition("Surface Mesh 3D Floor Ceiling", description: "Add Contour Meshes to the Floor and Ceiling", icon: ExampleIcon.Surface3D)]
class SurfaceMeshFloorAndCeiling3DChartViewController : SingleChartViewController<SCIChartSurface3D>
{
protected override void InitExample()
{
const int xSize = 11;
const int zSize = 4;
var dataSeries3D = new UniformGridDataSeries3D<double, double, double>(xSize, zSize) { StartX = 0, StepX = 0.09, StartZ = 0, StepZ = 0.75 };
var data = new double[,]
{
{-1.43, -2.95, -2.97, -1.81, -1.33, -1.53, -2.04, 2.08, 1.94, 1.42, 1.58},
{1.77, 1.76, -1.1, -0.26, 0.72, 0.64, 3.26, 3.2, 3.1, 1.94, 1.54},
{0, 0, 0, 0, 0, 3.7, 3.7, 3.7, 3.7, -0.48, -0.48},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
for (int z = 0; z < zSize; z++)
{
for (int x = 0; x < xSize; x++)
{
dataSeries3D.UpdateYAt(x, z, data[z, x]);
}
}
var colors = new[] { 0xFF1D2C6B, ColorUtil.Blue, ColorUtil.Cyan, ColorUtil.GreenYellow, ColorUtil.Yellow, ColorUtil.Red, ColorUtil.DarkRed };
var stops = new[] { 0, .1f, .2f, .4f, .6f, .8f, 1 };
var rs0 = new SCISurfaceMeshRenderableSeries3D
{
DataSeries = dataSeries3D,
HeightScaleFactor = 0,
DrawMeshAs = SCIDrawMeshAs.SolidWireframe,
Stroke = 0xFF228B22,
StrokeThickness = 1f,
Maximum = 4,
MeshColorPalette = new SCIGradientColorPalette(colors, stops),
Opacity = 0.7f
};
var rs1 = new SCISurfaceMeshRenderableSeries3D
{
DataSeries = dataSeries3D,
DrawMeshAs = SCIDrawMeshAs.SolidWireframe,
Stroke = 0xFF228B22,
StrokeThickness = 1f,
Maximum = 4,
DrawSkirt = false,
MeshColorPalette = new SCIGradientColorPalette(colors, stops),
Opacity = 0.9f
};
var rs2 = new SCISurfaceMeshRenderableSeries3D
{
DataSeries = dataSeries3D,
HeightScaleFactor = 0,
DrawMeshAs = SCIDrawMeshAs.SolidWireframe,
Stroke = 0xFF228B22,
StrokeThickness = 1f,
Maximum = 4,
YOffset = 400,
MeshColorPalette = new SCIGradientColorPalette(colors, stops),
Opacity = 0.7f
};
using (Surface.SuspendUpdates())
{
Surface.XAxis = new SCINumericAxis3D { MaxAutoTicks = 7 };
Surface.YAxis = new SCINumericAxis3D { VisibleRange = new SCIDoubleRange(-4, 4) };
Surface.ZAxis = new SCINumericAxis3D();
Surface.RenderableSeries.Add(rs0);
Surface.RenderableSeries.Add(rs1);
Surface.RenderableSeries.Add(rs2);
Surface.ChartModifiers.Add(new SCIPinchZoomModifier3D());
Surface.ChartModifiers.Add(new SCIOrbitModifier3D());
Surface.ChartModifiers.Add(new SCIZoomExtentsModifier3D { ResetPosition = new SCIVector3(-1300, 1300, -1300) });
Surface.Camera = new SCICamera3D { Position = new SCIVector3(-1300, 1300, -1300) };
Surface.WorldDimensions = new SCIVector3(1100, 400, 400);
}
}
}
}
using SciChart.Charting3D.Common.Math;
using SciChart.Charting3D.Model;
using SciChart.Charting3D.Model.DataSeries.Grid;
using SciChart.Charting3D.Modifiers;
using SciChart.Charting3D.Visuals;
using SciChart.Charting3D.Visuals.Axes;
using SciChart.Charting3D.Visuals.Camera;
using SciChart.Charting3D.Visuals.RenderableSeries.Data;
using SciChart.Charting3D.Visuals.RenderableSeries.SurfaceMesh;
using SciChart.Data.Model;
using Xamarin.Examples.Demo;
using System.Drawing;
using Xamarin.Examples.Demo.Droid.Extensions;
using Xamarin.Examples.Demo.Droid.Fragments.Base;
namespace Xamarin.Examples.Demo.Droid.Fragments.Examples3D
{
[Example3DDefinition("Surface Mesh 3D Floor Ceiling", description: "Add Contour Meshes to the Floor and Ceiling", icon: ExampleIcon.Surface3D)]
class SurfaceMeshFloorAndCeiling3DChartFragment : ExampleBaseFragment
{
public SciChartSurface3D Surface => View.FindViewById<SciChartSurface3D>(Resource.Id.chart3d);
public override int ExampleLayoutId => Resource.Layout.Example_Single_3D_Chart_Fragment;
protected override void InitExample()
{
const int xSize = 11;
const int zSize = 4;
var dataSeries3D = new UniformGridDataSeries3D<double, double, double>(xSize, zSize)
{
StartX = 0,
StepX = 0.09,
StartZ = 0,
StepZ = 0.75
};
var data = new double[,]{
{-1.43, -2.95, -2.97, -1.81, -1.33, -1.53, -2.04, 2.08, 1.94, 1.42, 1.58},
{1.77, 1.76, -1.1, -0.26, 0.72, 0.64, 3.26, 3.2, 3.1, 1.94, 1.54},
{0, 0, 0, 0, 0, 3.7, 3.7, 3.7, 3.7, -0.48, -0.48},
{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
};
for (int z = 0; z < zSize; z++)
{
for (int x = 0; x < xSize; x++)
{
dataSeries3D.UpdateYAt(x, z, data[z, x]);
}
}
var colors = new Color[] { Color.FromArgb(0x1D, 0x2C, 0x6B), Color.Blue, Color.Cyan, Color.GreenYellow, Color.Yellow, Color.Red, Color.DarkRed };
var stops = new float[] { 0, .1f, .2f, .4f, .6f, .8f, 1 };
var rs0 = new SurfaceMeshRenderableSeries3D()
{
DataSeries = dataSeries3D,
HeightScaleFactor = 0,
DrawMeshAs = DrawMeshAs.SolidWireframe,
StrokeColor = Color.FromArgb(0x22, 0x8B, 0x22),
StrokeThickness = 1f.ToDip(Activity),
Maximum = 4,
MeshColorPalette = new GradientColorPalette(colors, stops),
Opacity = 0.7f
};
var rs1 = new SurfaceMeshRenderableSeries3D()
{
DataSeries = dataSeries3D,
DrawMeshAs = DrawMeshAs.SolidWireframe,
StrokeColor = Color.FromArgb(0x22, 0x8B, 0x22),
StrokeThickness = 1f.ToDip(Activity),
Maximum = 4,
DrawSkirt = false,
MeshColorPalette = new GradientColorPalette(colors, stops),
Opacity = 0.9f
};
var rs2 = new SurfaceMeshRenderableSeries3D()
{
DataSeries = dataSeries3D,
HeightScaleFactor = 0,
DrawMeshAs = DrawMeshAs.SolidWireframe,
StrokeColor = Color.FromArgb(0x22, 0x8B, 0x22),
StrokeThickness = 1f.ToDip(Activity),
Maximum = 4,
YOffset = 400,
MeshColorPalette = new GradientColorPalette(colors, stops),
Opacity = 0.7f
};
using (Surface.SuspendUpdates())
{
Surface.WorldDimensions.Assign(1100, 400, 400);
Surface.XAxis = new NumericAxis3D() { MaxAutoTicks = 7 };
Surface.YAxis = new NumericAxis3D() { VisibleRange = new DoubleRange(-4, 4) };
Surface.ZAxis = new NumericAxis3D();
Surface.Camera = new Camera3D() { Position = new Vector3(-1300, 1300, -1300) };
Surface.RenderableSeries.Add(rs0);
Surface.RenderableSeries.Add(rs1);
Surface.RenderableSeries.Add(rs2);
Surface.ChartModifiers = new ChartModifier3DCollection
{
new PinchZoomModifier3D(),
new OrbitModifier3D(),
new ZoomExtentsModifier3D() { ResetPosition = new Vector3(-1300, 1300, -1300)}
};
}
}
}
}