Skip to content

Instantly share code, notes, and snippets.

View developerchunk's full-sized avatar
💭
Android Developer / UX/UI Designer

Developer Chunk developerchunk

💭
Android Developer / UX/UI Designer
View GitHub Profile
@Composable
fun PieChart(
data: Map<String, Int>,
radiusOuter: Dp = 140.dp,
chartBarWidth: Dp = 35.dp,
animDuration: Int = 1000,
) {
val totalSum = data.values.sum()
val floatValue = mutableListOf<Float>()
@developerchunk
developerchunk / BarGraph.kt
Last active December 6, 2022 02:18
Create Custom BarGraph with Scales in Jetpack Compose Medium:
@Composable
fun BarGraph(
graphBarData: List<Float>,
xAxisScaleData: List<Int>,
barData_: List<Int>,
height: Dp,
roundType: BarType,
barWidth: Dp,
barColor: Color,
barArrangement: Arrangement.Horizontal
@developerchunk
developerchunk / Chart.Kt
Last active December 5, 2022 03:27
Full Documentation on Medium- https://link.medium.com/8syGF0pUuub
// graph
barValue.forEach {
Box(
modifier = Modifier
.padding(start = barGraphWidth, bottom = 5.dp)
.clip(CircleShape)
.width(barGraphWidth)
.fillMaxHeight(it)
.background(Purple500)
.clickable {
@developerchunk
developerchunk / Chart.Kt
Last active December 5, 2022 03:29
Full Documentation on Medium- https://link.medium.com/8syGF0pUuub
@Composable
fun CustomChart(
barValue: List<Float>,
xAxisScale: List<String>,
total_amount: Int
) {
val context = LocalContext.current
// BarGraph Dimensions
val barGraphHeight by remember { mutableStateOf(200.dp) }
val barGraphWidth by remember { mutableStateOf(20.dp) }
@developerchunk
developerchunk / switchButton.kt
Last active March 12, 2025 12:26
Create Custom Switch Button Jetpack in Compose | Full Documentation on Medium- https://link.medium.com/eWGtmZ8Auub
import androidx.compose.animation.core.LinearOutSlowInEasing
import androidx.compose.animation.core.animateDpAsState
import androidx.compose.animation.core.tween
import androidx.compose.foundation.background
import androidx.compose.foundation.clickable
import androidx.compose.foundation.interaction.MutableInteractionSource
import androidx.compose.foundation.layout.*
import androidx.compose.foundation.shape.CircleShape
import androidx.compose.runtime.*
import androidx.compose.ui.Modifier