Chart: Chart class

Description data() html() Further documentation Examples

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.

data()

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

html()

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

 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)

metagraf/rHighcharts documentation built on May 22, 2019, 7:49 p.m.