Android & Xamarin.Android Charting Documentation - SciChart Android Charts SDK v2.x
Xamarin Tutorial 02 - Creating a Chart

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:

XML

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:orientation="vertical"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
    <com.scichart.charting.visuals.SciChartSurface
       android:id="@+id/Chart"
       android:layout_width="fill_parent"
       android:layout_height="fill_parent" />
 
</LinearLayout>

C#

Then use it in code

Declaring SciChartSurface Instance
Copy Code
protected override void OnCreate(Bundle bundle)
{
     base.OnCreate(bundle);

     // Set our view from the "main" layout resource
     SetContentView(Resource.Layout.Main);

     // 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
     chart.XAxes.Add(xAxis);

     // Add yAxis to the YAxes collection of the chart
     chart.YAxes.Add(yAxis);
}

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

See Also