c3: C3

Description Usage Arguments See Also Examples

View source: R/c3.R

Description

An 'R' wrapper, or htmlwidget, for the c3 javascript charting library by Masayuki Tanaka.

Usage

1
2
3
c3(data, x = NULL, y = NULL, group = NULL, width = NULL,
  height = NULL, axes = NULL, labels = NULL, hide = NULL,
  onclick = NULL, onmouseover = NULL, onmouseout = NULL, ...)

Arguments

data

data.frame or tibble

x

character column name

y

character column name

group

character column name

width

integer htmlwidget width (separate from plot width)

height

integer htmlwidget height (separate from plot height)

axes

list, use to assign plot elements to secondary y axis

labels

character or list with options:

  • format: list format functions for each parameter label (see c3 data-labels)

hide

boolean or character vector of parameters to hide

onclick

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

onmouseover

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

onmouseout

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

...

addition options passed to the data object

See Also

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

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data <- data.frame(a = c(1,2,3,2), b = c(2,3,1,5))

data %>%
  c3(onclick = htmlwidgets::JS("function(d, element){console.log(d)}"))

data %>%
  c3(axes = list(a = 'y',
                 b = 'y2')) %>%
  y2Axis()

data.frame(sugar = 20, fat = 45, salt = 10) %>%
  c3(onclick = htmlwidgets::JS("function(d, element){dp = d}")) %>%
  c3_pie()

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

Related to c3 in c3...