You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
How do I force y axis to use decimal values?
The text was updated successfully, but these errors were encountered:
Hi! It's a Lets-Plot behaviour, tooltip values are automatically formatted based on the data range, which can sometimes result in rounding. However, you can manually adjust the format. We are still working on refining and stabilizing the API for customizing tooltips, but for now, you can solve this issue as follows:
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)
// add id for this data source
y(cost2, "cost2")
// manually add tooltips with `cost2` and adjust format
tooltips("cost2", formats = mapOf("cost2" to ".2f"))
type = LineType.SOLID
}
}
I used this code from kandy examples:
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.
But if I use this dataset instead:
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.
How do I force y axis to use decimal values?
The text was updated successfully, but these errors were encountered: