I want to plot a graph within a shiny app. Then I want to add multiple shades on the same graph. Before i show you my code let me define my sampe data.
dg= reactive ({dygraph(X1(), main ="interactive graph",
              xlab = "time frame",
              ylab = "records" ) %>% dyRangeSelector()  }) 
# I have a table for the shades to be added, it's defined with reactive
shade_tab=reactive({ Panne[Panne$Equipement==input$machine,] })  
# add shades
for( i in 1:nrow(shade_tab())) 
       { dg()= reactive({
               dyShading(dg(), from= shade_tab()$Date[i],
                               to  = shade_tab()$Date[i] + 24*60*60 , 
                             color = 'black'                                
                       })
       } 
  output$dygraph <- renderDygraph({ dg()() })
This is the code I tried to run, but it does not work. Any help will be greatly appreciated.
 
    