AnyChart Android Charts is an amazing data visualization library for easily creating interactive charts in Android apps. It runs on API 14+ (Android 4.0) and features dozens of built-in chart types.
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.1.2"]]
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.1.2"
Add the JitPack repository to the build file:
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
Add the dependency:
<dependency>
<groupId>com.github.AnyChart</groupId>
<artifactId>AnyChart-Android</artifactId>
<version>0.1.2</version>
</dependency>
Add this to the root build.gradle at the end of repositories (WARNING: Make sure you add this under allprojects not under buildscript):
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
Add the dependency to the project build.gradle:
dependencies {
compile 'com.github.AnyChart:AnyChart-Android:0.1.2'
}
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.
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+).
|
|
Add an empty Activity and put in layout and Activity name.
|
|
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.1.2'
}
|
|
Add AnyChart view to the Activity layout.
<com.anychart.anychart.AnyChartView
android:id="@+id/any_chart_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
/>
|
Add Java code to the Activity. For example, if you want to create pie chart:
Pie pie = AnyChart.pie();
List<DataEntry> 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);
|
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.
|
|
AnyChart product family includes scores of chart types and we're constantly adding new ones.
Clone or download the project.
Open Android Studio and import the project.
|
Run the project.
|
|
|
- Web: www.anychart.com
- Email: [email protected]
- Twitter: anychart
- Facebook: AnyCharts
- LinkedIn: anychart
- AnyChart Website
- Download AnyChart
- AnyChart Licensing
- AnyChart Support
- Report Issues
- AnyChart Playground
- AnyChart Documentation
- AnyChart API Reference
- AnyChart Sample Solutions
- AnyChart Integrations
© AnyChart.com - JavaScript charts. All rights reserved.