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

add_tooltip does not work with layer_lines #472

@arjan-hada

Description

@arjan-hada

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")

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions