最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin7浏览0评论

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?

发布评论

评论列表(0)

  1. 暂无评论