Quick Start Guide > Tutorials (Xamarin Android) > Xamarin Tutorial 02 - Creating a Chart
Xamarin Tutorial 02 - Creating a Chart
Source code for this tutorial can be found at our SciChart.Android.Examples Github Repository

Licensing SciChart

The SciChart Android control comes with an inbuilt fully-functional 30-day trial. During the trial period the SciChartSurface control displays a watermark “Powered by SciChart”. At the end of the trial period, applications you have built with SciChart will cease to work and you will not be able to keep working on them. In order to continue using SciChart, please Contact Us to buy a perpetual license key or to ask for an extended trial license key.

SciChartSurface Type

The root 2D chart control is called the SciChartSurface. This is the Android View that 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 SciChartSurface.

Declaring a SciChartSurface Instance

After Referencing the SciChart.Android DLLs from NuGet (package=SciChart.Android), from local DLL files (referencing DLLs SciChart.Android.Charting, SciChart.Android.Drawing, SciChart.Android.Data, SciChart.Android.Core) or the SciChart Source from Github, a SciChartSurface instance can be declared as follows:


First declare SciChartSurface inside file with layout

Declaring a SciChartSurface Instance
Copy Code
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
       android:layout_height="fill_parent" />


Then use it in code

Declaring SciChartSurface Instance
Copy Code
protected override void OnCreate(Bundle bundle)

     // Set our view from the "main" layout resource

     // Get our chart from the layout resource,
     var chart = FindViewById<SciChartSurface>(Resource.Id.Chart);

     // Create a numeric X axis
     var xAxis = new NumericAxis(this) { AxisTitle = "Number of Samples (per Series)" };

     // Create a numeric Y axis
     var yAxis = new NumericAxis(this)
         AxisTitle = "Value",
         VisibleRange = new DoubleRange(-1, 1)

     // Add xAxis to the XAxes collection of the chart

     // Add yAxis to the YAxes collection of the chart

 The code above declares a SciChartSurface and adds a (numeric) X and Y Axis. Congratulations, you have just created your first SciChartSurface!

A Note on Licensing SciChart.

The SciChart Android control comes with an inbuilt fully-functional 30-day trial. You will need to apply a trial license to the applications that you build, including the tutorial.

A license key can be applied following the instructions at www.scichart.com/licensing-scichart-android.

See Also