iOS Charting Documentation - SciChart
Tutorial 02- Creating a SciChartSurface

In this Tutorial we will continue to familiarize with SciChart API. To make it easier for you to start with playing around with SciChart you can download the Tutorial Project from this open Git repository, where you can find a set of Tutorials' projects as well as our Demos!

Update project from Git repository

Just in case you are using our project from Git repository - you have to update it with steps from Tutorial 01.

The SciChartSurface Type

The root 2D chart control is called the SciChartSurface. This is the SciChart object you will be adding to your applications wherever you need a chart. You can add more than one SciChartSurface, you can configure them independently, and you can link them together.

First up, let’s start by declaring one:

Declaring a SciChartSurface Instance

Click on the ViewController.cs file in Solution Explorer panel. Following step after Linking the SciChart DLLs is declaringa a SciChartSurface instance, this might be done as follows:

Declaring a SciChartSurface Instance
Copy Code
using System;
using UIKit;
using SciChart.iOS.Charting;
namespace HavingFunWithSciChartiOS
{
    public partial class ViewController : UIViewController
    {
        private SCIChartSurface _surface;
        public ViewController(IntPtr handle) : base(handle)
        {
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();
            // Perform any additional setup after loading the view, typically from a nib.
            _surface = new SCIChartSurface();
            _surface.TranslatesAutoresizingMaskIntoConstraints = true;
            _surface.Frame = this.View.Bounds;
            this.View.AddSubview(_surface);
            _surface.XAxes.Add(new SCINumericAxis());
            _surface.YAxes.Add(new SCINumericAxis());
        }
        public override void DidReceiveMemoryWarning()
        {
            base.DidReceiveMemoryWarning();
            // Release any cached data, images, etc that aren't in use.
        }
    }
}

The above code declares a SCIChartSurface and adds a (numeric) X and Y Axes.  If you have admitted we added two axes - X and Y. It is needed for SiChartSurface to have them both, in the other case the chart will be blank!

Congratulations, you have just created your first example using SciChart! At this point you have to be able to see the empty SciChart Surface

Your first SciChartSurface using Xamarin.iOS!

Your first SciChartSurface using Xamarin.iOS!