Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

add_tooltip does not work with layer_lines #472

Open
arjan-hada opened this issue May 18, 2017 · 0 comments
Open

add_tooltip does not work with layer_lines #472

arjan-hada opened this issue May 18, 2017 · 0 comments

Comments

@arjan-hada
Copy link

arjan-hada commented May 18, 2017

The tooltip only shows one value everywhere in the line.

# Function for the tooltip
all_values <- function(x) {
  if(is.null(x)) return(NULL)
  paste0(names(x), ": ", format(x), collapse = "
")
}

by_age <- gss_cat %>%
  filter(!is.na(age)) %>%
  group_by(age, marital) %>%
  count() %>%
  mutate(prop = n / sum(n))

ggvis(by_age, ~age, ~prop, stroke = ~marital) %>% 
  layer_lines() %>% 
  add_tooltip(all_values, "hover")
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant