Giter Club home page Giter Club logo

clickablepiechart's Introduction

DevLibrary AndroidArsenal

ClickablePieChart

Android Pie Chart library, supported with Kotlin DSL.

PieChart

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.9'
}

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)

Or use with custom legend adapter by inheriting from LegendAdapter

chart.showLegend(legendLayout, CustomLegendAdapter())

Sample Custom Adapter can be found here

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.
app:showPercentage boolean Show percentage of slice beside popupText.
app:animationDuration integer Animation duration with milliseconds.

clickablepiechart's People

Contributors

furkanaskin avatar gsotti avatar turkergoksu avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

clickablepiechart's Issues

Why popup is converted to int?

It makes no sense when chart accepts floats to convert it to be shown on popup to int

ClickablePieChart.kt

var popupText = "${slices?.get(index)!!.dataPoint.toInt()} $popupText"

Options to disable showInfoPopup(index)

Thanks for this great library and all the hardwork from constributor! <3

However, Is there any options to disable showInfoPopup(index)?
showInfoPopup(index) seems to trigger immediately with the click action.

image

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.