Description Usage Arguments Examples
Misc helper functions to create interactive charts with rCharts
Create a responsive html page along with javascript library files
1 2 3 4 5 6 7 8 |
x, y, z |
a numeric of same length |
color, name, series |
a character of same length |
series |
a character, the column name in |
df |
a data.frame |
hChart.html, output.html |
character file path to the input highchart html and the output reponsive html |
output |
a path to a folder where the reponsive html file and depending js libraries will be saved |
source, author, h2, descr, h3 |
characters |
overwrite |
a logical, should the |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | ## Not run:
#Example for hSeries to create a labelled bubble scatterchart with rCharts/highcharts
library(swiTheme)
a <- rCharts::Highcharts$new()
x <- 1:10
y <- seq(1, 100, 10)
z <- 10:1
color <- rep(c("grey", "red"), 5)
name <- c("a", "b", "c", "d", "e", "f", "g", "h", "i", "j")
series <- c(rep(c("blob", "poop", "doop"), 3), "asdf")
a$series(hSeries(x,y,z,name, color, series))
# tweak the bubble plot
a$chart(zoomType = "xy", type = "bubble")
a$plotOptions(bubble = list(dataLabels = list(enabled = T, style = list(textShadow = 'none') ,
color = '#aa8959', formatter = "#! function() { return this.point.name; } !#")))
a$colors(swi_rpal)
a$tooltip(formatter = "#! function() { return this.point.name + ':' +this.x + ', ' + this.y; } !#")
a$xAxis(title = list(text = "important indicator", align = "high"), lineColor = list ('#FF0000'))
a
hChart.html <- tempfile("hchart_labelledBubble.html")
a$save(hChart.html)
## End(Not run)
hSeries2 <- hSeries2(data.frame(x = x, y = y, z = z, color = color, name = name, series = series), "series")
b <- rCharts::Highcharts$new()
b$series(hSeries2)
## Not run:
# Example of converting a highcharts-rCharts html chart into a responsive one
hChart2responsiveHTML(hChart.html, source = "source: stupid data")
browseURL(hChart.html)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.