Learn R Programming

g2r (version 0.1.0)

gauge_tooltip: Gauge tooltip

Description

Gauge tooltip.

Usage

gauge_tooltip(g2, callback = NULL)

Arguments

g2

An object of class g2r as returned by g2r.

callback

A JavaScript callback function (see cb) which returns a color.

Examples

Run this code
# NOT RUN {
callback <- cb(
  "function(drat, qsec){
    percent = qsec / 100 + '%';
    return {
      name: drat,
      value: percent
    };
  }"
)

template <- '<li>{name}: {value}</li>'

g2(mtcars, asp(mpg, qsec, tooltip = drat, tooltip = qsec, color = qsec)) %>% 
  fig_point() %>% 
  gauge_tooltip(callback) %>% 
  conf_tooltip(itemTpl = template, showTitle = FALSE)

# }

Run the code above in your browser using DataLab