ui.R 8.98 KB
Newer Older
Stephanie's avatar
Stephanie committed
1 2 3
## app.R ##
library(shiny)
library(shinydashboard)
4 5 6 7
#library(jsonlite)
library(anytime)
#library(leaflet)

Stephanie's avatar
Stephanie committed
8
ui <- dashboardPage(
9 10
  skin="purple",
  
Stephanie's avatar
Stephanie committed
11 12 13
  dashboardHeader(title="CoCoVisR"),
  dashboardSidebar(
    sidebarMenu(
14
      id="tabs",
Stephanie's avatar
Stephanie committed
15
      menuItem("Upload", tabName = "upload", icon =icon("upload")),
16
      menuItem("Data", tabName = "data", icon =icon("list")),
17
      menuItem("Views", tabName = "views", icon = icon("cog")),
18
     # menuItem("Dashboard", tabName = "dashboard", icon = icon("dashboard")),
Stephanie's avatar
Stephanie committed
19 20 21
      menuItem("Help", tabName = "help", icon = icon("book"))
    )
  ),
22
  
Stephanie's avatar
Stephanie committed
23
  dashboardBody(
24 25 26 27
    #tags$head(
    #  tags$link(rel = "stylesheet", type = "text/css", href = "custom.css")
    #),
    
Stephanie's avatar
Stephanie committed
28 29 30
    tabItems(
      # Upload tab content
      tabItem(tabName = "upload",
31
              h2("Upload your data here:"),
32
              fileInput("nut", "Select CoConUT Data (*.json):",
33
                        multiple = TRUE,
34 35 36 37
                        accept = c(
                          "text/json",
                          "text/comma-separated-values,text/plain",
                          ".json")),
38
              fileInput("quest", "Select CoCoQuest Data (*.json):",
39
                        multiple = TRUE,
40 41 42
                        accept = c(
                          "text/json",
                          "text/comma-separated-values,text/plain",
43
                          ".json")),
44
              actionButton("dataSite", "Go to Data")
45
              
Stephanie's avatar
Stephanie committed
46 47
      ),
      
48 49 50
      #show data tab content
      tabItem(tabName = "data",
              
51
                h2("Look into the CoConUT Data:"),
52
                h4("Last Loaded CoConUT Data: "),
53
                textOutput("lastLoadedNut"),
54
                dataTableOutput("nut"),
55
               
56
                h2("Look into the CoCoQuest Data:"),
57
                h4("Last Loaded CoCoQuest Data: "),
58
                textOutput("lastLoadedQuest"),
59 60
                #h4("Starttime: "),
                #textOutput("totalStarttime"),
61
                dataTableOutput("quest"),
62
              actionButton("viewSite", "go to Views")
63 64 65
      ),
      
      
66
      # Controls tab content
67
      tabItem(tabName = "views",
68 69 70 71 72 73 74 75 76 77 78
              fluidPage(
                fluidRow(
                  
                  sidebarLayout(
                    sidebarPanel(
                      h2("Set the Views here:"),      
                       textInput("title", "Title", " "),
                       tabsetPanel(
                                       tabPanel("Barchart",
                                       #Barchart
                                       checkboxInput("check_hist", "Barchart", FALSE),
79 80 81 82 83
                                       selectInput("bar_x", "x-axis", choices=colnames(coconut.df)),
                                       selectInput("bar_y", "y-axis", choices=colnames(coconut.df))
                                       #uiOutput("input_hist_x"),
                                       #uiOutput("input_hist_y")
                                       ),
84 85 86
                                       #TIMELINE
                                       tabPanel("Timeline",
                                       checkboxInput("check_time", "Timeline", FALSE),
87 88 89 90
                                       selectInput("time_data", "data", choices=colnames(coconut.df))
                                       #uiOutput("input_time_x"),
                                       #uiOutput("input_time_y")
                                       ),
91 92 93
                                       #Linechart
                                       tabPanel("Linechart",
                                       checkboxInput("check_line", "Linechart", FALSE),
94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
                                       selectInput("line_x", "x-axis", choices=colnames(coconut.df)),
                                       selectInput("line_y", "y-axis", choices=colnames(coconut.df))
                                       #uiOutput("input_line_x"),
                                       #uiOutput("input_line_y")
                                       ),
                                       #Scatterplot
                                       tabPanel("Scatterplot",
                                                checkboxInput("check_scat", "Scatterplot", FALSE),
                                                selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
                                                selectInput("scat_y", "y-axis", choices=colnames(coconut.df))
                                                ),
                                       #Boxplot
                                       tabPanel("Boxplot",
                                                checkboxInput("check_box", "Boxplot", FALSE),
                                                selectInput("box_x", "x-axis", choices=colnames(coconut.df)),
                                                selectInput("box_y", "y-axis", choices=colnames(coconut.df))
                                       ),
111 112 113
                                       #MAP
                                       tabPanel("Map",
                                       checkboxInput("check_map", "Map", FALSE),
114 115
                                       selectInput("map_data", "data", choices=colnames(coconut.df))
                                       )
116 117 118 119 120 121 122 123
                       )
                  ),
                    mainPanel(column(width = 12,
                                   
                                   h2(textOutput("title")),
                                   
                                   uiOutput("hist_box"),
                                   uiOutput("time_box"),
124
                                   #timevisOutput("time"),
125
                                   uiOutput("line_box"),
126 127
                                   uiOutput("scat_box"),
                                   uiOutput("box_box"),
128 129 130 131 132 133 134 135 136 137 138
                                   uiOutput("map_box"),
                                  
                                   actionButton("screenshot","Download")))
              
                
                
                )#end sidebarlayout
                
                )  #end fluidrow     
              )#end fluidpage
              
139
              #uiOutput("input_map_y"),
140
              #actionButton("dashboardSite", "go to dashboard")
Stephanie's avatar
Stephanie committed
141 142 143
      ),
      
      # Dashboard tab content
144 145 146
      #tabItem(tabName = "dashboard",
              #h2(textOutput("title")),
              #fluidRow(
147 148 149 150 151 152 153 154
                #tabBox(
                  #title = "First tabBox",
                  # The id lets us use input$tabset1 on the server to find the current tab
                  #id = "tabset1", height = "250px",
                  #tabPanel("Tab1", "First tab content"),
                  #tabPanel("Tab2", "Tab content 2")
                #),
                
155
               
156 157 158 159
                #uiOutput("hist_box"),
                #uiOutput("time_box"),
               # uiOutput("line_box"),
                #uiOutput("map_box")
160
                
161 162
             # )
              #actionButton("screenshot","Download")
163
              
164
              #downloadButton("downButton", "Download")
165
              
166
      #),
Stephanie's avatar
Stephanie committed
167 168 169
      
      # Help tab content
      tabItem(tabName = "help",
170 171 172 173 174 175 176
              h2("I am here to Help."),
              "This tool was created to help visualize and analyse data which is recorded with the CoConUT and CoCoQuest Applications.",
              h3("Uploading Data"),
              "Please make sure the files you want to upload are *.json files  Otherwise the upload won't work.", br(),
              "For uploading you have to click on the 'Browse'-Button and an explorer-window will open.", br(),
              "Please navigate to the wanted file, select it and click on 'open'. 
              Then the name of the selected file and a loadingbar will apear. 'Upload complete' will show you that the upload worked and is finished.", br(),
177
              "Please make sure, that you upload the right data into the right field. If not please upload the correct file in the right fields. ", br(),
178
              "First field: CoConUT and second field: CoCoQuest. Otherwise the visualization won't work.",
179
              h3("Data"),
180
              "After correctly loading up the right json files, in this vies will apear a table that shows the data that were red from the jsons. Also the names of the loaded files will apear, here you can check again, if the uploaded files where the right ones.", br(),
181
              h3("Controlls"),
182
              "On this page you are able to select the visualizations you want to use and which data should be in them.", br(), "Also you can enter the title of your dashboard.",
183
              "To show a visualization on the dashboard you have to enable the right checkbox. After that you need to select the x- and y-axis for this visualisation and then it will be added to the dashboard. ",
184
              h3("Dashboard"),
185
              "Here you can now find your selected visualizations. Also there is a download button which will create a screenshot which you can save on your device.", br()
Stephanie's avatar
Stephanie committed
186 187
      )
    
188
    
Stephanie's avatar
Stephanie committed
189
    ))
190
)