flexdashboard icon indicating copy to clipboard operation
flexdashboard copied to clipboard

Multiple graphs and data tables in the sabe page on flexdashboard

Open jessicalfr opened this issue 5 years ago • 1 comments

I need to create plots and data tables in a single tabset in flexdashboard, so I made a different chunk for each output (graph or table). But the outputs doesn't appear with an vertical scroll as I expected, even when using vertical_layout: scroll. The outputs seems to have the right height, but I can't see all of them in the page. My code looks like this:

---
title: "dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
runtime: shiny
---

Column {.tabset}
----------------

### Report

#### Graph 1
```{r}
renderPlot({
# my plot code using ggplot() 
), width = "auto", height = 600}

#### Graph 2
```{r}
renderPlot({
# my plot code using ggplot() 
), width = "auto", height = 600}

#### Table 1
```{r}
renderDataTable({
# my table code using DT::datatable()
), , width = "auto", height = 600, filter = "top"

How can I make a scroll layout so all my outputs appear on that tab?

jessicalfr avatar Apr 15 '19 19:04 jessicalfr

I think you need to set the data-height on the tabset:

---
title: "dashboard"
output: 
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: scroll
---

Column {data-height=2000 .tabset}
----------------

### Report

#### Graph 1
```{r}
library(ggplot2)
library(DT)
ggplot(mtcars, aes(x = mpg, y = disp)) +
  geom_point()

Graph 2

ggplot(mtcars, aes(x = mpg, y = hp)) +
    geom_point()

Table 1

datatable(mtcars)

joshpk avatar Apr 22 '19 21:04 joshpk