I have added in dateInput to give the user the option of selecting between a date range which will then update the graph based on whether the date is within the range selected but I am not totally sure on how to get it into the server side of things?
UI dateInput
dateInput("startdate", "Start Date:", value = "2000-01-01", format = "dd-mm-yyyy",
min = "2000-01-01", max = "2019-08-26"),
dateInput("enddate", "End Date:", value = "2019-08-27", format = "dd-mm-yyyy",
min = "2000-01-02", max = "2019-08-27")
Server:
observeEvent({input$button1 + input$button2 + input$button3 + input$button4},
{
req(input$traffickingType)
if(!is.null(input$Nationality)) {
newNgo <- newNgo %>% filter(Victim.Nationality %in% input$Nationality)
}
if(!is.null(input$victimGender)) {
newNgo <- newNgo %>% filter(Victim.Gender %in% input$victimGender)
}
if(!is.null(input$traffickingType)) {
newNgo <- newNgo %>% filter(Trafficking.Type %in% input$traffickingType)
}
if(!is.null(input$traffickingSubType)) {
newNgo <- newNgo %>% filter(Trafficking.Sub.Type %in% input$traffickingSubType)
}
if(!is.null(input$Source)) {
newNgo <- newNgo %>% filter(Data.Source %in% input$Source)
}
output$coolplot <- renderPlotly(
{
plot_ly(newNgo, labels = ~Trafficking.Type, type = "pie") %>%
layout(showlegend = FALSE)
}
)
})
As I have action buttons and multiple inputs into the graph, this is just one graph entry of 5, I am not sure how to get the data to read the date entered and factor it in!