Ifeanyi commited on
Commit
e8710e5
1 Parent(s): 471196c

Update app.R

Browse files
Files changed (1) hide show
  1. app.R +20 -6
app.R CHANGED
@@ -1,4 +1,5 @@
1
  library(shiny)
 
2
  library(shinythemes)
3
  library(shinycssloaders)
4
  library(GWalkR)
@@ -10,15 +11,18 @@ options(spinner.size = 1,
10
 
11
 
12
  ui <- fluidPage(
 
13
  title = "Data Explorer",
14
  theme = shinytheme("cyborg"),
15
  tags$h3(id = "title", tags$strong("Graphic-Walker Data Explorer"),style = "text-align:center;color:lightblue;"),
16
- tags$a(href = "https://github.com/Ifeanyi55", tags$strong("Maintainer"),target = "_blank",style = "text-decoration:none;color:lightblue;margin-left:1230px;"),
17
- tags$img(src = "https://th.bing.com/th/id/OIG2.bWBz_rrx3G45vlu3OK26?pid=ImgGn",width = 170, height = 100),br(),br(),
18
  sidebarLayout(
19
- sidebarPanel(width = 3,style = "border-width:5px;border-color:lightblue;", fileInput("target_upload",h5(strong("Click to Upload CSV File"),style = "color:lightblue;"),
20
  accept = c("text/csv"),
 
21
  placeholder = "No file selected"),
 
22
  br(),br(),a(href = "https://github.com/Kanaries/GWalkR",h6(strong("Learn More"),style = "color:lightblue;"),target = "_blank",style = "text-decoration: none;")),
23
  mainPanel(withSpinner(gwalkrOutput(outputId = "explorer",width = "114%"),type = 1)
24
  )
@@ -27,6 +31,8 @@ ui <- fluidPage(
27
  )
28
 
29
  server <- function(input,output,session){
 
 
30
  file_upload <- reactive({
31
  inFile <- input$target_upload
32
  if(is.null(inFile)){return(NULL)}
@@ -34,18 +40,26 @@ server <- function(input,output,session){
34
  return(data)
35
  })
36
 
 
 
37
  output$explorer <- renderGwalkr({
38
  tryCatch(
39
  {
40
- gwalkr(file_upload())
 
 
41
  },
42
  error = function(e){
43
- message("No CSV file uploaded yet")
44
  }
45
  )
46
  })
 
 
 
 
 
47
  }
48
 
49
- # run app
50
  shinyApp(ui,server)
51
 
 
1
  library(shiny)
2
+ library(shinyjs)
3
  library(shinythemes)
4
  library(shinycssloaders)
5
  library(GWalkR)
 
11
 
12
 
13
  ui <- fluidPage(
14
+ useShinyjs(),
15
  title = "Data Explorer",
16
  theme = shinytheme("cyborg"),
17
  tags$h3(id = "title", tags$strong("Graphic-Walker Data Explorer"),style = "text-align:center;color:lightblue;"),
18
+ tags$a(href = "https://github.com/Ifeanyi55", tags$strong("Maintainer"),target = "_blank",style = "text-decoration:none;color:lightblue;margin-left:1250px;margin-bottom:1000px"),
19
+ tags$img(src = "plot.jpeg",width = 170,height = 100),br(),br(),
20
  sidebarLayout(
21
+ sidebarPanel(width = 3,style = "border-width:5px;border-color:lightblue;border-radius:25px;", fileInput("target_upload",h5(strong("Click to Upload CSV File"),style = "color:lightblue;"),
22
  accept = c("text/csv"),
23
+ buttonLabel = strong("Select. . .",style = "color:lightblue;"),
24
  placeholder = "No file selected"),
25
+ actionButton("reset","Reset",icon = icon("refresh")),
26
  br(),br(),a(href = "https://github.com/Kanaries/GWalkR",h6(strong("Learn More"),style = "color:lightblue;"),target = "_blank",style = "text-decoration: none;")),
27
  mainPanel(withSpinner(gwalkrOutput(outputId = "explorer",width = "114%"),type = 1)
28
  )
 
31
  )
32
 
33
  server <- function(input,output,session){
34
+
35
+
36
  file_upload <- reactive({
37
  inFile <- input$target_upload
38
  if(is.null(inFile)){return(NULL)}
 
40
  return(data)
41
  })
42
 
43
+
44
+
45
  output$explorer <- renderGwalkr({
46
  tryCatch(
47
  {
48
+
49
+ gwalkr(file_upload(),dark = "dark")
50
+
51
  },
52
  error = function(e){
53
+ message("Could not display interface")
54
  }
55
  )
56
  })
57
+
58
+ # refresh app
59
+ observeEvent(input$reset,{
60
+ runjs("location.reload();")
61
+ })
62
  }
63
 
 
64
  shinyApp(ui,server)
65