tooltip.c3: C3 Tooltips

Description Usage Arguments Value See Also Examples

View source: R/tooltip.R

Description

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

Usage

1
2
3
4
5
6
tooltip(c3, show = TRUE, grouped = TRUE, format = NULL,
  position = NULL, contents = NULL, ...)

## S3 method for class '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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
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; }')))

c3 documentation built on March 16, 2020, 5:07 p.m.