File size: 1,886 Bytes
526ed7e e8710e5 e98e810 dcdfe4c 81645ef 526ed7e dcdfe4c 81645ef e98e810 e8710e5 6be8229 81645ef e98e810 81645ef 526ed7e 81645ef e8710e5 81645ef 526ed7e e8710e5 81645ef e8710e5 e98e810 e8710e5 81645ef e8710e5 81645ef e8710e5 dcdfe4c 81645ef 526ed7e |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
library(shiny)
library(shinyjs)
library(shinyWidgets)
library(shinythemes)
library(GWalkR)
ui <- fluidPage(
includeCSS("styles.css"),
useShinyjs(),
setBackgroundColor(color = c("white","#007acc"),gradient = c("linear","radial")),
title = "Data Explorer",
theme = shinytheme("cerulean"),
tags$h3(id = "title", tags$strong("Graphic-Walker Data Explorer"),style = "text-align:center;color:#007acc;"),
tags$a(href = "https://github.com/Ifeanyi55", tags$strong("Maintainer"),target = "_blank",style = "text-decoration:none;color:#007acc;margin-left:1250px;margin-bottom:1000px"),
br(),br(),
sidebarLayout(sidebarPanel = "",
mainPanel(align = "center",
width = 12,
fileInput("target_upload",h5(strong("Click to Upload CSV File"),style = "color:#007acc;"),
accept = c("text/csv"),
buttonLabel = strong("Select File",style = "color:#007acc;"),
placeholder = "No file selected"),
actionButton("reset",strong("Reset"),icon = icon("refresh"),style = "color:#007acc;"),
a(href = "https://github.com/Kanaries/GWalkR",h6(strong("Learn More"),style = "color:#007acc;margin-left:-1220px;margin-top:-170px;font-size:15px;"),target = "_blank",style = "text-decoration: none;"),
gwalkrOutput(outputId = "explorer",width = "101%")
)
)
)
server <- function(input,output,session){
file_upload <- reactive({
inFile <- input$target_upload
if(is.null(inFile)){return(NULL)}
data <- read.csv(inFile$datapath,header = TRUE,sep = ",")
return(data)
})
output$explorer <- renderGwalkr({
tryCatch(
{
gwalkr(file_upload())
},
error = function(e){
message("Could not display interface")
}
)
})
# refresh app
observeEvent(input$reset,{
runjs("location.reload();")
})
}
shinyApp(ui,server)
|