Интеграция между Shiny Flexdashboard и блестящейAmBarCharts - PullRequest
0 голосов
/ 24 марта 2020

Я пытаюсь вставить shinyAmBarCharts диаграмму в с Shiny средой выполнения. Конечная цель - использовать изменяемую диаграмму в качестве входных данных для других диаграмм / моделей. До сих пор у меня не получилось, потому что amBarChart не отображается на панели инструментов. Это пример кода:

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

 ```{r setup, include=FALSE}

 library(flexdashboard)
 library(shiny)
 library(shinyAmBarCharts)
 library(tidyr)


set.seed(666)
df0 <- data.frame(
species = rep(c("sorgho","poacee","banana","triticum"), each = 3),
condition = rep(c("normal", "stress", "Nitrogen"), 4),
 value = rpois(12, 10)
 )
df1 <- spread(df0, condition, value)


output[["data"]] <- renderPrint({
input[["mygroupedbarchart"]]
 })

 output[["change"]] <- renderPrint({ input[["mygroupedbarchart_change"]] })

```

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

### Chart A

 ```{r}
 fluidPage(

       amBarChart(
         "mygroupedbarchart", data = df1, height = "400px",
         category = "species", value = c("normal", "stress", "Nitrogen"),
         valueNames = c("Normal", "Stress", "Nitrogen"),
         minValue = 0, maxValue = 20,
         draggable = c(FALSE, FALSE, TRUE),
         theme = "dark", backgroundColor = "#30303d",
         columnStyle = list(fill = c("darkmagenta", "darkred", "gold"),
                            stroke = "#cccccc", 
                            cornerRadius = 4),
         chartTitle = list(text = "Grouped bar chart", 
                           fontSize = 23, 
                           color = "firebrick"),
         xAxis = list(title = list(text = "Species", 
                                   fontSize = 21, 
                                   color = "silver"),
                      labels = list(color = "whitesmoke", 
                                    fontSize = 17)),
         yAxis = list(title = list(text = "Value", 
                                   fontSize = 21, 
                                   color = "silver"),
                      labels = list(color = "whitesmoke", 
                                    fontSize = 14)),
         columnWidth = 90,
         caption = list(text = "[font-style:italic]shinyAmBarCharts[/]", 
                        color = "yellow"),
         gridLines = list(color = "whitesmoke", 
                          opacity = 0.4, 
                          width = 1),
         tooltip = list(text = "[bold;font-style:italic]{name}: {valueY}[/]", 
                        labelColor = "#101010", 
                        backgroundColor = "cyan", 
                        backgroundOpacity = 0.7)
       )
       )
```

 Column {data-width=350}
  -----------------------------------------------------------------------

 ### Chart B

 ```{r}

        verbatimTextOutput("data")


  ```

 ### Chart C

 ```{r}
       verbatimTextOutput("change")

 ```

, который я в основном скопировал из этих мест:

Я попробовал встроенное с веб-страницы ( https://rmarkdown.rstudio.com/flexdashboard/shiny.html#inline_applications), но в этом случае я не знаю, как повторно использовать изменения, внесенные в диаграмму, в качестве входных данных для другой части .

Any помощь будет высоко ценится.

...