Charts
Installation
caveui components are copy-paste Jetpack Compose built entirely on Material 3 — there's no caveui dependency to add. Make sure Material 3 is on your classpath (it ships with the Compose BOM), then copy the Usage snippet below into your project.
kotlin
// build.gradle.kts (module)
dependencies {
implementation(platform("androidx.compose:compose-bom:2025.06.00"))
implementation("androidx.compose.material3:material3")
}Usage
kotlin
@Composable
fun Gantt(
tasks: List<Triple<String, Float, Float>> = listOf(
Triple("Design", 0f, 0.4f), Triple("Build", 0.25f, 0.75f),
Triple("Test", 0.6f, 0.9f), Triple("Ship", 0.85f, 1f),
),
palette: List<Color> = listOf(Color(0xFF6366F1), Color(0xFF10B981), Color(0xFFF59E0B), Color(0xFFEC4899)),
modifier: Modifier = Modifier,
) {
val reveal by animateFloatAsState(1f, tween(900, easing = EaseOutCubic), label = "r")
val grid = MaterialTheme.colorScheme.outlineVariant
Canvas(modifier.fillMaxWidth().height(120.dp)) {
val gap = 10.dp.toPx()
val rowH = (size.height - gap * (tasks.size - 1)) / tasks.size
repeat(5) { g -> drawLine(grid, Offset(size.width * g / 4, 0f), Offset(size.width * g / 4, size.height), 1f) }
tasks.forEachIndexed { i, (_, start, end) ->
val y = i * (rowH + gap)
val x = start * size.width
val w = (end - start) * size.width * reveal
drawRoundRect(palette[i], Offset(x, y), Size(w, rowH), CornerRadius(rowH / 2))
}
}
}