HighCharts charts in .pdf report with knitr and RStudio

When I try to incorporate highcharts charts into a .pdf report created from RStudio with Knit to PDF I get an unexpected display.

  1. On the one hand, without defining any option in the fragment (chunk), sometimes the graph is incorporated complete and others incomplete, as I show below, but also, in the same report, two graphs generated practically the same, one complete and one are shown another incomplete. I don't know if it is possible to define a delay in the fragment to allow time for the full display of the graph before processing to incorporate it into the report, if that is the problem.


  1. On the other hand, when I tried to define as an option in the chunk (chunk) out.width = "100%", the result is not what I expected either. And in this case, what would be the correct use of the knitr options for the fragment and to be able to incorporate the graphic by controlling its size, in this case the entire width of the page?

For the first question, the solution is to add the following configuration from highcharter in the graph generation code:

  hc_plotOptions (
   series = list (animation = FALSE)
  )%>%

Now we are missing the second question, which I consider to be specifically a knitr problem. I hope more people in the community have been able to solve.

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.