Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

axisPosition not working #142

Open
JohanAlbrectsen opened this issue Sep 21, 2023 · 0 comments
Open

axisPosition not working #142

JohanAlbrectsen opened this issue Sep 21, 2023 · 0 comments

Comments

@JohanAlbrectsen
Copy link

I use the following configuration for the yAxis:

val yAxisData = AxisData.Builder()
                .steps(4)
                .backgroundColor(Color.Red)
                .labelAndAxisLinePadding(20.dp)
                .axisPosition(
                    pos = Gravity.RIGHT
                )
                .labelData { i ->
                    i.toString()
                }.build()

But the yAxis is still on the left, see:
Screenshot 2023-09-21 at 21 31 49

Here's the complete code:

val pointsData: List<Point> =
                listOf(Point(0f, 40f), Point(1f, 90f), Point(2f, 0f), Point(3f, 60f), Point(4f, 10f))

            val xAxisData = AxisData.Builder()
                .axisStepSize(100.dp)
                .backgroundColor(Color.Blue)
                .steps(pointsData.size - 1)
                .labelData { i -> i.toString() }
                .labelAndAxisLinePadding(15.dp)
                .build()

            val yAxisData = AxisData.Builder()
                .steps(4)
                .backgroundColor(Color.Red)
                .labelAndAxisLinePadding(20.dp)
                .axisPosition(
                    pos = Gravity.RIGHT
                )
                .labelData { i ->
                    i.toString()
                }.build()

            val lineChartData = LineChartData(
                linePlotData = LinePlotData(
                    lines = listOf(
                        Line(
                            dataPoints = pointsData,
                            LineStyle(),
                            IntersectionPoint(),
                            SelectionHighlightPoint(),
                            ShadowUnderLine(),
                            SelectionHighlightPopUp()
                        )
                    ),
                ),
                xAxisData = xAxisData,
                yAxisData = yAxisData,
                gridLines = GridLines(),
                backgroundColor = Color.White
            )

            LineChart(
                modifier = Modifier
                    .fillMaxWidth()
                    .height(300.dp),
                lineChartData = lineChartData
            )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant