You are not including an output for the plot in your UI function i.e. plotOutput()
Does, this work for you?
library(shiny)
library(RODBC)
library(ggplot2)
ui <- fluidPage(
h5("R Shiny Demo - dateInput widget"),
hr(),
dateInput("date",
label="Date Input",
value = Sys.Date(),
min = Sys.Date() - 10,
max = Sys.Date() + 10,
width = "100px",
format="yyyy-mm-dd"),
plotOutput("main_plot")
)
shinyServer <- function(input, output, session) {
dbhandle <- odbcDriverConnect('driver={SQL Server};server=xxxx\\xxxx;database=xxxx;trusted_connection=true')
output$main_plot <- renderPlot ({
currTableSQL <- paste("select CUSIP, sum(MarketValue)/100000000 as MV from dbo.Position
where _FILEDATE = '",input$date,"'
and CUSIP in ('BRS28U233','B0A09Z738','BSR4XWWC3','BSR21JQP9','BRS3ZWL36','BSR4JTZB5')
group by CUSIP
;")
currTableDF <- sqlQuery(dbhandle,currTableSQL)
ggplot(currTableDF, aes(CUSIP,MV, color = "red", fill = "red")) +
geom_col()
})
}
shinyApp(ui, shinyServer)