-
QuestionI am creating my line provider like so:
And this works fine.
So my question is, if there is a way for me to initialize the series container with the minimal set of series:
and then add new lines as needed, like shown in this artificial example:
Vico version(s)2.0Beta.1 UI framework(s)Jetpack Compose |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hello @zell-mbc. Do you actually need to add LineCartesianLayer.LineProvider.series(
buildList {
add(LineCartesianLayer.rememberLine(LineCartesianLayer.LineFill.single(fill(chartColors[0]))))
add(LineCartesianLayer.rememberLine(LineCartesianLayer.LineFill.single(fill(chartColors[1]))))
if (showBodyFat) {
add(LineCartesianLayer.rememberLine(LineCartesianLayer.LineFill.single(fill(chartColors[3]))))
}
if (showLinearTrendline) {
add(LineCartesianLayer.rememberLine(LineCartesianLayer.LineFill.single(fill(chartColors[4]))))
}
}
) or a simplified one for this particular case: LineCartesianLayer.LineProvider.series(
buildList {
add(chartColors[0])
add(chartColors[1])
if (showBodyFat) add(chartColors[3])
if (showLinearTrendline) add(chartColors[4])
}
.map { rememberLine(LineCartesianLayer.LineFill.single(fill(it))) }
) |
Beta Was this translation helpful? Give feedback.
Hello @zell-mbc. Do you actually need to add
Line
s to an existingLineProvider
(which is possible)? Or are you just looking to fix the duplication issue that you mentioned? If it's the latter, then you can just use something like this: