Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

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.