+
## Installation
Step 1. Add the JitPack repository to your build file
@@ -18,7 +18,7 @@ allprojects {
Step 2. Add the dependency
```gradle
dependencies {
- implementation 'com.github.furkanaskin:ClickablePieChart:1.0.7'
+ implementation 'com.github.gsotti:ClickablePieChart:1.0.13'
}
```
@@ -31,6 +31,17 @@ dependencies {
chart.setPieChart(pieChart)
```
+
+Or create a BarChart
+
+```kotlin
+ val barChart = BarChart(
+ slices = provideSlices(), clickListener = null
+ ).build()
+
+ chart.setBarChart(barChart)
+```
+
Also you can use **Kotlin DSL** for building your chart.
```kotlin
val pieChartDSL = buildChart {
@@ -43,6 +54,20 @@ Also you can use **Kotlin DSL** for building your chart.
}
chart.setPieChart(pieChartDSL)
```
+
+Or create a BarChart
+
+```kotlin
+ val barChartDSL = buildBarChart {
+ slices { provideSlices() }
+ clickListener { percentage, index ->
+ // ...
+ }
+ }
+ chart.setBarChart(barChartDSL)
+```
+
+
To setup with legend you need an root layout for legend.
```kotlin
chart.showLegend(legendLayout)
@@ -52,6 +77,11 @@ Or use with custom legend adapter by inheriting from LegendAdapter
chart.showLegend(legendLayout, CustomLegendAdapter())
```
+Or if you use a barChart you can also change the orientation of the legendAdapter
+```kotlin
+ chart4.showLegend(rootLayout = legendLayout, orientation = LinearLayoutManager.HORIZONTAL or LinearLayoutManager.VERTICAL)
+```
+
## XML Attributes
| integer | Animation duration with milliseconds. | +|
| app:orientation | +string | +Orientation of BarChart (horizontal/vertical) | +