highcharter is not working in pagedown with rmarkdown

56 Views Asked by At

When working with pagedown in rmarkdown I can not get a highcharter plot working. Below a minor script. Any one a clue what I'm doing wrong?

---
title: "Example highcharter"
author: "Roelof"
output:
 pagedown::html_letter:
 self_contained: true
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)
library(highcharter)
```
# Figure Highcharter
```{r fig, out.width="80%"}
highchart() |>
 hc_chart(type = "bar") |>
 hc_add_series(mtcars, mapping = hcaes(y=mpg), type = "bar") |>
 hc_xAxis(categories = rownames(mtcars))
```
1

There are 1 best solutions below

0
edwindj On

highcharter generates a htmlwidget that is included in the html.

It seems that htmlwidgets are not supported by pagedown at the moment: https://github.com/rstudio/pagedown/issues/58

So not doing anything wrong :-)