Max and custom steps on Y axis #517
Replies: 3 comments 1 reply
-
Greetings @DannyBloky. I am not a maintainer or developer on this project, so I can't fully answer your question, but just yesterday I starting using this library and had a similar need. I set the max to the y Axis using the following code... Note: I am using the 2.0.0-alpha.5 version, so it might be different if you are using the 1.X.X version. private val axisValueOverrider = AxisValueOverrider.fixed<LineCartesianLayerModel>(
maxY = -30f,
minY = -110f,
maxX = 70f,
minX = 10f,
) and then I use that value in the Host CartesianChartHost(
chart =
rememberCartesianChart(
rememberLineCartesianLayer(
axisValueOverrider = axisValueOverrider,
lines = remember(defaultLines) { defaultLines.map { it.copy(backgroundShader = null) } },
),
fadingEdges = rememberFadingEdges(),
),
modelProducer = modelProducer,
marker = rememberMarker(),
runInitialAnimation = false,
diffAnimationSpec = snap(),
horizontalLayout = horizontalLayout,
chartScrollSpec = rememberChartScrollSpec(isScrollEnabled = false)
) As for the yAxis labels, I have not figured that part out yet, but will comment when I do. |
Beta Was this translation helpful? Give feedback.
-
Thanks for the comment. I'm using this chart: So for people that do that also this is the fix for it:
I use to float because it I have a list of Int's I'm using this to get the largest point and from there I set my steps. `
|
Beta Was this translation helpful? Give feedback.
-
Hello! As mentioned by @christianrowlands, you can customize the value range of an axis via |
Beta Was this translation helpful? Give feedback.
-
Hi I don't know if it already exist but didn't see it.
I now have implement your chart.
I use number but convert them to floats.
But I got large numbers.
But I don't know how to set a max to the y Axis. Because I don't want my largest point to be at the the top.
Also now I get random numbers als label like 240345 ect.
So is it possible to do like steps like 20000 or something depends on your data. Because that looks nicer
Just some suggestion how it should work
I would like to say that my yAxis must go to 900000(900k)
I want to do it in 5 steps of 200000(200k)
So my yAxis would show these numbers: 0, 200k, 400k, 600k, 800k (and then full number or I need to add my own converter to show 200k instead of 200000)
So the 800k will not be at the top because I want it to be 900k
Maybe this is not possible yet. But I would be great if this can be implemented in the future
For other people this wil also be nice I think. And probably also on the x axis
Beta Was this translation helpful? Give feedback.
All reactions