Installation
Leiningen
Add this to the project.clj file, at the end of repositories:
:repositories [["jitpack" "https://jitpack.io"]]
Add the dependency:
:dependencies [[com.github.AnyChart/AnyChart-Android "0.0.3"]]
SBT
Add this to the build.sbt, at the end of resolvers:
resolvers += "jitpack" at "https://jitpack.io"
Add the dependency:
libraryDependencies += "com.github.AnyChart" % "AnyChart-Android" % "0.0.3"
Maven
Add the JitPack repository to the build file:
jitpack.io
https://jitpack.io
Add the dependency:
com.github.AnyChart
AnyChart-Android
0.0.3
Gradle
Add this to the root build.gradle at the end of repositories (
WARNING: Make sure you add this under
all projects not under build script):
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency to the project build.gradle:
dependencies {
compile 'com.github.AnyChart:AnyChart-Android:0.0.3'
}
JAR/AAR File
Download the
latest AAR. Copy AAR file into the libs folder of the application project.
If you are using Android Studio:
Right click on a project and choose "Open Module Settings".
Click the plus button in the top left to add a new module.
Choose "Import .JAR or .AAR Package".
Find the AAR file.
In the app's module click on the dependencies tab and add the new module as a dependency.
Getting Stated using Gradle
You should have already set up the latest
Android Studio.
Create a new project and select appropriate API level (AnyChart library for Android compatible with API
15+).
Create new project
Select API level
Add an empty Activity and put in layout and Activity name.
Add Activity
Customize Activity
Add the repository to the
project build.gradle at the end of repositories (
WARNING: Make sure you add it under allprojects, not under the buildscript).
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Then add the dependency to the module build.gradle and synchronize project with Gradle.
dependencies {
compile 'com.github.AnyChart:AnyChart-Android:0.0.3'
}
Add the repository
Add the dependency and sync the project
Add AnyChart view to the Activity layout.
android:id="@+id/any_chart_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
Add a view to a layout
Add Java code to the Activity. For example, if you want to create pie chart:
Pie pie = AnyChart.pie();
List data = new ArrayList<>();
data.add(new ValueDataEntry("John", 10000));
data.add(new ValueDataEntry("Jake", 12000));
data.add(new ValueDataEntry("Peter", 18000));
AnyChartView anyChartView = (AnyChartView) findViewById(R.id.any_chart_view);
anyChartView.setChart(pie);
Add Java code
Make sure you have these package imports at the top of your Activity file.
import com.anychart.anychart.AnyChart;
import com.anychart.anychart.AnyChartView;
import com.anychart.anychart.DataEntry;
import com.anychart.anychart.Pie;
import com.anychart.anychart.ValueDataEntry;
import java.util.ArrayList;
import java.util.List;
Build and run your app.
Build and run
Running App
Running Demos
Clone or download the
project.
Open Android Studio and import the project.
Import Project
Run the project.
Run Project
Select Chart
Running App