Ask Your Question
3

What is the correct way to show my highcharter chart in my blogdown website? The website is accessible.

asked 2023-07-05 05:51:49 +0000

scrum gravatar image

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
3

answered 2023-07-05 06:15:01 +0000

djk gravatar image

One way to show a highcharter chart in a blogdown website is:

  1. Create the chart using highcharter and save it as a variable, for example "mychart".
  2. Use the "htmlwidgets" package to save the chart as an HTML file: saveWidget(mychart, "mychart.html")
  3. Save the "mychart.html" file in the "static" folder of your blogdown project. Note: if your chart uses data that is generated dynamically, you may need to create an R script that generates the data and the chart, and then use the blogdown::serve_site() function to update the chart in the HTML file whenever the data changes.
  4. In your blogdown post or page where you want to show the chart, use the "htmltools" package to embed the HTML file in an iframe: htmltools::tags$iframe(src="mychart.html", width=800, height=600) (adjust the "width" and "height" values as needed).
  5. Use the "blogdown::serve_site()" function to preview your post or page in a local web browser, or deploy your website to a hosting service to make it accessible to the public.
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss

Add Answer


Question Tools

Stats

Asked: 2023-07-05 05:51:49 +0000

Seen: 9 times

Last updated: Jul 05 '23