Skip to content

Arction/lcjs-android-example

master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
app
 
 
 
 
 
 
 
 
 
 
 
 

LightningChart® JS Android usage example

This repository showcases how to use LightningChart® JS charting library in a Android project.

More information about LightningChart® JS can be found from our website, https://www.arction.com/lightningchart-js/.

Getting Started

The project can be opened with Android Studio and run on the emulator or an actual device. Refer to the Android Developer Guide for instructions for Android development.

The chart is running inside a WebView. Data is send from the native Android code to the WebView to be displayed. You can find the source code for the charts from /app/src/main/assets. index.html is the page that is running inside the WebView and contains the JavaScript for configuring the chart. lcjs.iife.js is IIFE packaged version of LightningChart® JS that can be found inside the NPM package.

JavaScript has to be enabled on the WebView for the chart to work!

webView.getSettings().setJavaScriptEnabled(true);

Sending data to the chart

Data can be send to the chart from native Android code with the help of evaluateJavascript method.

view.evaluateJavascript("setData('" + xyArray + "')", null);

The setData is a JavaScript method that has been defined inside the WebView. The evaluateJavascript method will call that method to set data in the chart. The contents of xyArray is provided as the argument to the setData method.

function setData(data){
    var arrData = data.split("||")
    const ArrX = JSON.parse(arrData[0])
    const ArrY = JSON.parse(arrData[1])
    const chartData = ArrX.map( ( itr1, itr2 ) => ( { x: itr1, y: ArrY[itr2] } ) )
    lineSeries.add(chartData)
}

Development limitations

The Android simulator environment might not support all of the required WebGL 1 extensions. This means that all of LightningChart JS features might not work in the simulator environment. Actual devices do support those extensions most of the time meaning that the features that don't work in simulator do work in an actual device.

Support

If you notice an error in the example code, please open an issue on GitHub.

Official API documentation can be found on Arction website.

If the docs and other materials do not solve your problem as well as implementation help is needed, ask on StackOverflow (tagged lightningchart).

If you think you found a bug in the LightningChart JavaScript library, please contact support@arction.com.

Direct developer email support can be purchased through a Support Plan or by contacting sales@arction.com.

© Arction Ltd 2009-2020. All rights reserved.

Android is a trademark of Google LLC.

About

LightningChart JS Android usage example

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published