Learn R Programming

rHighcharts (version 1.0)

Chart: Chart class

Description

The Chart class is a wrapper for the Highcharts API. It also includes data() and html() to extend with some additional functionality specific for R users.

Arguments

<code>data()</code>

A method that may take either vectors or data frames as input.

<code>html()</code>

A method to convert the chart object to HTML code. The code does not include necessary JavaScript files (e.g. Highcharts and jQuery); however, when used interactively (show()) or with Shiny, those are automatically included.

Further documentation

For more documentation on the specific Highcharts methods, please visit http://api.highcharts.com/highcharts.

Examples

Run this code
## Not run: 
# 
# library(rHighcharts)
# 
# ### Bar chart
# a <- rHighcharts:::Chart$new()
# a$chart(type = "bar")
# a$plotOptions(column = list(stacking = "normal"))
# a$title(text = "US Personal Expenditure")
# a$yAxis(title = list(text = "US dollars"))
# x <- as.data.frame(t(USPersonalExpenditure))
# a$xAxis(categories = rownames(x))
# a$data(x)
# a  # show chart in browser
# 
# ### Pie chart
# a <- rHighcharts:::Chart$new()
# a$title(text = "Fruits")
# a$data(x = c("Apples","Bananas","Oranges"), y = c(15, 20, 30), type = "pie", name = "amount")
# a
# ## End(Not run)

Run the code above in your browser using DataLab