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 is an example of the Uniform Mesh 3D Chart created with SciChart Xamarin.iOS and Xamarin.Android provided by SurfaceMesh renderable series.
See more in the documentation:Create a 3D Chart with Xamarin.AndroidCreate a 3D Chart with Xamarin.iOSThe Surface Mesh 3D Chart Type in Android The Surface Mesh 3D Chart Type in iOS
The C#/Xamarin.iOS/Xamarin.Android source code for the Xamarin Simple Uniform Mesh 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 System;
using SciChart.iOS.Charting;
using Xamarin.Examples.Demo.Utils;
namespace Xamarin.Examples.Demo.iOS
{
[Example3DDefinition("Uniform Mesh 3D Chart", description: "Create a simple Uniform Mesh 3D Chart", icon: ExampleIcon.Surface3D)]
class CreateUniformMesh3DChartViewController : SingleChartViewController<SCIChartSurface3D>
{
protected override void InitExample()
{
const int xSize = 25;
const int zSize = 25;
var dataSeries3D = new UniformGridDataSeries3D<double, double, double>(xSize, zSize);
for (int x = 0; x < xSize; x++)
{
for (int z = 0; z < zSize; z++)
{
var xVal = 25.0 * x / xSize;
var zVal = 25.0 * z / zSize;
var y = Math.Sin(xVal * .2) / ((zVal + 1) * 2);
dataSeries3D.UpdateYAt(x, z, y);
}
}
var rSeries3D = new SCISurfaceMeshRenderableSeries3D
{
DataSeries = dataSeries3D,
DrawMeshAs = SCIDrawMeshAs.SolidWireframe,
Stroke = 0x77228B22,
ContourStroke = 0x77228B22,
StrokeThickness = 2f,
DrawSkirt = false,
MeshColorPalette = new SCIGradientColorPalette(
new[] { ColorUtil.Sapphire, ColorUtil.Blue, ColorUtil.Cyan, ColorUtil.GreenYellow, ColorUtil.Yellow, ColorUtil.Red, ColorUtil.DarkRed },
new[] { 0, .1f, .3f, .5f, .7f, .9f, 1 })
};
using (Surface.SuspendUpdates())
{
Surface.XAxis = new SCINumericAxis3D { GrowBy = new SCIDoubleRange(0.1, 0.1) };
Surface.YAxis = new SCINumericAxis3D { VisibleRange = new SCIDoubleRange(0, .3) };
Surface.ZAxis = new SCINumericAxis3D { GrowBy = new SCIDoubleRange(0.1, 0.1) };
Surface.RenderableSeries.Add(rSeries3D);
Surface.ChartModifiers.Add(CreateDefault3DModifiers());
Surface.Camera = new SCICamera3D();
}
}
}
}
using System;
using System.Drawing;
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 Xamarin.Examples.Demo.Droid.Extensions;
using Xamarin.Examples.Demo.Droid.Fragments.Base;
namespace Xamarin.Examples.Demo.Droid.Fragments.Examples3D
{
[Example3DDefinition("Simple Uniform Mesh 3D Chart", description: "Create a simple Uniform Mesh 3D Chart", icon: ExampleIcon.Surface3D)]
class CreateUniformMesh3DChartFragment : 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 = 25;
const int zSize = 25;
var dataSeries3D = new UniformGridDataSeries3D<double, double, double>(xSize, zSize);
for (int x = 0; x < xSize; x++)
{
for (int z = 0; z < zSize; z++)
{
var xVal = 25.0 * x / xSize;
var zVal = 25.0 * z / zSize;
var y = Math.Sin(xVal * .2) / ((zVal + 1) * 2);
dataSeries3D.UpdateYAt(x, z, y);
}
}
var renderableSeries3D = new SurfaceMeshRenderableSeries3D()
{
DataSeries = dataSeries3D,
DrawMeshAs = DrawMeshAs.SolidWireframe,
Stroke = 0x77228B22,
ContourStroke = 0x77228B22,
StrokeThickness = 2f.ToDip(Activity),
DrawSkirt = false,
MeshColorPalette = new GradientColorPalette(
new Color[] { Color.FromArgb(0xFF, 0x1D, 0x2C, 0x6B), Color.Blue, Color.Cyan, Color.GreenYellow, Color.Yellow, Color.Red, Color.DarkRed },
new float[] { 0, .1f, .3f, .5f, .7f, .9f, 1 })
};
using (Surface.SuspendUpdates())
{
Surface.XAxis = new NumericAxis3D() { GrowBy = new DoubleRange(0.1, 0.1) };
Surface.YAxis = new NumericAxis3D() { VisibleRange = new DoubleRange(0, .3) };
Surface.ZAxis = new NumericAxis3D() { GrowBy = new DoubleRange(0.1, 0.1) };
Surface.Camera = new Camera3D();
Surface.RenderableSeries.Add(renderableSeries3D);
Surface.ChartModifiers = new ChartModifier3DCollection
{
new PinchZoomModifier3D(),
new OrbitModifier3D(),
new ZoomExtentsModifier3D()
};
}
}
}
}