Skip to content

How to force y Axis to use floating point precision? #462

@parrotcar00

Description

@parrotcar00

I used this code from kandy examples:

val years = listOf(1, 2, 3, 4, 5)
val cost = listOf(62.7, 39.3, 72.1, 73.7, 68.5)

plot {
    line {
        x(years)
        y(cost)
        type = LineType.SOLID
    }
}

And when you hover over the resultant plot values, we see y axis labels that correctly show values with decimal point like 62.7, 72.1 etc.

Image

But if I use this dataset instead:

val years2 = listOf(1, 2, 3, 4, 5)
val cost2 = listOf(95.0, 2.2, 3.3, 4.4, 5.5)

plot {
    line {
        x(years2)
        y(cost2)
        type = LineType.SOLID
    }
}

I get a plot where all y values are rounded off to the nearest integer. I don't understand what is causing this and how to force y axis to be of Double type.

Image

How do I force y axis to use decimal values?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions