I have created a line plot
using highchart
and I am looking to insert a background image to the plot. Referred to SO post R shiny: how to embed a background image in a plot created with rCharts / Highcharts? and tried adding plotBackgroundImage
to the plot but it doesn't work.
mtcars %>%
hchart(type = "line", plotBackgroundImage = "folder/image_name.jpg",
name = "Covid test",
hcaes(x = wt,
y = mpg, col = cyl))
UPDATE
Plot result without image background:
Update2
Doesn't work for reading jpg from local directories:
highchart() %>%
hc_add_series(
type = "line",
data = mtcars, hcaes(x = wt, y = mpg)
) %>%
hc_chart(events = list(load = JS("function() {
var chart = this; chart.update({
chart: {
type: 'line',
plotBackgroundImage: 'E:/3. R/Covid19 clean data & app 2021-Apr-03/Covid 19 images/coronavirus-4972480_1920.jpg'
}
});
}
")
))
works when read thro' url:
highchart() %>%
hc_add_series(
type = "line",
data = mtcars, hcaes(x = wt, y = mpg)
) %>%
hc_chart(events = list(load = JS("function() {
var chart = this; chart.update({
chart: {
type: 'line',
plotBackgroundImage: 'https://www.highcharts.com/samples/graphics/skies.jpg'
}
});
}
")
))
Update3:
I gave all Permissions for this folder and still not getting background Image