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

filter_slider should default to round = TRUE when the column is an integer #152

Open
EDAlnor opened this issue Aug 10, 2024 · 0 comments
Open

Comments

@EDAlnor
Copy link

EDAlnor commented Aug 10, 2024

Hi, experienced R user here, but first time ever posting on github, so please excuse any errors and just let me know if I am not following conventions.

I'm using crosstalk with plot_ly. If the column I provide as filter_slider is an integer, it seems logical to me that decimals should not be shown, i.e., its verbose that I have to provide round = T as an option.

For example in:

library(plotly)
library(dplyr)
library(crosstalk)

df <- data.frame(
  area  = rep(c('a', 'b', 'c'), 3),
  value = runif(9, min = 0, max =10),
  year  = as.integer(c(1,1,1,2,2,2,3,3,3))
) %>% highlight_key()

widget <- filter_slider(id = 'year', label = 'Year', dfk, ~mnum)

bscols(
  widget,
  plot_ly(df, x = ~year, y = ~value) %>% add_lines(color = ~area)
)

...the slider lets me select 6.5, 4.2, and so on, which shouldn't be possible given that year is an integer.

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

1 participant