highcharter (version 0.7.0)

hc_add_dependency: Add modules or plugin dependencies to highcharts objects

Description

Add modules or plugin dependencies to highcharts objects

Usage

hc_add_dependency(hc, name = "plugins/annotations.js")

Arguments

hc

A highchart htmlwidget object.

name

The partial path to the plugin or module, example: "plugins/annotations.js"

Examples

Run this code
# NOT RUN {
highchart() %>% 
 hc_title(text = "I'm a pirate looking chart") %>% 
 hc_xAxis(categories = month.abb) %>% 
 hc_defs(
   patterns = list(
     list(
       id = "custom-pattern",
       path = list(d = "M 0 0 L 10 10 M 9 -1 L 11 1 M -1 9 L 1 11",
                 stroke = "black", strokeWidth = 1
       )
     )
   )
 ) %>% 
 hc_add_series(data = 10 * dt(1 + 1:12 - mean(1:12), df = 2),
               type = "area",
               fillColor = "url(#custom-pattern)") %>% 
 hc_add_theme(hc_theme_handdrawn()) %>% 
 hc_add_dependency(name = "plugins/pattern-fill-v2.js")
 
data(mpg, package = "ggplot2")  
 
hchart(mpg, "point", hcaes(displ, hwy), regression = TRUE,
       regressionSettings = list(type = "polynomial", order = 5, hideInLegend = TRUE)) %>%
  hc_add_dependency("plugins/highcharts-regression.js")
  
hchart(mpg, "point", hcaes(displ, hwy, group = drv), regression = TRUE) %>% 
  hc_colors(c("#d35400", "#2980b9", "#2ecc71")) %>% 
  hc_add_dependency("plugins/highcharts-regression.js")
   

# }

Run the code above in your browser using DataLab