Skip to contents

Interactive charts

Usage

chart(
  data = list(),
  mapping = NULL,
  type = c("column", "bar", "area", "line", "scatter", "bubble", "boxPlot", "heatmap",
    "treemap", "radialBar", "pie", "gauge"),
  ...,
  options = list(),
  height = NULL,
  width = NULL,
  elementId = NULL
)

Arguments

data

A data.frame if used with mapping otherwise a configuration list.

mapping

Default list of aesthetic mappings to use for chart if data is a data.frame.

type

Type of chart.

...

Optional arguments (currently not used).

options

A list of options for the chart.

height, width

Height and width for the chart.

elementId

An optional id.

Value

A chart htmlwidget.

See also

chartOutput() / renderChart() for usage in Shiny applications.

Examples

library(toastui)

# Some data
mydata <- data.frame(
  month = month.name,
  value = sample(1:100, 12)
)

# Chart using mapping
chart(mydata, caes(x = month, y = value), type = "bar")
# Otherwise: chart( data = list( categories = mydata$month, series = list( list( name = "Value", data = mydata$value ) ) ), options = list( chart = list(title = "My title"), legend = list(visible = FALSE) ), type = "column" )