LineChart not showing axis Labels #839
Unanswered
DSanjulian
asked this question in
Questions
Replies: 1 comment
-
Hi @DSanjulian, there's the same problem with Here's a snippet with the fixes applied. fun LineChartComponent(weights: List<Pair<Float, Float>>) {
val chartEntryModelProducer = remember { ChartEntryModelProducer() }
LaunchedEffect(weights) {
chartEntryModelProducer.setEntries(weights.map { entryOf(it.first, it.second) })
}
Chart(
chart = lineChart(),
chartModelProducer = chartEntryModelProducer,
startAxis =
rememberStartAxis(
label = axisLabelComponent(textSize = 15.sp),
guideline = axisGuidelineComponent(thickness = 1.dp),
itemPlacer = remember { AxisItemPlacer.Vertical.default() }
),
bottomAxis = rememberBottomAxis(guideline = null),
chartScrollSpec = rememberChartScrollSpec(isScrollEnabled = false)
)
} This should work. If you still encounter issues, please share the entire example along with the data used for the chart. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Question
Hi, I am new to vico (and GitHub for that matter, sorry for the format as well), so sorry for the supernoob question, but I can't get a lineChart to show the y-axis labels.
Here's the Chart:
fun LineChartComponent(weights: List<Pair<Float, Float>>) { val chartEntries = List(weights.size) {entryOf(it.toFloat(), weights[it].second)} val chartEntryModelProducer = ChartEntryModelProducer(chartEntries) Chart( chart = lineChart(), chartModelProducer = chartEntryModelProducer, startAxis = rememberStartAxis( label = axisLabelComponent(textSize = 15.sp), guideline = axisGuidelineComponent(thickness = 1.dp), itemPlacer = remember { AxisItemPlacer.Vertical.default() }), bottomAxis = rememberBottomAxis(guideline = axisGuidelineComponent(thickness = 0.dp)), chartScrollSpec = rememberChartScrollSpec(isScrollEnabled = false) ) }
Thank you!
Vico version(s)
1.15.0
UI framework(s)
Jetpack Compose
Beta Was this translation helpful? Give feedback.
All reactions