ClickablePieChart

Additional

Language
Kotlin
Version
1.0.6 (Sep 16, 2020)
Created
Aug 12, 2020
Updated
Sep 16, 2020
Owner
faskN (furkanaskin)
Contributors
faskN (furkanaskin)
Goksu Turker (turkergoksu)
2
Activity
Badge
Generate
Download
Source code
APK file

Commercial

ClickablePieChart

Android Pie Chart library, supported with Kotlin DSL.

Installation

Step 1. Add the JitPack repository to your build file

allprojects {
 repositories {
  ...
  maven { url 'https://jitpack.io' }
 }
}

Step 2. Add the dependency

dependencies {
 implementation 'com.github.furkanaskin:ClickablePieChart:1.0.6'
}

Usage

        val pieChart = PieChart(
            slices = provideSlices(), clickListener = null, sliceStartPoint = 0f, sliceWidth = 80f
        ).build()

        chart.setPieChart(pieChart)

Also you can use Kotlin DSL for building your chart.

        val pieChartDSL = buildChart {
            slices { provideSlices() }
            sliceWidth { 80f }
            sliceStartPoint { 0f }
            clickListener { angle, index ->
                // ...
            }
        }
        chart.setPieChart(pieChartDSL)

To setup with legend you need an root layout for legend.

chart.showLegend(legendLayout)

XML Attributes

XML Attribute Format Description
app:popupText string Shows text after the slice data value in popup.
app:centerColor color Center color of pie chart.
app:showPopup boolean Show popup when user clicks on pie chart.