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

https://github.com/overpas/compose-treemap-chart

Jetpack compose treemap chart implementation
https://github.com/overpas/compose-treemap-chart

android compose-multiplatform jetpack-compose kotlin-multiplaform treemap

Last synced: 1 day ago
JSON representation

Jetpack compose treemap chart implementation

Awesome Lists containing this project

README

          

# Compose Treemap Chart
![Maven Central](https://img.shields.io/maven-central/v/io.github.overpas/treemap-chart-compose)
[![Build](https://github.com/overpas/compose-treemap-chart/actions/workflows/build.yml/badge.svg)](https://github.com/overpas/compose-treemap-chart/actions/workflows/build.yml)
![Badge-Android](https://img.shields.io/badge/platform-android-blue)
![Badge-JVM](https://img.shields.io/badge/platform-jvm-blue)
![Badge-iOS](https://img.shields.io/badge/platform-ios-blue)
![Badge-JS](https://img.shields.io/badge/platform-js-blue)
![Badge-Wasm](https://img.shields.io/badge/platform-wasm-blue)

Jetpack compose [treemap](https://en.wikipedia.org/wiki/Treemapping) chart implementation

## Usage
### Adding to the project
Add this to your `dependencies` gradle block:
```gradle
implementation "io.github.overpas:treemap-chart:0.1.3"
implementation "io.github.overpas:treemap-chart-compose:0.1.3"
```
### Sample code
```kotlin
private val simpleTreeData = tree(10) {
node(6) {
node(4)
node(2) {
node(1)
node(1)
}
}
node(3) {
node(2)
node(1)
}
node(1)
}

@Composable
fun MyChart() {
TreemapChart(
data = simpleTreeData,
evaluateItem = Int::toDouble,
modifier = Modifier.fillMaxSize(),
) { item ->
SimpleTreemapItem(item = item.toString())
}
}
```
The code above produces something like this:

For more advanced Kotlin Multiplatform samples check out the [sample](https://github.com/overpas/compose-treemap-chart/tree/master/sample) directory