Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/mahozad/android-pie-chart

Highly customizable Android library for drawing Pie and Donut charts.
https://github.com/mahozad/android-pie-chart

android android-library chart charting charting-library donut-chart donutchart doughnut-chart kotlin kotlin-library pie-chart piechart plotting ring-chart ringchart visualization

Last synced: about 22 hours ago
JSON representation

Highly customizable Android library for drawing Pie and Donut charts.

Awesome Lists containing this project

README

        

[comment]: <> ([![Build Status](https://www.travis-ci.com/mahozad/android-pie-chart.svg?branch=master)](https://www.travis-ci.com/mahozad/android-pie-chart))
[comment]: <> (![Dependencies](https://img.shields.io/librariesio/github/mahozad/android-pie-chart))
[comment]: <> (![Code Size](https://img.shields.io/github/languages/code-size/mahozad/android-pie-chart))
[comment]: <> (![Repo Size](https://img.shields.io/github/repo-size/mahozad/android-pie-chart))
[comment]: <> (![SLOC](https://img.shields.io/tokei/lines/github/mahozad/android-pie-chart))
[comment]: <> (![Downloads](https://img.shields.io/github/downloads/mahozad/android-pie-chart/total))
[comment]: <> (![Closed Issues](https://img.shields.io/github/issues-closed/mahozad/android-pie-chart?color=green))
[comment]: <> (![Commits Since Last Release](https://img.shields.io/github/commits-since/mahozad/android-pie-chart/latest))
[comment]: <> (![Release workflow](https://img.shields.io/github/workflow/status/mahozad/android-pie-chart/Test?label=CI%2FCD))
[comment]: <> (![Tests](https://img.shields.io/github/checks-status/mahozad/android-pie-chart/master))
[comment]: <> (![Milestone Progress](https://img.shields.io/github/milestones/progress-percent/mahozad/android-pie-chart/1))
[comment]: <> (![Lines of code](https://img.shields.io/tokei/lines/github/mahozad/android-pie-chart?color=%23efefef))
[comment]: <> ([![Latest release](https://img.shields.io/github/v/release/mahozad/android-pie-chart)](https://github.com/mahozad/android-pie-chart/releases/latest))

[comment]: <> (!*†‡;)

[comment]: <> ([![CI workflow]](https://github.com/mahozad/android-pie-chart/actions/workflows/ci.yml))
[![Codecov]](https://codecov.io/gh/mahozad/android-pie-chart)
[![Latest Maven Central release]](https://search.maven.org/artifact/ir.mahozad.android/pie-chart)
![Kotlin]

A Pie/Donut[*]/Ring chart for Android, customizable to the most extent possible.
For tutorial and examples refer to the [website].

| Screenshot 1 | Screenshot 2 | Screenshot 3 | Screenshot 4 | Screenshot 5 |
|-----------------|-----------------|-----------------|-----------------|-----------------|
| ![Screenshot 2] | ![Screenshot 1] | ![Screenshot 3] | ![Screenshot 4] | ![Screenshot 5] |

### build.gradle[.kts]
```groovy
implementation("ir.mahozad.android:pie-chart:0.7.0")
```

### XML layout
```xml

```

### Kotlin Activity
```kotlin
val pieChart = findViewById(R.id.pieChart)
pieChart.slices = listOf(
PieChart.Slice(0.2f, Color.BLUE),
PieChart.Slice(0.4f, Color.MAGENTA),
PieChart.Slice(0.3f, Color.YELLOW),
PieChart.Slice(0.1f, Color.CYAN)
)
```

### Jetpack Compose
```kotlin
@Composable
fun PieChartView() {
AndroidView(
modifier = Modifier.fillMaxSize(),
factory = { context ->
PieChart(context).apply {
slices = listOf(
PieChart.Slice(0.2f, Color.BLUE),
PieChart.Slice(0.4f, Color.MAGENTA),
PieChart.Slice(0.3f, Color.YELLOW),
PieChart.Slice(0.1f, Color.CYAN)
)
}
},
update = { view ->
// View's been inflated or state read in this block has been updated
// Add logic here if necessary
}
)
}
```

## Contributing

Please help improve the library by fixing [the issues that I couldn't tackle myself].
Any other contributions are also welcome.


* Or *Doughnut* [↵]

[*]: #footnote-1
[↵]: #ref-1
[Logo]: logo-animated.svg
[Kotlin]: https://img.shields.io/badge/kotlin-1.6.21-303030.svg?labelColor=303030&logo=data:image/svg+xml;base64,PHN2ZyB2ZXJzaW9uPSIxLjEiIHZpZXdCb3g9IjAgMCAxOC45MyAxOC45MiIgd2lkdGg9IjE4IiBoZWlnaHQ9IjE4IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgogIDxyYWRpYWxHcmFkaWVudCBpZD0iZ3JhZGllbnQiIHI9IjIxLjY3OSIgY3g9IjIyLjQzMiIgY3k9IjMuNDkzIiBncmFkaWVudFRyYW5zZm9ybT0ibWF0cml4KDEgMCAwIDEgLTQuMTMgLTIuNzE4KSIgZ3JhZGllbnRVbml0cz0idXNlclNwYWNlT25Vc2UiPgogICAgPHN0b3Agc3RvcC1jb2xvcj0iI2U0NDg1NyIgb2Zmc2V0PSIuMDAzIi8+CiAgICA8c3RvcCBzdG9wLWNvbG9yPSIjYzcxMWUxIiBvZmZzZXQ9Ii40NjkiLz4KICAgIDxzdG9wIHN0b3AtY29sb3I9IiM3ZjUyZmYiIG9mZnNldD0iMSIvPgogIDwvcmFkaWFsR3JhZGllbnQ+CiAgPHBhdGggZmlsbD0idXJsKCNncmFkaWVudCkiIGQ9Ik0gMTguOTMsMTguOTIgSCAwIFYgMCBIIDE4LjkzIEwgOS4yNyw5LjMyIFoiLz4KPC9zdmc+Cg==
[website]: https://mahozad.ir/android-pie-chart/#examples
[Codecov]: https://img.shields.io/codecov/c/github/mahozad/android-pie-chart?logo=codecov&logoColor=FF50A1&labelColor=303030&token=ptnbmXaozw
[CI workflow]: https://img.shields.io/github/workflow/status/mahozad/android-pie-chart/CI?logo=github&labelColor=303030
[Latest Maven Central release]: https://img.shields.io/maven-central/v/ir.mahozad.android/pie-chart?logo=android&labelColor=303030
[the issues that I couldn't tackle myself]: https://github.com/mahozad/android-pie-chart/issues?q=is%3Aissue+is%3Aopen+label%3Ahelp-wanted
[Screenshot 1]: screenshots/screenshot-1.png
[Screenshot 2]: screenshots/screenshot-2.png
[Screenshot 3]: screenshots/screenshot-3.png
[Screenshot 4]: screenshots/screenshot-4.png
[Screenshot 5]: screenshots/screenshot-5.png