I have downloaded an example of using shiny and I want to add a simple technical indicator to it.
My problem is that I cannot really see the second graph. Any help suggestion? I have read this: Plotting the same output in two tabPanels in shiny and R Shiny: How to assign the same plot to two different plotOutput I DO exactly the same or at least I think. So I need a small help on that, please
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)