Jetpack compose treemap chart implementation
Add this to your dependencies
gradle block:
implementation "io.github.overpas:treemap-chart:0.1.3"
implementation "io.github.overpas:treemap-chart-compose:0.1.3"
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 directory