2

我正在尝试nvd3使用flexdashboard. 谁能指出我做错了什么?我已经尝试了一些东西,下面有两个我尝试过的例子。

谢谢你的帮助。

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") })
```
4

1 回答 1

0

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

### 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
    })
  }

)
```
于 2016-07-05T09:46:05.587 回答