c3 {c3}R Documentation

C3

Description

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

Usage

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

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()


[Package c3 version 0.3.0 Index]