rstudio / flexdashboard

Easy interactive dashboards for R
https://pkgs.rstudio.com/flexdashboard/
Other
816 stars 301 forks source link

Printing dashboard #52

Closed michelleclements closed 8 years ago

michelleclements commented 8 years ago

Hi,

Is it possible to print a dashboard?

When I use cmd-p to print this dashboard https://beta.rstudioconnect.com/jjallaire/htmlwidgets-ggplotly-geoms/, there's aren't any graphs and all the text is garbled.

I'm not sure whether this is a bug or if there is a technical reason why it can't be done, but it would be really useful to be able to print out the dashboard.

thanks,

jjallaire commented 8 years ago

No, dashboards aren't really intended to be printed.

On Mon, Jun 6, 2016 at 2:49 PM, Clementine notifications@github.com wrote:

Hi,

Is it possible to print a dashboard?

When I use cmd-p to print this dashboard https://beta.rstudioconnect.com/jjallaire/htmlwidgets-ggplotly-geoms/, there's aren't any graphs and all the text is garbled.

I'm not sure whether this is a bug or if there is a technical reason why it can't be done, but it would be really useful to be able to print out the dashboard.

thanks,

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/rstudio/flexdashboard/issues/52, or mute the thread https://github.com/notifications/unsubscribe/AAGXxzbTNZKPsi0xwzy78WFOxtDLKbfaks5qJGvGgaJpZM4IvMpo .

michelleclements commented 8 years ago

Thanks for the quick reply. I work for an NGO operating mainly in sub-Saharan Africa and flexdashboard seems exactly what we need to share analytical results. However, we also need to be able to print the dashboards (and also save as pdfs) as we can't assume that people will always have internet access.

Being able to print flexdashboards would change the way we are able to work. Consequently, I'd be really grateful if you could please look into the issue. Any help you could give would be amazing.

thanks

jjallaire commented 8 years ago

I'd suggest you just add another format (e.g. pdf_document) alongside the flexdashboard::flex_dashboard format and render to PDF for offline access.

This won't work if you are including htmlwidgets because JavaScript visualizations don't play nicely with print formats like PDF.

On Tue, Jun 14, 2016 at 8:53 AM, Clementine notifications@github.com wrote:

Thanks for the quick reply. I work for an NGO operating mainly in sub-Saharan Africa and flexdashboard seems exactly what we need to share analytical results. However, we also need to be able to print the dashboards (and also save as pdfs) as we can't assume that people will always have internet access.

Being able to print flexdashboards would change the way we are able to work. Consequently, I'd be really grateful if you could please look into the issue. Any help you could give would be amazing.

thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/rstudio/flexdashboard/issues/52#issuecomment-225871515, or mute the thread https://github.com/notifications/unsubscribe/AAGXxwHiPB25eft7ud0GrUhNwQy_zl_uks5qLqQ3gaJpZM4IvMpo .

michelleclements commented 8 years ago

Thank you so much for your help. I've been trying to get your suggestion to work but I'm struggling a bit. Could you please illustrate how I could change the below code to also get a pdf output?


title: "My dashboard" output: flexdashboard::flex_dashboard: orientation: columns

vertical_layout: fill

library(flexdashboard)

Column {data-width=650}

Chart A

Column {data-width=350}

Chart B

Chart C

jjallaire commented 8 years ago

Just add pdf_document as an additional format:

---
title: "My dashboard"
output: 
  pdf_document: default
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill

When you hit the Knit button in RStudio or call the rmarkdown::render function you'll get the first format listed. You can render an individual format as follows:

rmarkdown::render("mydoc.Rmd", output_format = "pdf_document")

You can also render all formats with:

rmarkdown::render("mydoc.Rmd", output_format = "all")

If you get the Preview Release of RStudio then the Knit button will also include a menu that allows you to switch between the various formats within the UI.