lets-plot-kotlin icon indicating copy to clipboard operation
lets-plot-kotlin copied to clipboard

Discrete scale doesn't work for datetime data.

Open AndreiKingsley opened this issue 2 years ago • 0 comments

With default (continuous) scale it works well:

import java.time.Instant.parse

val instants = listOf(
    "2021-01-01T00:00:00Z",
    "2021-02-23T00:00:00Z",
    "2021-04-03T00:00:00Z",
    "2021-05-04T00:00:00Z",
    "2021-10-05T00:00:00Z"
).map(::parse)

val daysData = mapOf<String, Any>(
    "days" to instants,
    "val" to (1..instants.size)
)

letsPlot(daysData) + geomBar() { x = "days"; fill = "days" }
image

But with discrete (via asDiscrete() or scaleFillDiscrete()) formatting is missing (in legend and tooltips)

letsPlot(daysData) + geomBar() { x = "days"; fill = asDiscrete("days") }
image
letsPlot(daysData) + geomBar() { x = "days"; fill = "days" } + scaleFillDiscrete()
image

AndreiKingsley avatar Jan 12 '24 10:01 AndreiKingsley