server.R 15.8 KB
Newer Older
Stephanie's avatar
Stephanie committed
1 2

library(shiny)
3
library(jsonlite)
4
library(DT)
5
library(webshot)
6
library(knitr)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
7
library(leaflet)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
8
library(mapview)
9
library(ggplot2)
10
library(timevis)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
11
#library(plotly)
Stephanie's avatar
Stephanie committed
12

13

14

15
server <- function(input, output, session) {
Stephanie's avatar
Stephanie committed
16
  set.seed(122)
17
  
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
18 19
  
  #Continue to data page  
20 21 22
  observeEvent(input$dataSite, {
    
    updateTabItems(session, "tabs",selected = "data")
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
23
    
24
  })
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
25
  #DATA PAGE
26
  
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
27
  
28
  
29
  #CoConUT Data import 
30 31
  output$nut <- renderDataTable({
    inFile <- input$nut
32 33
    if (is.null(inFile))
      return(NULL)
34
    
35
    #loading CoConUT data
36
    json_data_coco <- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
37
    coconut.df <<- json_data_coco[["data"]]
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
38
    
39
    lastCoConUT <<- inFile$name
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
40
    #print("coconut:")
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
41
    
42
    #coconut.df$timestamp <- format(coconut.df$timestamp, format="%d-%B-%Y %H:%M:%S")
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
43
    
44
    
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
45
    #print(coconut.df)
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96
    if(is.null(coconut.df$timestamp)){}
    else{unixTime<<-coconut.df$timestamp}
    
    if(is.null(coconut.df$gps.latitude)){}
    else{latitude<<-coconut.df$gps.latitude}
    
    if(is.null(coconut.df$gps.longitude)){}
    else{longitude<<-coconut.df$gps.longitude}
    
    if(is.null(coconut.df$gps.speed)){}
    else{speed<<-coconut.df$gps.speed}
    
    if(is.null(coconut.df$gps.accuracy)){}
    else{gpsAcc<<-coconut.df$gps.accuracy}
    
    if(is.null(coconut.df$light.lux)){}
    else{lux<<-coconut.df$light.lux}
    
    if(is.null(coconut.df$acc.coordinates)){}
    else{accCoord<<-coconut.df$acc.coordinates}
    
    if(is.null(coconut.df$acc.accuracy)){}
    else{accAcc<<-coconut.df$acc.accuracy}
    
    if(is.null(coconut.df$bluetooth.numOfBTDevices)){}
    else{bluetooth<<-coconut.df$bluetooth.numOfBTDevices}
    
    if(is.null(coconut.df$ble.bpm)){}
    else{bleBpm<<-coconut.df$ble.bpm}
    
    if(is.null(coconut.df$ble.bpmlist)){}
    else{bleBpmList<<-coconut.df$ble.bpmlist}
    
    if(is.null(coconut.df$ble.hrv)){}
    else{bleHrv<<-coconut.df$ble.hrv}
    
    if(is.null(coconut.df$ble.hrvlist)){}
    else{bleHrvList<<-coconut.df$ble.hrvlist}
    
    if(is.null(coconut.df$activity.name)){}
    else{activityName<<-coconut.df$activity.name}
    
    if(is.null(coconut.df$activity.confidence)){}
    else{activityConf<<-coconut.df$activity.confidence}
    
    if(is.null(coconut.df$screen.status)){}
    else{screenstatus<<-coconut.df$screen.status}
    
    if(is.null(coconut.df$interaction.touch)){}
    else{touch<<-coconut.df$interaction.touch}
    
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
97 98
    
    
99
    # setting the table style
100
    datatable(
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
101 102 103 104 105 106 107 108 109 110 111
      cbind(coconut.df), 
      options = list(
        searching = TRUE,
        autoWidth = TRUE,
        rownames = FALSE,
        scroller = TRUE,
        scrollX = TRUE,
        scrollY = "500px",
        fixedHeader = TRUE,
        class = 'cell-border stripe'
      )
112
    )
113
  })
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
114 115 116 117 118 119 120
  #last coconut_name
  output$lastLoadedNut<- renderText({
    if (is.null(input$nut))
      return(NULL)
    else lastCoConUT
  })
  
121 122
  #CoCoQuest Data import
  output$quest <- renderDataTable({
123 124 125 126
    inFile <- input$quest
    if (is.null(inFile))
      return(NULL)
    
127 128
    #loading CoCoQuest data
    json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
129
    
130
    lastCoCoQuest <<- inFile$name
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
131
    totalST <<- c(anytime(as.numeric(json_data_quest$startTime)/1000))
132 133
    print(json_data_quest)
    
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
134
    
135
    #unix  parsed
136
    dat <- do.call(rbind, json_data_quest$tasks$data)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
137
    
138
    endtimes <<- c(dat$endtime)
139
    
140
    parsedEndtimes <<- anytime(endtimes/1000)
141 142
    #endtimes <<- format(dat$endtime, format="%d-%B-%Y %H:%M:%S")
    print("endtime quest")
143
    print(parsedEndtimes)
144
    tasks <- rep(1:length(json_data_quest$tasks$data), sapply(json_data_quest$tasks$data, nrow))
145 146
    #questions 
    #print("Questions:", questions)
147
    together <<- c(tasks, endtimes)
148 149
    print("together")
    print(together)
150
    all <- rbind(together)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
151
    
152
    #setting the table style
153
    datatable(
154
      cbind(tasks, endtimes),
155
      options = list(
156 157
        searching = FALSE,
        rownames = TRUE,
158
        class = 'cell-border stripe'
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
159
      )
160 161
    )
  })
162 163 164 165 166 167 168
  
  #last cocoquest_name
  output$lastLoadedQuest <- renderText({
    if (is.null(input$quest))
      return(NULL)
    else lastCoCoQuest
  })
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
169
  
170
  #cocoQuest Starttime
171 172 173
  output$totalStarttime <- renderText({
    if (is.null(input$quest))
      return(NULL)
174
    else {
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
175
      format(totalST, format="%d-%B-%Y %H:%M:%S")
176 177
      
    }
178
  })
179
  
180 181
  #Continue to view page  
  observeEvent(input$viewSite, {
182
    
183
    updateTabItems(session, "tabs",selected = "views")
184 185 186
    
  })
  
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
187
  #View PAGE
188 189
  
  #Title Input
190
  output$title <- renderText({ input$title })
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
191
  
192
  #barchart
193
  output$input_hist_x <- renderUI({
194
    if (is.null(input$nut))
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
195
      return(NULL)
196
    selectInput("in1", "x-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
197 198 199
  })
  
  output$input_hist_y <- renderUI({
200 201
    if (is.null(input$nut))
      return(NULL)
202
    selectInput("in2", "y-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
203 204
  })
  
205
  
206
  #Timeline
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
207
  
208
  output$input_time_x <- renderUI({
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
209 210
    if (is.null(input$nut))
      return(NULL)
211
    selectInput("in3", "x-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
212
  })
213
  
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
214
  output$input_time_y <- renderUI({
215 216
    if (is.null(input$nut))
      return(NULL)
217
    selectInput("in4", "y-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
218 219
  })
  
220
  
221
  #Map
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
222
  output$input_map <- renderUI({
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
223 224 225 226
    if (is.null(input$nut))
      return(NULL)
    selectInput("in5", "Data:", cbind("unixTime", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
  })
227
  
228 229
  output$input_map_x <- renderUI({
    if (is.null(input$nut))
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
230
      return(NULL)
231 232 233 234 235 236 237 238
    selectInput("in5", "x-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
  })
  
  output$input_map_y <- renderUI({
    if (is.null(input$nut))
      return(NULL)
    selectInput("in6", "y-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
  })
239
  
240
  
241
  #linechart
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
242
  
243
  output$input_line_x <- renderUI({
244 245
    if (is.null(input$nut))
      return(NULL)
246
    selectInput("in7", "x-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
247 248 249
  })
  
  output$input_line_y <- renderUI({
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
250
    if (is.null(input$nut))
251
      return(NULL)
252
    selectInput("in8", "y-axis:", cbind("unixTime", "longitude", "latitude", "speed", "gps.acc","lux", "light.acc","acc.coordinates", "acc.acc","bluetooth","ble.bpm","ble.bpmlist","ble.hrv","ble.hrvlist","activity.name", "acctivity.confidence","screen.status" ,"touch"),multiple=TRUE, selectize=TRUE) 
253
  })
254
  
255
  
256 257
  #Continue to dashboard page  
  observeEvent(input$dashboardSite, {
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
258
    
259
    updateTabItems(session, "tabs",selected = "dashboard")
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
260
    
261
  })
262
  plotCounter <<- 0
263
  #ADD BARCHART BUTTON
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290
  observeEvent(input$check_hist, {
    
    plotCounter<<-plotCounter+1
    print(plotCounter)
    plotname <- paste("plot", plotCounter, sep="")
    print(plotname)
    xplotname<- paste("x",plotname,sep="")
    yplotname<-paste("y",plotname, sep="")
    insertUI(
      
      selector= "#viewpanel", #wo will ichs hinhaben
      ui= box(  title="Barchart",
                status= "warning",
                solidHeader = TRUE,
                collapsible = TRUE,
                
                selectInput(xplotname, "x-axis", choices=colnames(coconut.df)),
                selectInput(yplotname, "y-axis", choices=colnames(coconut.df)),
                
                plotOutput(plotname, height = 250))
    )
    
    
  })
  
  #DASHBOARD  
  #BAR VIEW
291
  
292 293 294
  local({     
    
    
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
295 296 297 298 299 300 301 302 303 304 305 306 307
    
    output[[plotname]] <- renderPlot({
      print(plotname)
      
      data<- structure(list(V1=as.numeric(coconut.df[[input$xplotname]]), 
                            V2=as.numeric(coconut.df[[input$yplotname]])),
                       .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
      #Neues Plot
      barplot(data$V1,data$V2, 
              ylab= input$yplotname,
              xlab=input$xplotname)
      
    })
308
  })
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326
  
  ## ALTES PLOT
  #a=1
  
  #for(a in 1:length(coconut.df$bluetooth.numOfBTDevices)){
  
  #g <-geom_bar(mapping = NULL, data = , stat = "count",
  #             position = "stack", width = NULL, binwidth = NULL, na.rm = FALSE,
  #             show.legend = NA, inherit.aes = TRUE)
  
  #g <- ggplot(coconut.df, aes("timestamp","bluetooth"))
  #g + geom_bar()
  # a=a+1}
  
  #g
  #hist(bluetooth)
  
  
327 328 329 330 331 332
  
  
  #TIMELINE
  output$time_box <- renderUI({
    if(input$check_time)
      box(  title="Timeline",
333 334 335
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
336
            timevisOutput("time", height = 250)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
337
      )
338 339
  })
  
340 341
  #TODO: Timelineview
  output$time <- renderTimevis({
342
    print("TIME wird aufgerufen")
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
343
    
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358
    print("Length:")
    print(length(parsedEndtimes))
    print("combined")
    print( c(anytime(totalST), head(parsedEndtimes, -1)))
    print("endtimes")
    print(parsedEndtimes)
    
    
    data <-  data.frame(
      id      = 1:length(parsedEndtimes),
      content= c(1:length(parsedEndtimes)),
      start   = c(anytime(totalST), head(parsedEndtimes, -1)),
      end     = parsedEndtimes
    )
    timevis(data)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
359
    
360
  })
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
361
  
362 363 364
  output$texttimeline <- renderText({
    "Check Timeline for getting a Timeline about CoCoQuest Tasks and Questions."
  })
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
365 366
  
  
367 368 369 370 371 372 373 374
  
  #linechart
  output$line_box <- renderUI({
    if(input$check_line)
      box(  title="Linechart",
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
375 376 377
            selectInput("line_x", "x-axis", choices=colnames(coconut.df)),
            selectInput("line_y", "y-axis", choices=colnames(coconut.df)),
            #add_tooltip(data_tooltip, "hover"),
378 379 380 381 382 383
            plotOutput("line", height = 250))
  })
  
  #TODO: linechart View
  output$line <- renderPlot({
    print("LINE wird aufgerufen")
384 385 386 387
    data<- structure(list(V1=as.numeric(coconut.df[[input$line_x]]), 
                          V2=as.numeric(coconut.df[[input$line_y]])),
                     .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
    plot(data$V1,data$V2, type="l", ylab=input$line_y, xlab=input$line_x)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
388
    
389 390
  })
  
391
  # Scatterplot
392 393 394 395 396 397
  output$scat_box <- renderUI({
    if(input$check_scat)
      box(  title="Scatterplot",
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
398 399
            selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
            selectInput("scat_y", "y-axis", choices=colnames(coconut.df)),
400
            plotOutput("scat", height = 250))
401 402
  })
  
403 404
  #TODO: Scatterplot View
  output$scat <- renderPlot({
405 406
    data<- structure(list(V1=as.numeric(coconut.df[[input$scat_x]]), 
                          V2=as.numeric(coconut.df[[input$scat_y]])),
407 408 409
                     .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
    print("SCAT wird aufgerufen")
    
410
    plot(data$V1,data$V2, type="p", xlab=input$scat_x, ylab=input$scat_y )
411 412 413
  })
  
  # Boxplot
414 415 416
  output$box_box <- renderUI({
    if(input$check_box)
      box(  title="Boxplot",
417 418 419
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
420
            selectInput("box_x", "x-axis", choices=colnames(coconut.df)),
421 422 423 424 425 426
            plotOutput("box", height = 250))
  })
  
  #TODO: Boxplot View
  output$box <- renderPlot({
    print("BOX wird aufgerufen")
Stephanie Wegscheidl's avatar
boxplot  
Stephanie Wegscheidl committed
427 428 429
    data<- structure(list(V1=as.numeric(coconut.df[[input$box_x]])),
                     .Names=c("V1"), row.names=c(NA,6L), class = "data.frame")
    
430
    boxplot(data$V1, type="box", xlab=input$box_x )
431 432 433 434 435 436 437 438 439
  })
  
  #MAP
  output$map_box <- renderUI({
    if(input$check_map)
      box(  title="Map",
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
440
            selectInput("map_data", "data", choices=colnames(coconut.df)),
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
441
            leafletOutput("map", height = 250))
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
442 443
  })
  
444
  # MAP VIEW 
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
445
  output$map <- renderLeaflet({
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471
    print("MAP wird aufgerufen")
    data <- as.numeric(coconut.df[[input$map_data]])
    max_data<<- max(data)
    
    c<-1
    for(c in 1:length(data)){
      data[c]<-(data[c]/max_data)*10
    }
    
    colorData <-
      cut(
        data,
        c(0, 2, 5, 7, 10),
        include.lowest = T,
        lables = c('<2', '<5', '<7', '<10')
      )
    print("colorData")
    print(colorData)
    
    colorGrad <- colorFactor('RdYlGn', colorData) 
    
    print("colorGrad")
    print(colorGrad(colorData))
    
    
    m <- leaflet()
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
472 473
    x=1
    m <- addTiles(m)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
474 475 476

    m<-addCircleMarkers(m,lng=as.numeric(coconut.df$gps.longitude), lat=as.numeric(coconut.df$gps.latitude), radius = data, color = colorGrad(colorData)) #addPolylines does not work
    m<-addLegend(m, 'bottomright', pal=colorGrad, values=colorData, title=' ',opacity=1)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
477
    m
478 479
  })
  
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
480
  
481
  
482 483 484 485 486 487
  # TOOLTIP
  data_tooltip <- function(x){
    if(is.null(x)) return(NULL)
    if(is.null(x$ID)) return(NULL)
    paste0(coconut.df[[input$line_x]])
  }
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
488
  
489
  #DownloadButton
490 491
  #TODO: MAKE IT WORK!
  observeEvent(input$screenshot,{
492 493
    #if(input$check_line|input$check_time|input$check_map|input$check_hist)
    #disable("screenshot")
494
    #webshot::install_phantomjs()
495
    
496
    cdat <<- session$clientData
497
    url <- paste0(cdat$url_hostname,":", cdat$url_port,"/")
498
    print(url)
499
    
500 501
    #URL <- "http://rstudio.github.io/leaflet/"
    #appshot("cocoVisR/", file = "dashboard.png", port = getOption("shiny.port"), envvars = NULL)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
502
    #webshot(url,delay = 5.0)
503
    #knit("dashboard.png")
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
504 505 506
    #port <- cdat$url_port
    #mapshot(m, file="~/Rplot.png")
    
507
    #webshot(url, "dashboard.png", delay = 20.0) # does NOT WORK 
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
508 509 510 511 512
    #appdir <- system.file("examples", "01_hello", package="shiny")
    #print("appdir")
    #print(appdir)
    #appshot(appdir, "01_hello.png")
    
513
    #leaflet.print(m)
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
514 515 516 517 518 519
    
    
    
    
    
    
520 521
    
  })
522
  # url <- paste0(cdat$url_protocol,"//",cdat$url_hostname,":", cdat$url_port, cdat$url_pathname,cdat$url_search)
523
  #output$downButton <- downloadHandler(
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
524 525 526 527 528 529 530
  # filename="dashboard.png",
  #content=function(file){
  # observeEvent(input$downButton, {
  #appshot("cocoVisR/dashboard", file = "dashboard.png", port = getOption("shiny.port"), envvars = NULL)
  
  #}) 
  #}
531
  #)
532 533 534 535 536
  
  
  
  
  
Stephanie Wegscheidl's avatar
Stephanie Wegscheidl committed
537 538
  
  #SOME STUFF  
539 540
  
  
541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557
  #histdata <- rnorm(500)
  
  #output$plot1 <- renderPlot({
  #data <- histdata[seq_len(input$slider)]
  #hist(data)
  #})
  
  ##MAP 
  
  #m <- leaflet()
  #m <- addTiles(m)
  #x=1
  #for(x in 1:2019){
  #m <- addMarkers(m,lng=longitude[x], lat=latitude[x]) #addPolylines does not work
  #x=x+1}
  #m
  #}
Stephanie's avatar
Stephanie committed
558
}