Charts
Gradle Setup
Step 1. Add the JitPack repository to your build file Add it in your root build.gradle at the end of repositories:
allprojects {
repositories {
...
maven { url 'https://www.jitpack.io' }
}
}
Step 2. Add the dependency
dependencies {
implementation 'com.github.asayushg:charts:1.0.1'
}
Examples
?
Documentation
?
1. Pie Chart
Add the PieChart View in your layout as:
<div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="
“>
Create a list of Slice with percentage and color and submit to PieChart view with border width and color as:
<div class="snippet-clipboard-content position-relative" data-snippet-clipboard-copy-content="val list = ArrayList()
list.add(
PieChart.Slice(
percentage = 20f,
color = Color.RED
)
)
findViewById(R.id.pieChart).submitList(pieChartList = list, borderSize = 10f, borderColor = Color.GRAY)
“>
val list = ArrayList()
list.add(
PieChart.Slice(
percentage = 20f,
color = Color.RED
)
)
findViewById(R.id.pieChart).submitList(pieChartList = list, borderSize = 10f, borderColor = Color.GRAY)