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

LineWidth is not synchronized to XAxisWidth #8

Open
jns-codeworks opened this issue Mar 8, 2022 · 2 comments
Open

LineWidth is not synchronized to XAxisWidth #8

jns-codeworks opened this issue Mar 8, 2022 · 2 comments
Assignees

Comments

@jns-codeworks
Copy link

jns-codeworks commented Mar 8, 2022

It seems like XAxis.stepSize is not synchronized to the xOffset between DataPoints. Changing stepSize only has effect on XAxis, not on Line

    val ethereumOneWeek = listOf(
        DataPoint(1f, 2938.67f),
        DataPoint(2f, 2971.3f),
        DataPoint(3f, 2887.21f),
        DataPoint(4f, 2704.42f),
        DataPoint(5f, 2646.03f),
        DataPoint(6f, 2637.95f),
        DataPoint(7f, 2548.08f),
    )

    LineGraph(
        plot = LinePlot(
            grid = LinePlot.Grid(Color.White.copy(alpha = 0.12f)),
            lines = listOf(
                element = LinePlot.Line(
                    dataPoints = ethereumOneWeek,
                    connection = LinePlot.Connection(color, 2.dp),
                    intersection = null,
                ),
            ),
            xAxis = LinePlot.XAxis(
                steps = 7,
                stepSize = 40.dp,
            ),
        ),
        modifier = Modifier
            .fillMaxWidth()
            .height(200.dp)
    )

chart

@jns-codeworks jns-codeworks changed the title Distance between DataPoints cannot be set LineWidth is not synchronized to XAxisWidth Mar 8, 2022
@thsaravana thsaravana self-assigned this Apr 2, 2022
@GH860
Copy link

GH860 commented Jan 22, 2023

you can change this line val xOffset = 20.dp.toPx() * xZoom.value in draw function to val xOffset = plot.xAxis.stepSize.toPx() * xZoom.value

@superdiazzz
Copy link

you can change this line val xOffset = 20.dp.toPx() * xZoom.value in draw function to val xOffset = plot.xAxis.stepSize.toPx() * xZoom.value

Where i can write this code? please more detail

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants