Android & Xamarin.Android Charting Documentation - SciChart Android Charts SDK v2.x
Tutorial 01 - Adding SciChart libraries as dependencies

Creating a New Android Project

In this tutorial we will create a simple line chart with SciChart Android. Lets start on creating a new Android project in AndroidStudio and adding SciChart libraries as dependencies to it.

If you already know how to do this, you can safely skip to Tutorial 02 - Creating a Chart.

First, pick out the desired target device. Make sure to choose an appropriate Android SDK version. To use SciChart for Android, the minimum SDK version must be API 19 (Android 4.4 KitKat) or higher:

 

Then, select the desired activity template and finish the project set up. The next step is to add SciChart libraries as dependencies to the project.

For a thorough instruction on how to create a project in Android studio, please see the Creating your First SciChart Android App - Part 1.

Setting Up the Build Configuration

To be able to use SciChart classes in your application, you need to add the SciChart Android libraries (AAR) as project dependencies. It is possible either to configure the project to obtain them automatically from Maven, which is the recommended way, or reference downloaded libraries directly.

Using Maven

The SciChart Android Maven repository URL is https://www.myget.org/F/abtsoftware/maven. Please follow the steps below to configure your project to reference the SciChart Android libraries from Maven.

  1. Open the "build.gradle" file for the project and declare a new Maven repository in the "repositories" node inside the "allprojects" node. Use the URL from above:
    Copy Code
    allprojects {
        repositories {
            jcenter()
    
            // Declaring a new Maven repository
            maven { url 'https://www.myget.org/F/abtsoftware/maven' }
        }
    }
    The screenshot below shows where the file can be found in the Project window in AndroidStudio:
  2. Open the "build.gradle" file for a module which SciChart is intended to be used within. Add SciChart Android libraries as module dependencies:
    Copy Code
    dependencies {
        // Default module dependencies
        compile fileTree(dir: 'libs', include: ['*.jar'])
        compile 'com.android.support:appcompat-v7:25.2.0'
        testCompile 'junit:junit:4.12'
    
        // Declare SciChart libraries as module dependencies
        compile (group: 'com.scichart.library', name: 'core', version: '2.0.0.1654', ext: 'aar')
        compile (group: 'com.scichart.library', name: 'data', version: '2.0.0.1654', ext: 'aar')
        compile (group: 'com.scichart.library', name: 'drawing', version: '2.0.0.1654', ext: 'aar')
        compile (group: 'com.scichart.library', name: 'charting', version: '2.0.0.1654', ext: 'aar')
        compile (group: 'com.scichart.library', name: 'extensions',version: '2.0.0.1654', ext: 'aar')
    }
    The screenshot below shows where the file can be found in the Project window in AndroidStudio:

 Using bare SciChart libs

  1. Download and unzip the SciChart Android SDK from https://www.scichart.com/downloads/. SciChart libraries can be found within.
  2. Open the "app" folder under the application's main directory.
  3. Find or create the "libs" folder there and add the SciChart Android libraries to it.
  4. Open the "build.gradle" file for the project and declare a new repository in the "repositories" node inside the "allprojects" node, pointing to the location of SciChart Android libraries:
    Copy Code
    allprojects {
         repositories {
             jcenter()
             // Set up a repository which looks for dependencies in the "libs" folder
             flatDir{dirs 'libs'}
         }
     }
  5. Open the "build.gradle" file for a module which SciChart is intended to be used within. Add SciChart Android libraries as module dependencies:
    Copy Code
    dependencies {
    
         // Default module dependencies
         compile fileTree(dir: 'libs', include: ['*.jar'])
         testCompile 'junit:junit:4.12'
         compile 'com.android.support:appcompat-v7:23.4.0'
    
         // Declare SciChart libraries as module dependencies
         compile (name:'charting-release', ext:'aar')
         compile (name:'drawing-release', ext:'aar')
         compile (name:'data-release', ext:'aar')
         compile (name:'core-release', ext:'aar')
     }
A detailed step-by-step instruction can be found in the Quickstart GuideCreating your First SciChart Android App - Part 2.

Building the Project

At this point the solution should build and run, however we now need to add functionality

Referencing Javadocs in Project

Optionally you can reference Javadocs in your project but you need to add them manually into your project. To do this you need to open Project tab and switch from Android to Project pane:

After you switch to Project pane you need to find core, data, drawing and charting libraries in External Libraries. After you find them you need to add for each appropriate javadoc file. To do this you need to find library in library, click right mouse button and select Library Properties... in context menu:

 After that you need to locate and add appropriate javadoc file for this library. To do this you need to click on '+' sign. You can find javadoc files in <SciChart_Android_Installation_Path>\Libs\Docs folder:

 

After javadocs were added click OK button to close the window. Then you need to repeat the steps above for other SciChart libraries(core, data, drawing and charting). After that you should be able to see documentation for SciChart classes in your project:

 

See Also

Quickstart Guide