Skip to content

Instantly share code, notes, and snippets.

@zurche
Created September 11, 2023 19:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zurche/abf1c5e5be5d5eebb00cf120256d464a to your computer and use it in GitHub Desktop.
Save zurche/abf1c5e5be5d5eebb00cf120256d464a to your computer and use it in GitHub Desktop.
@Composable
fun PerformanceChart(modifier: Modifier = Modifier, list: List<Float> = listOf(1f, 2f, 3f, 4f)) {
val zipList: List<Pair<Float, Float>> = list.zipWithNext()
Row(modifier = modifier) {
val lineColor = Color.Black
for (pair in zipList) {
Canvas(
modifier = Modifier
.fillMaxHeight()
.weight(1f),
onDraw = {
val fromPoint = Offset(x = 0f, y = size.height)
val toPoint = Offset(x = size.width, y = 0f)
drawLine(
color = lineColor,
start = fromPoint,
end = toPoint,
strokeWidth = 3f
)
})
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment