Column Chart
| ColumnChart(
modifier = Modifier.fillMaxSize().padding(horizontal = 22.dp),
data = remember {
listOf(
Bars(
label = "Jan",
values = listOf(
Bars.Data(label = "Linux", value = 50.0, color = Brush.verticalGradient(...),
Bars.Data(label = "Windows", value = 70.0, color = SolidColor(Color.Red))
),
),
Bars(
label = "Feb",
values = listOf(
Bars.Data(label = "Linux", value = 80.0, color = Brush.verticalGradient(...),
Bars.Data(label = "Windows", value = 60.0, color = SolidColor(Color.Red))
),
)
)
},
barProperties = BarProperties(
radius = Bars.Data.Radius.Rectangle(topRight = 6.dp, topLeft = 6.dp),
spacing = 3.dp,
strokeWidth = 20.dp
),
animationSpec = spring(
dampingRatio = Spring.DampingRatioMediumBouncy,
stiffness = Spring.StiffnessLow
),
)
|
Data Count
You can set how many data you want for every bar:
| ColumnChart(
data = remember {
listOf(
Bars(
label = "1",
values = listOf(
Bars.Data(value = 10.0, color = Color.Blue)
)
),
Bars(
label = "2",
values = listOf(
Bars.Data(value = 20.0, color = Color.Blue)
)
),
...
)
},
barProperties = BarProperties(
spacing = 1.dp,
strokeWidth = 10.dp,
),
...
)
|
Negative Values
You can set negative values for this chart and define max value and min value:
| ColumnChart(
data = remember {
listOf(
Bars(
label = "1",
values = listOf(
Bars.Data(value = -40.0, color = Color.Blue)
)
),
Bars(
label = "2",
values = listOf(
Bars.Data(value = 50.0, color = Color.Blue)
)
),
...
)
},
maxValue = 75.0,
minValue = -75.0
...
)
|
By default, max value is the highest value of given data, min value is 0 when there is no value
under the zero in given data, otherwise if there is value under zero, min value will be (-maxValue)