Commit 9e6e4dbe authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl
Browse files

Changes for Interviews

parent 710f350e
Loading
Loading
Loading
Loading
+7 −202
Original line number Diff line number Diff line
@@ -24,10 +24,8 @@ server <- function(input, output, session) {
    updateTabItems(session, "tabs",selected = "data")
    
  })
  #DATA PAGE
  
  
  
  #DATA PAGE
  #CoConUT Data import 
  output$nut <- renderDataTable({
    inFile <- input$nut
@@ -36,16 +34,9 @@ server <- function(input, output, session) {
    
    #loading CoConUT data
    json_data_coco <- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
    print("1")
    coconut.df <<- json_data_coco[["data"]]
    
    lastCoConUT <<- inFile$name
    #print("coconut:")
    
    #coconut.df$timestamp <- format(coconut.df$timestamp, format="%d-%B-%Y %H:%M:%S")
    
    
    #print(coconut.df)
    if(is.null(coconut.df$timestamp)){}
    else{unixTime<<-coconut.df$timestamp}
    
@@ -97,8 +88,6 @@ server <- function(input, output, session) {
    if(is.null(coconut.df$interaction.touch)){}
    else{touch<<-coconut.df$interaction.touch}

    
    
    # setting the table style
    datatable(
      cbind(coconut.df), 
@@ -114,6 +103,7 @@ server <- function(input, output, session) {
      )
    )
  })
  
  #last coconut_name
  output$lastLoadedNut<- renderText({
    if (is.null(input$nut))
@@ -129,27 +119,15 @@ server <- function(input, output, session) {
    
    #loading CoCoQuest data
    json_data_quest <<- fromJSON(paste(inFile$datapath, sep = ""), flatten = TRUE)
    
    lastCoCoQuest <<- inFile$name
    totalST <<- c(anytime(as.numeric(json_data_quest$startTime)/1000))
    print(json_data_quest)
    

    #unix  parsed
    dat <- do.call(rbind, json_data_quest$tasks$data)
    
    endtimes <<- c(dat$endtime)
    
    parsedEndtimes <<- anytime(endtimes/1000)
    #endtimes <<- format(dat$endtime, format="%d-%B-%Y %H:%M:%S")
    print("endtime quest")
    print(parsedEndtimes)
    tasks <- rep(1:length(json_data_quest$tasks$data), sapply(json_data_quest$tasks$data, nrow))
    #questions 
    #print("Questions:", questions)
    together <<- c(tasks, endtimes)
    print("together")
    print(together)
    all <- rbind(together)
    
    #setting the table style
@@ -182,95 +160,13 @@ server <- function(input, output, session) {
  
  #Continue to view page  
  observeEvent(input$viewSite, {
    
    updateTabItems(session, "tabs",selected = "views")
    
  })
  
  #View PAGE
  
  #Title Input
  output$title <- renderText({ input$title })

  # #BARCHART selectinputs
  # output$input_hist_x <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("bar_x", "x-axis:", choices = colnames(coconut.df)) 
  #   })
  # 
  # output$input_hist_y <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("bar_y", "y-axis:", choices = colnames(coconut.df)) 
  #   })
  # 
  # 
  # #TIMELINE selectinput--> do not need it
  # 
  # # output$input_time_data <- renderUI({
  # #   if (is.null(input$nut))
  # #     return(NULL)
  # #   selectInput("input_time_data", "x-axis:", choices = colnames(coconut.df))
  # # })
  # # 
  # # output$input_time_y <- renderUI({
  # #   if (is.null(input$nut))
  # #     return(NULL)
  # #   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) 
  # # })
  # 
  # #LINECHART selectinput x
  # output$input_line_x <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("line_x", "x-axis", choices=colnames(coconut.df))  
  # })
  # 
  # #LINECHART selectinput y
  # output$input_line_y <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("line_y", "y-axis", choices=colnames(coconut.df))  })
  # 
  # 
  # #SCATTERPLOT selectinput x
  # output$input_scat_x <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("scat_x", "x-axis", choices=colnames(coconut.df))  
  # })
  # 
  # #SCATTERPLOT selectinput y
  # output$input_scat_y <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("scat_y", "y-axis", choices=colnames(coconut.df))  
  # })
  # 
  # #BOXPLOT selectinput x
  # output$input_box_x <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("box_x", "data", choices=colnames(coconut.df))  
  # })
  # 
  # #BOXPLOT selectinput y
  # output$input_box_y <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("box_y", "y-axis", choices=colnames(coconut.df))  
  # })
  # 
  # 
  # #MAP selectinput
  # output$input_map <- renderUI({
  #   if (is.null(input$nut))
  #     return(NULL)
  #   selectInput("map_data", "data", choices=colnames(coconut.df))  
  # })
  
  
  #Continue to dashboard page  
  observeEvent(input$dashboardSite, {
    updateTabItems(session, "tabs",selected = "dashboard")
@@ -330,11 +226,6 @@ server <- function(input, output, session) {
  
  observeEvent(input$check_time, {
    
    # plotname<<-paste("plot", plotCounter, sep="")
    # plotCounter<<-plotCounter+1
    # xplotname<<- paste("x",plotname,sep="")
    # yplotname<<-paste("y",plotname, sep="")
   
    insertUI(
      #Inserting box and Chart
      selector= "#viewpanel", #wo will ichs hinhaben
@@ -378,16 +269,6 @@ server <- function(input, output, session) {
  # 
  # #TIMELINE view
  # output$time <- renderTimevis({
  #   print("TIME wird aufgerufen")
  #   
  #   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)),
@@ -432,7 +313,7 @@ server <- function(input, output, session) {
                              V2=as.numeric(coconut.df[[input[[yplotname]]]])),
                         .Names=c("V1","V2"), row.names=c(NA,10L), class = "data.frame")
        #new Linechart
        plot(data$V1,data$V2, type="l", ylab=input[[yplotname]], xlab=input[[xplotname]], las=2)
        plot(data$V1,data$V2, type="l", ylab=input[[yplotname]], xlab=input[[xplotname]])
        
      })
    }) #Local end
@@ -469,14 +350,12 @@ server <- function(input, output, session) {
    local({ 
      
      output[[plotname]] <- renderPlot({
        print("hello itse mi")
        print(yplotname)
        #data handling 
        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,10L), class = "data.frame")
        #new scatterplot
        plot(data$V1,data$V2, type="p", ylab=input[[yplotname]], xlab=input[[xplotname]], las=2, axis.lty=1)
        plot(data$V1,data$V2, type="p", ylab=input[[yplotname]], xlab=input[[xplotname]])
        
      })
    }) #Local end
@@ -506,7 +385,6 @@ server <- function(input, output, session) {
                solidHeader = TRUE,
                collapsible = TRUE,
                selectInput(xplotname, "data", choices=colnames(coconut.df)),
                #selectInput(yplotname, "y-axis", choices=colnames(coconut.df)),
                plotOutput(plotname, height = 250))
      
    )
@@ -616,77 +494,4 @@ server <- function(input, output, session) {
      plot(data$V1,data$V2, type="p", xlab=input$scat_x, ylab=input$scat_y )
      dev.off()
    })
  


  ################## SOME STUFF ################
  
  ##DOWNLOADBUTTON
  #observeEvent(input$screenshot,{
  #if(input$check_line|input$check_time|input$check_map|input$check_hist)
  #disable("screenshot")
  #webshot::install_phantomjs()
  
  # cdat <<- session$clientData
  # url <- paste0(cdat$url_hostname,":", cdat$url_port,"/")
  # print(url)
  
  #URL <- "http://rstudio.github.io/leaflet/"
  #appshot("cocoVisR/", file = "dashboard.png", port = getOption("shiny.port"), envvars = NULL)
  #webshot(url,delay = 5.0)
  #knit("dashboard.png")
  #port <- cdat$url_port
  #mapshot(m, file="~/Rplot.png")
  
  #webshot(url, "dashboard.png", delay = 20.0) # does NOT WORK 
  #appdir <- system.file("examples", "01_hello", package="shiny")
  #print("appdir")
  #print(appdir)
  #appshot(appdir, "01_hello.png")
  
  #leaflet.print(m)
  
  ##THIRD TRY
  # observeEvent(input$down.pdf, {
  #   
  #     pdf("www/myreport.pdf")
  #     plotinput()
  #     dev.off()
  #     tags$iframe(style="height:600px; width:100%", src="myreport.pdf")
  #   
  # })
  
  
  #})
  # url <- paste0(cdat$url_protocol,"//",cdat$url_hostname,":", cdat$url_port, cdat$url_pathname,cdat$url_search)
  #output$downButton <- downloadHandler(
  # filename="dashboard.png",
  #content=function(file){
  # observeEvent(input$downButton, {
  #appshot("cocoVisR/dashboard", file = "dashboard.png", port = getOption("shiny.port"), envvars = NULL)
  
  #}) 
  #}
  #)
  
  
  
  ##BARCHART
  #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
  #}
}
+4 −2
Original line number Diff line number Diff line
@@ -139,9 +139,11 @@ ui <- dashboardPage(
                                   uiOutput("scat_box"),
                                   uiOutput("box_box"),
                                   uiOutput("map_box"),
                                   uiOutput("pdfview"),
                                   uiOutput("pdfview")#,
                                  
                                   downloadButton("down.pdf","Download")))
                                  # downloadButton("down.pdf","Download")
                                  )
                                  )