admin管理员组文章数量:1026144
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?
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?
版权声明:本文标题:android - How to set different colors for each column in bar chart with Vico bar chart library? - Stack Overflow 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745633919a2160326.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论