R 闪亮的建筑2个图形一个在另一个下面

R 闪亮的建筑2个图形一个在另一个下面,r,shiny,R,Shiny,我已经下载了一个使用shiny的示例,我想在其中添加一个简单的技术指标 我的问题是我看不到第二张图。 有什么有用的建议吗? 我读过这篇:和 我也这么做,至少我认为是这样。所以我需要一点帮助 library(shiny) ui <- shinyUI(fluidPage( titlePanel("Simple Stock Charting App"), sidebarLayout( sidebarPanel( textInput("sym

我已经下载了一个使用shiny的示例,我想在其中添加一个简单的技术指标

我的问题是我看不到第二张图。 有什么有用的建议吗? 我读过这篇 我也这么做,至少我认为是这样。所以我需要一点帮助

library(shiny)
ui <- shinyUI(fluidPage(
  titlePanel("Simple Stock Charting App"),

      sidebarLayout(
        sidebarPanel(

          textInput("symb", label = h3("Input a Valid Stock Ticker"), value = "GE") 
        ),

           ### uncomment for dygraphs chart
        mainPanel(dygraphOutput("plot")),
        mainPanel(plotOutput("plot2"))
      )
    ))

    library(quantmod)
    library(dygraphs)
    library(TTR)
    server <- shinyServer(function(input, output) {

      dataInput <- reactive({

        prices <- getSymbols(input$symb, auto.assign = FALSE)

      })

      output$plot <- renderDygraph({renderPlot

        prices <- dataInput()

        dygraph(Ad(prices)) %>%
          dyRangeSelector() 
        })

        output$plot2 <- renderPlot({

          prices <- dataInput()
          prices <- Ad(prices)
          plotOutput((RSI(prices, n = 14))) %>%  dyRangeSelector()

           })
    })


    shinyApp(ui,server)
库(闪亮)

ui假设第一个是动态图,第二个是正常的

library(shiny) 
library(quantmod)
library(dygraphs)
library(TTR)

ui <- shinyUI(fluidPage( titlePanel("Simple Stock Charting App"),

                                        sidebarLayout(
                                          sidebarPanel(

                                            textInput("symb", label = h3("Input a Valid Stock Ticker"), value = "GE") 
                                          ),


                                          mainPanel(fluidRow(dygraphOutput("plot"),
                                                     plotOutput("plot2")))
                                        )
))


server <- shinyServer(function(input, output) {

  dataInput <- reactive({

    prices <- getSymbols(input$symb, auto.assign = FALSE)

  })

  output$plot <- renderDygraph({renderPlot

    prices <- dataInput()

    dygraph(Ad(prices)) %>%
      dyRangeSelector() 
  })

  output$plot2 <- renderPlot({

    prices <- dataInput()
    #prices <- Ad(prices)
    plot(prices)

  })
})


shinyApp(ui,server)
库(闪亮)
图书馆(quantmod)
图书馆(动态图)
图书馆(TTR)

ui假设第一个是动态图,第二个是正常的

library(shiny) 
library(quantmod)
library(dygraphs)
library(TTR)

ui <- shinyUI(fluidPage( titlePanel("Simple Stock Charting App"),

                                        sidebarLayout(
                                          sidebarPanel(

                                            textInput("symb", label = h3("Input a Valid Stock Ticker"), value = "GE") 
                                          ),


                                          mainPanel(fluidRow(dygraphOutput("plot"),
                                                     plotOutput("plot2")))
                                        )
))


server <- shinyServer(function(input, output) {

  dataInput <- reactive({

    prices <- getSymbols(input$symb, auto.assign = FALSE)

  })

  output$plot <- renderDygraph({renderPlot

    prices <- dataInput()

    dygraph(Ad(prices)) %>%
      dyRangeSelector() 
  })

  output$plot2 <- renderPlot({

    prices <- dataInput()
    #prices <- Ad(prices)
    plot(prices)

  })
})


shinyApp(ui,server)
库(闪亮)
图书馆(quantmod)
图书馆(动态图)
图书馆(TTR)
ui这应该可以完成任务

library(shiny)
library(quantmod)
library(dygraphs)
library(TTR)
ui <- shinyUI(fluidPage(
  titlePanel("Simple Stock Charting App"),

  sidebarLayout(
    sidebarPanel(
      textInput("symb", label = h3("Input a Valid Stock Ticker"), value = "GE") 
    ),

    ### uncomment for dygraphs chart
    mainPanel(dygraphOutput("plot"),plotOutput("plot2"))
  )
))


server <- shinyServer(function(input, output) {

  dataInput <- reactive({
    prices <- getSymbols(input$symb, auto.assign = FALSE)
  })

  output$plot <- renderDygraph({renderPlot
    dygraph(Ad(dataInput())) %>%dyRangeSelector() 
  })

  output$plot2 <- renderPlot({
    plot((RSI(Ad(dataInput()), n = 14))) 
  })
})


shinyApp(ui,server)
库(闪亮)
图书馆(quantmod)
图书馆(动态图)
图书馆(TTR)
ui这应该可以完成任务

library(shiny)
library(quantmod)
library(dygraphs)
library(TTR)
ui <- shinyUI(fluidPage(
  titlePanel("Simple Stock Charting App"),

  sidebarLayout(
    sidebarPanel(
      textInput("symb", label = h3("Input a Valid Stock Ticker"), value = "GE") 
    ),

    ### uncomment for dygraphs chart
    mainPanel(dygraphOutput("plot"),plotOutput("plot2"))
  )
))


server <- shinyServer(function(input, output) {

  dataInput <- reactive({
    prices <- getSymbols(input$symb, auto.assign = FALSE)
  })

  output$plot <- renderDygraph({renderPlot
    dygraph(Ad(dataInput())) %>%dyRangeSelector() 
  })

  output$plot2 <- renderPlot({
    plot((RSI(Ad(dataInput()), n = 14))) 
  })
})


shinyApp(ui,server)
库(闪亮)
图书馆(quantmod)
图书馆(动态图)
图书馆(TTR)
用户界面