The Chart class is a wrapper for the Highcharts API. It
html() to extend
with some additional functionality specific for R users.
A method that may take either vectors or data frames as input.
A method to convert the chart object to HTML code. The
Highcharts and jQuery); however, when used interactively
show()) or with Shiny, those are automatically
For more documentation on the specific Highcharts methods, please visit http://api.highcharts.com/highcharts.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
## 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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.