Learn R Programming

c3 (version 0.3.0)

tooltip: C3 Tooltips

Description

Modify plot elements that relate to tooltips. C3.js documentation contains an extended example.

Usage

tooltip(c3, show = TRUE, grouped = TRUE, format = NULL,
  position = NULL, contents = NULL, ...)

# S3 method for c3 tooltip(c3, show = TRUE, grouped = TRUE, format = NULL, position = NULL, contents = NULL, ...)

Arguments

c3

c3 htmlwidget object

show

boolean show or hide tooltips

grouped

boolean

format

list with options:

  • title: character js function, wrap character or character vector in JS()

  • name: character js function, wrap character or character vector in JS()

  • value: character js function, wrap character or character vector in JS()

position

character js function, wrap character or character vector in JS()

contents

character js function, wrap character or character vector in JS()

...

addition options passed to the tooltip object

Value

c3

See Also

Other c3: RColorBrewer, c3, grid, legend, region, subchart, xAxis, zoom

Examples

Run this code
# NOT RUN {
data <- data.frame(a = abs(rnorm(20) *10),
                   b = abs(rnorm(20) *10),
                   c = abs(rnorm(20) *10),
                   d = abs(rnorm(20) *10))
data %>%
  c3() %>%
  tooltip(format = list(title = htmlwidgets::JS("function (x) { return 'Data ' + x; }"),
                        name = htmlwidgets::JS('function (name, ratio, id, index)',
                                               ' { return name; }'),
                        value = htmlwidgets::JS('function (value, ratio, id, index)',
                                                ' { return ratio; }')))

# }

Run the code above in your browser using DataLab