I have recently started using R-Shiny and I have a simple problem due to which I am stuck.
So, I am trying to build a reactive line chart where the user defines the 2 variables from the database.
I have been able to get the variable lists for the drop down but I am not able to use the selected value to plot the line chart.
Refer to the code:
library(shiny)
shinyUI(fluidPage(
# Application title
titlePanel("ARIMAX Forecasting Tool"),
sidebarLayout(
sidebarPanel(
...
mainPanel(
tabsetPanel(type = "tabs",
tabPanel("Plot", plotOutput("plot")),
tabPanel("Summary")
)
)
)
))
and the partial server code
shinyServer(function(input, output) {
output$plot <- renderPlot({
inFile <- input$file1
if (is.null(inFile))
return(NULL)
content1=read.csv(inFile$datapath, header=input$header, sep=input$sep
)
h=input$x
k=input$ts
plot(content1$k,content1$h,type="l")
})
})
I have skipped the part where I write the render UI to get the user selected variables.x
and ts
are the variable selected by the user for the line chart.
I get an error in the main panel area:
need finite xlim values