Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.57 KB | None | 0 0
  1. data_sub = reactive({
  2. data_sub_temp = df[df$market == input$market_selector,]
  3. return(data_sub_temp)
  4. })
  5.  
  6.  
  7. output$market_plot <- renderPlotly({
  8. plot_ly(
  9. data = data_sub,
  10. x = ~ created,
  11. y = ~ pax,
  12. group_by = ~ type,
  13. color = ~ type,
  14. type = "scatter",
  15. mode = "lines+markers",
  16. hoverinfo = 'text',
  17. text = ~ paste('Year:', created,
  18. '</br> </br> Clients: ', pax)
  19. )
  20. })
  21.  
  22. actionButton(
  23. inputId = "submit_loc",
  24. label = "Submit")
  25.  
  26. observeEvent(
  27. eventExpr = input[["submit_loc"]],
  28. handlerExpr = {
  29.  
  30. data_sub <- df[df$market == input$market_selector,]
  31.  
  32. output$market_plot <- renderPlotly({
  33. plot_ly(
  34. data = data_sub,
  35. x = ~ created,
  36. y = ~ pax,
  37. group_by = ~ type,
  38. color = ~ type,
  39. type = "scatter",
  40. mode = "lines+markers",
  41. hoverinfo = 'text',
  42. text = ~ paste('Year:', created,
  43. '</br> </br> Clients: ', pax)
  44. )
  45. })
  46.  
  47. })
  48.  
  49. data_sub <- reactive({df[df$market == input$market_selector,]})
  50.  
  51. output$market_plot <- renderPlotly({
  52. plot_ly(
  53. data = data_sub(),
  54. x = ~ created,
  55. y = ~ pax,
  56. group_by = ~ type,
  57. color = ~ type,
  58. type = "scatter",
  59. mode = "lines+markers",
  60. hoverinfo = 'text',
  61. text = ~ paste('Year:', created,
  62. '</br> </br> Clients: ', pax)
  63. )
  64. })
  65.  
  66. output$market_plot <- renderPlotly({
  67. plot_ly(
  68. data = data_sub(),
  69. x = ~ created,
  70. y = ~ pax,
  71. group_by = ~ type,
  72. color = ~ type,
  73. type = "scatter",
  74. mode = "lines+markers",
  75. hoverinfo = 'text',
  76. text = ~ paste('Year:', created,
  77. '</br> </br> Clients: ', pax)
  78. )
  79. })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement