Created
September 11, 2023 19:54
-
-
Save zurche/abf1c5e5be5d5eebb00cf120256d464a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@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