Skip to content

dynamicTicks aggregates sub-second values #1870

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

Closed
FlukeAndFeather opened this issue Oct 24, 2020 · 0 comments · Fixed by #1871
Closed

dynamicTicks aggregates sub-second values #1870

FlukeAndFeather opened this issue Oct 24, 2020 · 0 comments · Fixed by #1871

Comments

@FlukeAndFeather
Copy link
Contributor

If I have a vector of POSIXct values with sub-second increments, then setting dynamicTicks to TRUE aggregates all the values by the second.

library(ggplot2)
library(plotly)
#> 
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#> 
#>     last_plot
#> The following object is masked from 'package:stats':
#> 
#>     filter
#> The following object is masked from 'package:graphics':
#> 
#>     layout
foo <- data.frame(x = as.POSIXct("1970-01-01", tz = "UTC") + (0:999) / 10, 
                  y = sin((0:999) * 8 * pi / 1000))
p <- ggplot(foo, aes(x, y)) +
    geom_line()
ggplotly(p)

ggplotly(p, dynamicTicks = TRUE)

Created on 2020-10-24 by the reprex package (v0.3.0)

FlukeAndFeather pushed a commit to FlukeAndFeather/plotly that referenced this issue Oct 26, 2020
FlukeAndFeather pushed a commit to FlukeAndFeather/plotly that referenced this issue Oct 26, 2020
cpsievert pushed a commit that referenced this issue Dec 8, 2020
* Fix #1870 by explicitly including milliseconds when converting to JSON

* Added visual test for #1870

* Fix POSIXt format for plotly JSON

According to plotly documentation (https://plotly.com/chart-studio-help/date-format-and-time-series/): "Chart Studio’s date format is 'yyyy-mm-dd HH:MM:SS.ssssss'.", so time_format in jsonlite::toJSON() changed to match.

* Fixing time format in test re: #1871

* Update test image for line-milliseconds.svg
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

Successfully merging a pull request may close this issue.

1 participant