Skip to content

One Line chart with two data sets #962

Answered by Gowsky
wojtekkula3 asked this question in Questions
Discussion options

You must be logged in to vote

Hello, @wojtekkula3. This is possible in both Vico 1.15.0 and Vico 2.0.0-beta.3. To implement it, instead of using a single LineChart/LineCartesianLayer with two series, you should use two (each with one series) and link them to separate y-axes. Below is an example for Vico 1.15.0. It uses ComposedChartEntryModelProducer, but you can also create the model manually if needed.

val modelProducer = ComposedChartEntryModelProducer.build()
modelProducer.runTransaction {
    add(entriesOf(40, 60, 80, 150))
    add(entriesOf(10, 30, 50, 60))
}
val lineChart1 =
    lineChart(
        axisValuesOverrider = AxisValuesOverrider.fixed(maxY = 200f),
        targetVerticalAxisPosition = AxisPosition.Ver…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@wojtekkula3
Comment options

@wojtekkula3
Comment options

Answer selected by wojtekkula3
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants