我正在尝试使用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") })
```
答案 0 :(得分: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
})
}
)
```