gauge_tooltip: Gauge tooltip

Description Usage Arguments Examples

View source: R/gauge.R

Description

Gauge tooltip.

Usage

1
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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
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)

JohnCoene/g2r documentation built on March 6, 2021, 8:11 p.m.