I'm trying to render some graphs with blogdown
(in RMarkdown
).
The problem is that I'm not able to render highcharter
graphs with casper-two
theme.
I'v tried this approach and nothing happens.
After select New Post
in RStudio addin I do this:
```{r}
library(highcharter)
mtcars <- tibble::rownames_to_column(mtcars)
hchart(mtcars, "point", hcaes(wt, mpg, color = hp))
```
And this is what I get:
When I execute the same code above (except by the R
. Rmd chunk part) I can visualize the graph perfectly:
Any help is appreciate.
So the output that you get looks like is the preview of your post on the home page. I can see that when you do go to the post itself, the code retains its pretty output but it's not loading the plot. Some other js/css might be messing with it.
A way to fix this is to wrap the plot in iframe like this:
```{r}
library(highcharter)
library(widgetframe)
mtcars <- tibble::rownames_to_column(mtcars)
frameWidget(hchart(mtcars, "point", hcaes(wt, mpg, color = hp)))
```
To fix the preview section, in your post yaml you can add
description: "Your description"
so that the preview doesn't look so ugly. Another way is to modify the layout of the preview. This is tricky so I would not recommend it.