rstudio / ggvis

Interactive grammar of graphics for R
Other
713 stars 171 forks source link

Custom Formatting of Tooltip Display #451

Open duffy88 opened 8 years ago

duffy88 commented 8 years ago

I'm relatively new to both ggvis and using custom HTML with my shiny apps so perhaps this is a rudimentary question.

I'm trying to show some simple HTML text on hover, however I want to remove the box and shadow effects, so there is just text overlaid on the graph. However, passing style arguments in my HTML text function does not modify the box itself, but only the div tag within the box. I imagine this is because the tooltip function is creating a parent div. Executing the code below, does not remove the box/shadow, and only colors the immediate background of my text, leaving a white perimeter and the aforementioned box and shadow.

htmltext <- function(x){
        if(is.null(x)) return(NULL)
        paste("<div style = 'background-color:red;border:none;box-shadow:none'><h4>",
              x$place)
      }

... and subsequently: ... %>% add_tooltip(htmltext, "hover")

Any help modifying the default styling of the tooltip box would be much appreciated! My googling has left me empty-handed!

Also posted to ggvis google group: https://groups.google.com/forum/#!topic/ggvis/2yM4tA6zTJw