admin管理员组

文章数量:1434371

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?

本文标签: androidHow to set different colors for each column in bar chart with Vico bar chart libraryStack Overflow