【问题标题】:Display nvd3 rChart on flexdashboard在 flexdashboard 上显示 nvd3 rChart
【发布时间】:2016-07-01 16:53:23
【问题描述】:

我正在尝试使用flexdashboard 渲染一个nvd3 图表。谁能指出我做错了什么?我已经尝试了一些事情,下面有两个我尝试过的例子。

感谢您的帮助。

flex.Rmd

---
title: "Untitled"
output: 
  flexdashboard::flex_dashboard:
    orientation: columns
    vertical_layout: fill
runtime: shiny
---

```{r setup, include=FALSE}
library(flexdashboard)
library(rCharts)
library(knitr)
library(shiny)

dat <- data.frame(
  t = rep(0:23, each = 4), 
  var = rep(LETTERS[1:4], 4), 
  val = round(runif(4*24,0,50))
)

output$chart1 <- renderChart({
 chrt1 <- nPlot(val ~ t, group =  'var', data = dat, 
 type = 'stackedAreaChart', id = 'chart')

 return(chrt1)
})

chrt1 <- nPlot(val ~ t, group =  'var', data = dat, 
 type = 'stackedAreaChart', id = 'chart')

```

Column {data-width=650}
-----------------------------------------------------------------------

### Chart A

```{r}
# showOutput("chart1", "nvd3")

renderChart({ chrt1$print("hi") })
```

【问题讨论】:

    标签: r shiny nvd3.js rcharts flexdashboard


    【解决方案1】:

    通过集成闪亮的应用程序来实现它。如果有更清洁的解决方案,我仍然会感兴趣。谢谢

    ### Chart A
    
    ```{r}
    shinyApp(
    
      ui = 
        mainPanel(
          showOutput("nplot01", "nvd3")
          ),
    
      server = function(input, output){
        output$nplot01 <- renderChart({
          n1 <- nPlot(val ~ t, group =  'var', data = dat, 
                      type = 'stackedAreaChart', id = 'chart')
          n1$addParams(dom="nplot01", "nvd3")
          n1
        })
      }
    
    )
    ```
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-08-04
      • 1970-01-01
      • 2013-04-20
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多