hover_tip: Create a tooltip for a ggplot in a Shiny application

Description Usage Arguments Value Examples

Description

Create a tooltip for a ggplot in a Shiny application

Usage

1
hover_tip(input$plot_hover, "<b> Hello World </b>")

Arguments

hover_object

The Shiny input object containing the hover info.

content

*Either* a single-row data frame from which to automatically generate a tooltip, *or* a string with the full contents of a custom tooltip, formatted for HTML.

background_color

A hex value, as string, to form the background color of the tooltip

alpha

A number between 0 and 1, to set the opacity of the tooltip background

preferred_side

One of c("right", "left")

h_just

The horizontal distance, in pixels, to move the tooltip to the right. Negative values will move the tooltip to the left.

v_just

The vertical distance, in pixels, to move the tooltip up. Negative values will move the tooltip down.

minimum_h

The minimum horizonal width, in pixels, of the tooltip panel. The panel will squish to be smaller as the cursor approaches the edge of the plotting area, but will not squish smaller than minimum_h.

minimum_v

The minimum vertical width, in pixels, of the tooltip panel. The panel will "squish" to be smaller as the cursor approaches the bottom of the plotting area, but will not squish smaller than minimum_v.

Value

A wellPanel-based on-hover tooltip

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
 ## Not run: 
output$hover_info <- renderUI({
    
  hover_tip(
    hover_object = input$plot_hover,
    content = paste0(
      "<b> Fiscal Year: </b>", shown$Fiscal.Year, "<br/>",
      "<b> Vendor Size: </b>", shown$Vendor.Size, "<br/>",
      "<b> Amount: </b>", money_label(shown$Action.Obligation)))
})

output$hover_info <- renderUI({
  hover_tip(
    hover_object = input$plot_hover,
    content = hover_data(
      chart_data = dataset(),
      hover_object = input$plot_hover,
      chart_type = "bar"))
})


## End(Not run)

CSISdefense/hamre documentation built on May 31, 2019, 7:58 a.m.