patrykandpatrick / vico

A light and extensible chart library for Android.
https://patrykandpatrick.com/vico/wiki
Apache License 2.0
2.08k stars 125 forks source link

Chart does not update bar colors properly #511

Closed ErickSorto closed 8 months ago

ErickSorto commented 8 months ago

How to reproduce

val customColumns = remember {
    barColors.map { color ->
        LineComponent(color = color)
    }
}
val chart = columnChart(
    columns = customColumns,
)

Chart(
    chart = chart,
    chartModelProducer = chartEntryModelProducer,
    startAxis = rememberStartAxis(),
    bottomAxis = bottomAxis,
    marker = MarkerComponent(
        guideline = null,
        indicator = null,
        label = TextComponent.Builder().build(),
    ),
    modifier = Modifier
        .padding(32.dp)
        .height(300.dp),
    isZoomEnabled = false,
)

Observed behavior

All bars end up being the same color as the first item in the list.

Expected behavior

Each bar color should have a unique color.

Vico version(s)

Latest stable version

Android version(s)

10

Additional information

No response

Gowsky commented 8 months ago

Hi @ErickSorto, LineComponents are applied per series and not per column, as described in the documentation. But we'll be looking into adding this functionality in the future, as mentioned in #471.