Shiny hw_网格小部件功能在flexdashboard中不工作

Shiny hw_网格小部件功能在flexdashboard中不工作,shiny,flexdashboard,htmlwidgets,r-highcharter,Shiny,Flexdashboard,Htmlwidgets,R Highcharter,因为这个问题,我想把6张高宪章的图表放在一行,就像它们一样。在flexdashboard data(diamonds, package = "ggplot2") diamonds <- diamonds[-6] map(names(diamonds), function(x){ diamonds[[x]] %>% hchart(showInLegend = FALSE) %>% hc_add_theme(hc_theme_smpl()) %>%

因为这个问题,我想把6张高宪章的图表放在一行,就像它们一样。在
flexdashboard

data(diamonds, package = "ggplot2")
diamonds <- diamonds[-6]

map(names(diamonds), function(x){
  diamonds[[x]] %>% 
    hchart(showInLegend = FALSE) %>% 
    hc_add_theme(hc_theme_smpl()) %>% 
    hc_title(text = x) %>% 
    hc_yAxis(title = list(text = ""))
  }) %>% 
  hw_grid(rowheight = 225, ncol = 3)  %>% browsable()

尝试同时使用
renderUI
htmlOutput
,如下所示:

---
title: "test"
runtime: shiny
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
---
```{r}
library(highcharter)
library(data.table)
library(ggplot2)
library(htmltools)
library(purrr)
library(shiny)
```


### trying to render with hw_grid

```{r}
sliderInput('ncol','ncol',min = 1,max=4,value = 2)
```


```{r}
output$chart1 <- renderUI({
  x <- hchart(data.table(a=c(1:5),b=c(1:5)), type='column', hcaes(x=a,y=b))
  lst <- list(x,x,x,x)
  hw_grid(lst, rowheight = 300,ncol = input$ncol)
})

htmlOutput('chart1')
```

### hw_grid example without rendering

```{r}

x <- hchart(data.table(a=c(1:5),b=c(1:5)), type='column', hcaes(x=a,y=b))
lst <- list(
  x,
  x,
  x,
  x
)
ncol <- 4
# ncol <- input$ncol # need to have a render as this will triger the error: Operation not allowed without an active reactive context....
hw_grid(lst, rowheight = 300,ncol = ncol)  %>% browsable()
```

### rendering example

```{r}
renderHighchart({
  x <- hchart(data.table(a=c(input$ncol*1:5),b=c(.5 * input$ncol * 1:5)), type='column', hcaes(x=a,y=b))

})
```
---
标题:“测试”
运行时间:闪亮
输出:
flexdashboard::flex_仪表板:
方向:行
垂直布局:填充
---
```{r}
图书馆(高级特许)
库(数据表)
图书馆(GG2)
图书馆(htmltools)
图书馆(purrr)
图书馆(闪亮)
```
###尝试使用hw_网格进行渲染
```{r}
滑块输入('ncol','ncol',最小值=1,最大值=4,值=2)
```
```{r}

输出$chart1尝试同时使用
renderUI
htmlOutput
,如下所示:

---
title: "test"
runtime: shiny
output:
  flexdashboard::flex_dashboard:
    orientation: rows
    vertical_layout: fill
---
```{r}
library(highcharter)
library(data.table)
library(ggplot2)
library(htmltools)
library(purrr)
library(shiny)
```


### trying to render with hw_grid

```{r}
sliderInput('ncol','ncol',min = 1,max=4,value = 2)
```


```{r}
output$chart1 <- renderUI({
  x <- hchart(data.table(a=c(1:5),b=c(1:5)), type='column', hcaes(x=a,y=b))
  lst <- list(x,x,x,x)
  hw_grid(lst, rowheight = 300,ncol = input$ncol)
})

htmlOutput('chart1')
```

### hw_grid example without rendering

```{r}

x <- hchart(data.table(a=c(1:5),b=c(1:5)), type='column', hcaes(x=a,y=b))
lst <- list(
  x,
  x,
  x,
  x
)
ncol <- 4
# ncol <- input$ncol # need to have a render as this will triger the error: Operation not allowed without an active reactive context....
hw_grid(lst, rowheight = 300,ncol = ncol)  %>% browsable()
```

### rendering example

```{r}
renderHighchart({
  x <- hchart(data.table(a=c(input$ncol*1:5),b=c(.5 * input$ncol * 1:5)), type='column', hcaes(x=a,y=b))

})
```
---
标题:“测试”
运行时间:闪亮
输出:
flexdashboard::flex_仪表板:
方向:行
垂直布局:填充
---
```{r}
图书馆(高级特许)
库(数据表)
图书馆(GG2)
图书馆(htmltools)
图书馆(purrr)
图书馆(闪亮)
```
###尝试使用hw_网格进行渲染
```{r}
滑块输入('ncol','ncol',最小值=1,最大值=4,值=2)
```
```{r}
产出$chart1