android - How to set different colors for each column in bar chart with Vico bar chart library? - Stack Overflow

I am designing a bar chart in Compose using the Vico bar chart library.Currently, my code looks like t

I am designing a bar chart in Compose using the Vico bar chart library.

Currently, my code looks like the following and shows the same color for every column.

CartesianChartHost(
      chart = rememberCartesianChart(
        rememberColumnCartesianLayer(
          ColumnCartesianLayer.ColumnProvider.series(
            rememberLineComponent(
              color = Color(0xFF00B7C2),
              thickness = 8.dp,
              shape = CorneredShape.rounded(topLeftPercent = 50, topRightPercent = 50),
            )
          ),
          columnCollectionSpacing = 16.dp,
          rangeProvider = rangeProvider
        ),
        startAxis = VerticalAxis.rememberStart(),
        bottomAxis = HorizontalAxis.rememberBottom(
          valueFormatter = getBottomAxisValueFormatter(
            chartType = chartType, daysInMonth = daysInMonth
          ),
          itemPlacer = remember {
            HorizontalAxis.ItemPlacer.aligned(spacing = 1, addExtremeLabelPadding = true)
          },
        ),
        marker = rememberMarker(),
        decorations = listOf(rememberComposeHorizontalLine(target))
      ), model = model, modifier = modifier
        .padding(8.dp)
        .fillMaxSize()
    )

Can I set different colors for each column?

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745633921a4637271.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信