| hd_add_js | R Documentation |
Appends custom JavaScript to a highchart object via
chart.events.<where>. Use this for hand-written callbacks and plugins.
For Highcharts built-in modules (accessibility, exporting, etc.) use
highcharter::hc_add_dependency() instead.
hd_add_js(
hc,
code = NULL,
file = NULL,
plugin = NULL,
where = c("load", "render")
)
hc |
A |
code |
Character or |
file |
Character or |
plugin |
Character or |
where |
|
Exactly one of code, file, or plugin must be supplied.
The highchart object with JS injected.
if (interactive()) {
spec <- hd_spec(mtcars, "wt", "mpg")
fig <- hd_make(spec, "scatter")
fig <- hd_add_js(fig, code = "console.log('chart loaded');")
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.