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(10f, 20f, 3f, 1f)) { | |
val zipList: List<Pair<Float, Float>> = list.zipWithNext() | |
Row(modifier = modifier) { | |
val max = list.max() | |
val min = list.min() | |
val lineColor = | |
if (list.last() > list.first()) LightOlive else LightCarmin // <-- Line color is Green if its going up and Red otherwise |
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
private fun getValuePercentageForRange(value: Float, max: Float, min: Float) = | |
(value - min) / (max - min) |
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
val max = list.max() | |
val min = list.min() |
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 |
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
List<Pair<Float, Float>> = listOf(Pair(1f, 2f), Pair(2f, 3f), Pair(3f, 4f)) |
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
list: List<Float> = listOf(1f, 2f, 3f, 4f) |
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
val zipList: List<Pair<Float, Float>> = list.zipWithNext() |
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
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, |
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 AssetPerformanceCard( | |
assetInfo: AssetInfo = mockAssetInfo | |
) { | |
Card( | |
modifier = Modifier | |
.wrapContentHeight() | |
.fillMaxWidth() | |
.padding(start = 5.dp, end = 5.dp, bottom = 5.dp), | |
colors = CardDefaults.cardColors(containerColor = CryptoWhite) |
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 ValueView(currentValue: Float = 113.02211f, total: Float = 1356f) { | |
Column( | |
modifier = Modifier | |
.padding(start = 10.dp), | |
horizontalAlignment = Alignment.End | |
) { | |
Text( | |
text = currentValue.toString(), | |
style = MaterialTheme.typography.labelMedium, |