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

Provide 0-23 hour formatting #469

Closed
vlsi opened this issue Oct 31, 2021 · 0 comments
Closed

Provide 0-23 hour formatting #469

vlsi opened this issue Oct 31, 2021 · 0 comments
Assignees

Comments

@vlsi
Copy link

vlsi commented Oct 31, 2021

The current %H results in 01-24 output which looks surprising for the horizontal axis:
sample chart

What I want is to represent "time since the beginning", so I would expect 00 to be formatted as 00 rather than 24.
Unfortunately, 0->24 conversion is hardcoded in

private fun getHours24(dateTime: DateTime): Int =
when(dateTime.hours) {
0 -> 24
else -> dateTime.hours
}

The data is

val data = mapOf(

    "time" to doubleArrayOf(0.0, 90*60*1000.0, 2*90*60*1000.0) ,

    "rate" to doubleArrayOf(0.0, 50.0, 250.0)

)

val plot = letsPlot(data) + geomLine { x = "time"; y = "rate" } +

        scaleXDateTime("Time", expand = listOf(0, 0), format = "%Hh %Mm")
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

2 participants