Commit 710f350e authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl
Browse files

Multiple charts working, Importing Packages updated and Strucutred Code

parent a5a702bd
Loading
Loading
Loading
Loading
+334 −296
Original line number Original line Diff line number Diff line
@@ -192,111 +192,107 @@ server <- function(input, output, session) {
  #Title Input
  #Title Input
  output$title <- renderText({ input$title })
  output$title <- renderText({ input$title })
  
  
  #BARCHART selectinputs
  # #BARCHART selectinputs
  output$input_hist_x <- renderUI({
  # 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))
  #   if (is.null(input$nut))
  #     return(NULL)
  #     return(NULL)
  #   selectInput("input_time_data", "x-axis:", choices = colnames(coconut.df))
  #   selectInput("bar_x", "x-axis:", choices = colnames(coconut.df)) 
  #   })
  #   })
  # 
  # 
  # output$input_time_y <- renderUI({
  # output$input_hist_y <- renderUI({
  #   if (is.null(input$nut))
  #   if (is.null(input$nut))
  #     return(NULL)
  #     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) 
  #   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))  
  # })
  # })
  
  #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  
  #Continue to dashboard page  
  observeEvent(input$dashboardSite, {
  observeEvent(input$dashboardSite, {
    
    updateTabItems(session, "tabs",selected = "dashboard")
    updateTabItems(session, "tabs",selected = "dashboard")
    
  })
  })
  
  
  #For counting the plots and giving axis and plots individual names
  plotCounter <<- 0
  plotCounter <<- 0
  plotname <<- paste("plot", plotCounter, sep="")
  plotname <<- paste("plot", plotCounter, sep="")
  xplotname<<- paste("x",plotname,sep="")
  xplotname<<- paste("x",plotname,sep="")
  yplotname<<-paste("y",plotname, sep="")
  yplotname<<-paste("y",plotname, sep="")
  
  
  #TODO: Multiple charts. ADD BARCHART BUTTON
  #BARCHART box insert
  #BARCHART box insert
  observeEvent(input$check_hist, {
  observeEvent(input$check_hist, {
    
    
    #Setting names
    plotname<<-paste("plot", plotCounter, sep="")
    plotname<<-paste("plot", plotCounter, sep="")
    plotCounter<<-plotCounter+1
    plotCounter<<-plotCounter+1
    xplotname<<- paste("x",plotname,sep="")
    xplotname<<- paste("x",plotname,sep="")
    yplotname<<-paste("y",plotname, sep="")
    yplotname<<-paste("y",plotname, sep="")


    print(plotCounter)
    #Inserting box & Chart
    print(plotname)
   
    insertUI(
    insertUI(
      
      selector= "#viewpanel", #wo will ichs hinhaben
      selector= "#viewpanel", #wo will ichs hinhaben
      ui= box(  width = 12,
      ui= box(  width = 12,
                title="Barchart",
                title="Barchart",
@@ -305,204 +301,271 @@ server <- function(input, output, session) {
                collapsible = TRUE,
                collapsible = TRUE,
                selectInput(xplotname, "x-axis", choices=colnames(coconut.df)),
                selectInput(xplotname, "x-axis", choices=colnames(coconut.df)),
                selectInput(yplotname, "y-axis", choices=colnames(coconut.df)),
                selectInput(yplotname, "y-axis", choices=colnames(coconut.df)),
                #print(xplotname),
                plotOutput(plotname, height = 400))
                plotOutput(plotname, height = 250))
      
    )
    )
    local({ 
    local({ 
      
        # data handling
      output[[plotname]] <- renderPlot({
      output[[plotname]] <- renderPlot({
        print("hello itse mi")
        print(yplotname)
        
        data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]]),
        data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]]),
                              V2=as.numeric(coconut.df[[input[[yplotname]]]])),
                              V2=as.numeric(coconut.df[[input[[yplotname]]]])),
                         .Names=c("V1","V2"), row.names=c(NA,10L), class = "data.frame")
                         .Names=c("V1","V2"), row.names=c(NA,10L), class = "data.frame")
        #print("data")
        # New Bar-Plot
        #print(data)
        #Neues Plot
        barplot(data$V2,data$V1, 
        barplot(data$V2,data$V1, 
                ylab= yplotname,
                 ylab=input[[yplotname]],
                xlab=xplotname)
                 xlab=input[[xplotname]],
        
                 names.arg = data$V1
        # NOTE: PLEASE COMMENT IN IF DATA SET WITH FEW DATA IS USED --> MAKES AXES BETTER READABLE
                 #,
                 #las=2
                 #axis.lty=1
                )
      })
      })
    }) #Local end
    }) #Local end
  })
  })
  
  
   
  #BARCHART view
  
  
  
  ## 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)
  
  #BARCHART text
  #BARCHART text
  output$bar_explain <- renderText({
  output$bar_explain <- renderText({
    "Select data for the x- and y-axis then go to add barchart if you want this data to be visualized in a barchart."
    "Here you can add a barchart. A bar chart uses bars to show comparisons between categories of data. If you was trying to compare the height of something then intuitvely you would represent this by using columns. After clicking on the add button, a box with dropdownfields and a barchart will apear. Please set your wanted data for the x-and y-axis. Also be aware, that once you created another chart you won't be able to change the data of your previous charts."
  })
  })
  
  
  observeEvent(input$check_time, {
    
    
    # plotname<<-paste("plot", plotCounter, sep="")
    # plotCounter<<-plotCounter+1
    # xplotname<<- paste("x",plotname,sep="")
    # yplotname<<-paste("y",plotname, sep="")
   
   
  #TIMELINE insert box
    insertUI(
  output$time_box <- renderUI({
      #Inserting box and Chart
    if(input$check_time)
      selector= "#viewpanel", #wo will ichs hinhaben
      box(  width = 12,
      ui= box(  width = 12,
                title="Timeline",
                title="Timeline",
                status= "warning",
                status= "warning",
                solidHeader = TRUE,
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsible = TRUE,
            timevisOutput("time", height = 175)
                timevisOutput("time", height = 250))
      
    )
    )
  })
    
    
  #TIMELINE view
      local({
      output$time <- renderTimevis({
      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 handling
        data <-  data.frame(
        data <-  data.frame(
          id      = 1:length(parsedEndtimes),
          id      = 1:length(parsedEndtimes),
          content= c(1:length(parsedEndtimes)),
          content= c(1:length(parsedEndtimes)),
          start   = c(anytime(totalST), head(parsedEndtimes, -1)),
          start   = c(anytime(totalST), head(parsedEndtimes, -1)),
          end     = parsedEndtimes
          end     = parsedEndtimes
        )
        )
        #New Timeline
        timevis(data)
        timevis(data)
        
        
      })
      })
      })
  })

  # #TIMELINE insert box
  # output$time_box <- renderUI({
  #   if(input$check_time)
  #     box(  width = 12,
  #           title="Timeline",
  #           status= "warning",
  #           solidHeader = TRUE,
  #           collapsible = TRUE,
  #           timevisOutput("time", height = 175)
  #     )
  # })
  # 
  # #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)),
  #     start   = c(anytime(totalST), head(parsedEndtimes, -1)),
  #     end     = parsedEndtimes
  #   )
  #   timevis(data)
  #   
  # })
  
  
  #TIMELINE text
  #TIMELINE text
  output$texttimeline <- renderText({
  output$texttimeline <- renderText({
    "Add Timeline for getting a Timeline about CoCoQuest Tasks and Questions.To see how long a the participant took for a certain task."
  "Add Timeline for getting a Timeline about CoCoQuest Tasks and Questions.To see how long a the participant took for a certain task. Please note that the timeline is static, you can not show different types of data here. Also you can not add multiple charts here. "
  })
  })
  
  
#LINECHART
  observeEvent(input$check_line, {
    #setting names
    plotname<<-paste("plot", plotCounter, sep="")
    plotCounter<<-plotCounter+1
    xplotname<<- paste("x",plotname,sep="")
    yplotname<<-paste("y",plotname, sep="")
   
   
  #LINECHART insert box
    #inserting box and chart
  output$line_box <- renderUI({
    insertUI(
    if(input$check_line)
      selector= "#viewpanel", #wo will ichs hinhaben
      box(  width = 12,
      ui= box(  width = 12,
                title="Linechart",
                title="Linechart",
                status= "warning",
                status= "warning",
                solidHeader = TRUE,
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsible = TRUE,
                selectInput(xplotname, "x-axis", choices=colnames(coconut.df)),
                selectInput(yplotname, "y-axis", choices=colnames(coconut.df)),
                plotOutput(plotname, height = 250))
      
      
            #add_tooltip(data_tooltip, "hover"),
    )
            line_plot<<-plotOutput("line", height = 250))
    local({ 
  })
      
      
  #LINECHART view
      output[[plotname]] <- renderPlot({
  output$line <- renderPlot({
        #data handling
    print("LINE wird aufgerufen")
        data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]]),
    data<- structure(list(V1=as.numeric(coconut.df[[input$line_x]]), 
                              V2=as.numeric(coconut.df[[input[[yplotname]]]])),
                          V2=as.numeric(coconut.df[[input$line_y]])),
                         .Names=c("V1","V2"), row.names=c(NA,10L), class = "data.frame")
                     .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
        #new Linechart
    print(data)
        plot(data$V1,data$V2, type="l", ylab=input[[yplotname]], xlab=input[[xplotname]], las=2)
    plot(data$V1,data$V2, type="l", ylab=input$line_y, xlab=input$line_x)
        
        
      })
      })
    }) #Local end
  })
  
  
  #LINECHART text
  #LINECHART text
  output$line_explain <- renderText({
  output$line_explain <- renderText({
    "Select data for the x- and y-axis then go to add linechart if you want this data to be visualized in a linechart."
    "Here you can add a linechart. After clicking on the add button, a box with dropdownfields and a linechart will apear. Please set your wanted data for the x-and y-axis. Also be aware, that once you created another chart you won't be able to change the data of your previous charts."
    
    
  })
  })
  
  
#SCATTERPLOT
  observeEvent(input$check_scat, {
    #Setting names
    plotname<<-paste("plot", plotCounter, sep="")
    plotCounter<<-plotCounter+1
    xplotname<<- paste("x",plotname,sep="")
    yplotname<<-paste("y",plotname, sep="")


  #SCATTERPLOT insert box
    # Inserting Box and Plot
  output$scat_box <- renderUI({
    insertUI(
    if(input$check_scat)
      selector= "#viewpanel", #wo will ichs hinhaben
      box(  width = 12,
      ui= box(  width = 12,
                title="Scatterplot",
                title="Scatterplot",
                status= "warning",
                status= "warning",
                solidHeader = TRUE,
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsible = TRUE,
                selectInput(xplotname, "x-axis", choices=colnames(coconut.df)),
                selectInput(yplotname, "y-axis", choices=colnames(coconut.df)),
                plotOutput(plotname, height = 250))
      
      
           scat_plot<<- plotOutput("scat", height = 250))
    )
  })
    local({ 
      
      
  #SCATTERPLOT view
      output[[plotname]] <- renderPlot({
  output$scat <- renderPlot({
        print("hello itse mi")
    data<- structure(list(V1=as.numeric(coconut.df[[input$scat_x]]), 
        print(yplotname)
                          V2=as.numeric(coconut.df[[input$scat_y]])),
        #data handling 
                     .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
        data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]]),
    print("SCAT wird aufgerufen")
                              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", xlab=input$scat_x, ylab=input$scat_y )
      })
      })
    }) #Local end
  })
  
  
  
  #SCATTERPLOT text
  #SCATTERPLOT text
  output$scat_explain <- renderText({
  output$scat_explain <- renderText({
    "Select data for the x- and y-axis then go to add scatterplot if you want this data to be visualized in a scatterplot."
    "Here you can add a scatterplot. After clicking on the add button, a box with dropdownfields and a scatterolot will apear. Please set your wanted data for the x-and y-axis. Also be aware, that once you created another chart you won't be able to change the data of your previous charts."
  })
  })
  
  
  #BOXPLOT insert box
  
  output$box_box <- renderUI({
#BOXPLOT
    if(input$check_box)
  observeEvent(input$check_box, {
      box(  width = 12,
    #Setting names
    plotname<<-paste("plot", plotCounter, sep="")
    plotCounter<<-plotCounter+1
    xplotname<<- paste("x",plotname,sep="")
    yplotname<<-paste("y",plotname, sep="")

    #Inserting Box and plot
    insertUI(
      selector= "#viewpanel", #wo will ichs hinhaben
      ui= box(  width = 12,
                title="Boxplot",
                title="Boxplot",
                status= "warning",
                status= "warning",
                solidHeader = TRUE,
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsible = TRUE,
                selectInput(xplotname, "data", choices=colnames(coconut.df)),
                #selectInput(yplotname, "y-axis", choices=colnames(coconut.df)),
                plotOutput(plotname, height = 250))
      
      
           box_plot<<- plotOutput("box", height = 250))
    )
  })
    local({ 
      
      
  #BOXPLOT view
      output[[plotname]] <- renderPlot({
  #TODO:scaling 
  output$box <- renderPlot({
    print("BOX wird aufgerufen")
    data<- structure(list(V1=as.numeric(coconut.df[[input$box_x]])),
                     .Names=c("V1"), row.names=c(NA,6L), class = "data.frame")
        
        
    boxplot(data$V1, type="box", xlab=input$box_x )
        #handling data
        data<- structure(list(V1=as.numeric(coconut.df[[input[[xplotname]]]])),
                         .Names=c("V1"), row.names=c(NA,10L), class = "data.frame")
        #new Boxplot
        boxplot(data$V1, type="box", xlab=input[[xplotname]])
        
      })
    }) #Local end
  })
  })
  
  
  
  #BOXPLOT text
  #BOXPLOT text
  output$box_explain <- renderText({
  output$box_explain <- renderText({
    "Select data then go to add boxplot if you want this data to be visualized in a boxplot."
    "Here you can add a boxplot. After clicking on the add button, a box with a dropdownfield and a boxplot will apear. Please set your wanted data for the data. Also be aware, that once you created another chart you won't be able to change the data of your previous charts."
    
  })
  })
  
  
  #MAP insert box
#MAP
  output$map_box <- renderUI({
  observeEvent(input$check_map, {
    if(input$check_map)
    #Setting names
      box(  width = 12,
    plotname<<-paste("plot", plotCounter, sep="")
    plotCounter<<-plotCounter+1
    xplotname<<- paste("x",plotname,sep="")
    yplotname<<-paste("y",plotname, sep="")
    
    #Inserting box and plot
    insertUI(
      selector= "#viewpanel", #wo will ichs hinhaben
      ui= box(  width = 12,
                title="Map",
                title="Map",
                status= "warning",
                status= "warning",
                solidHeader = TRUE,
                solidHeader = TRUE,
                collapsible = TRUE,
                collapsible = TRUE,
                selectInput(xplotname, "data", choices=colnames(coconut.df)),
                leafletOutput(plotname, height = 250))
      
      
            map_plot<<-leafletOutput("map", height = 250))
    )
  })
    local({ 
      
      
  #MAP view 
      output[[plotname]] <- renderLeaflet({
  output$map <- renderLeaflet({
      #handling data
    print("MAP wird aufgerufen")
        data <- as.numeric(coconut.df[[input[[xplotname]]]])
    data <- as.numeric(coconut.df[[input$map_data]])
        #getting max for normation
        max_data<<- max(data)
        max_data<<- max(data)
        c<-1
        c<-1
        
        #norming data
        for(c in 1:length(data)){
        for(c in 1:length(data)){
          data[c]<-(data[c]/max_data)*10
          data[c]<-(data[c]/max_data)*10
        }
        }
        
        
        #encoding data
        colorData <-
        colorData <-
          cut(
          cut(
            data,
            data,
@@ -510,20 +573,25 @@ server <- function(input, output, session) {
            include.lowest = T,
            include.lowest = T,
            lables = c('<2', '<5', '<7', '<10')
            lables = c('<2', '<5', '<7', '<10')
          )
          )
    
        #color encoding data
        colorGrad <- colorFactor('RdYlGn', colorData) 
        colorGrad <- colorFactor('RdYlGn', colorData) 
        
        
        #new map
        m <<- leaflet()
        m <<- leaflet()
        x=1
        x=1
        m <<- addTiles(m)
        m <<- addTiles(m)
        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<<-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)
        m<<-addLegend(m, 'bottomright', pal=colorGrad, values=colorData, title=' ',opacity=1)
        m
        m
        
      })
    }) #Local end
  })
  })
  
  
  #MAP text
  #MAP text
  output$map_explain <- renderText({
  output$map_explain <- renderText({
    paste("Select data then go to add map. The map will show the way the participant went, also the data you selected is going to be normalized (highest value=10).")
    "Here you can add a map.  After clicking on the add button, a box with dropdownfield and a map will apear. Please set your wanted data. The map will show the way the participant went, also the data you selected is going to be normalized (highest value=10).Also be aware, that once you created another chart you won't be able to change the data of your previous charts."

    })
    })
  
  
  #TODO: TOOLTIP
  #TODO: TOOLTIP
@@ -534,23 +602,7 @@ server <- function(input, output, session) {
  }
  }
  
  
  #TODO: DownloadButton
  #TODO: DownloadButton
  plotinput <- function() {
    #df<-data.frame(q=c(1,3,5,7,9),w=c(2,4,6,8,10),z=c(1,2,3,4,5))
    list(p1 = map_plot,
         p2 = line_plot,
         p3 = scat_plot)
  }
  
  output$down.pdf <- downloadHandler(
  output$down.pdf <- downloadHandler(
    ##FIRST TRY
    # print("download wird aufgerufen"),
    # filename = function() { paste('plot', '.png', sep='') },
    # content = function() {
      # ggsave(plot=map_plot, file=input$nut$datapath)
    #}
  
    #SECOND TRY
    #print("breakoint"),
    filename = "download.pdf",
    filename = "download.pdf",
    content = function(file) {
    content = function(file) {
      CairoPDF(file = file, width=12, height=8)
      CairoPDF(file = file, width=12, height=8)
@@ -558,32 +610,13 @@ server <- function(input, output, session) {
      #m
      #m
      #leafletOutput("map", height = 250)
      #leafletOutput("map", height = 250)
      output$box 
      output$box 
      # data<- structure(list(V1=as.numeric(coconut.df[[input$scat_x]]), 
      data<- structure(list(V1=as.numeric(coconut.df[[input$scat_x]]),
      #                       V2=as.numeric(coconut.df[[input$scat_y]])),
                            V2=as.numeric(coconut.df[[input$scat_y]])),
      #                  .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
                       .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
      # plot(data$V1,data$V2, type="p", xlab=input$scat_x, ylab=input$scat_y )     
      plot(data$V1,data$V2, type="p", xlab=input$scat_x, ylab=input$scat_y )
      dev.off()
      dev.off()
    })
    })
  
  
  ##THIRD TRY
  # observeEvent(input$down.pdf, {
  #   
  #     pdf("www/myreport.pdf")
  #     plotinput()
  #     dev.off()
  #     tags$iframe(style="height:600px; width:100%", src="myreport.pdf")
  #   
  # })
  
  
  
  
  

  
  
  
  




  ################## SOME STUFF ################
  ################## SOME STUFF ################
@@ -613,10 +646,15 @@ server <- function(input, output, session) {
  
  
  #leaflet.print(m)
  #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")
  #   
  # })
  
  
  
  
  #})
  #})
+7 −7
Original line number Original line Diff line number Diff line
@@ -93,8 +93,8 @@ ui <- dashboardPage(
                                       #Linechart
                                       #Linechart
                                       tabPanel("Linechart",
                                       tabPanel("Linechart",
                                                textOutput("line_explain"),
                                                textOutput("line_explain"),
                                                uiOutput("input_line_x"),
                                                # uiOutput("input_line_x"),
                                                uiOutput("input_line_y"),
                                                # uiOutput("input_line_y"),
                                                actionButton("check_line", "add Linechart")
                                                actionButton("check_line", "add Linechart")
                                       ),
                                       ),
                                       
                                       
@@ -103,8 +103,8 @@ ui <- dashboardPage(
                                                # selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
                                                # selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
                                                # selectInput("scat_y", "y-axis", choices=colnames(coconut.df)),
                                                # selectInput("scat_y", "y-axis", choices=colnames(coconut.df)),
                                                textOutput("scat_explain"),
                                                textOutput("scat_explain"),
                                                uiOutput("input_scat_x"),
                                                # uiOutput("input_scat_x"),
                                                uiOutput("input_scat_y"),
                                                # uiOutput("input_scat_y"),
                                                actionButton("check_scat", " add Scatterplot")
                                                actionButton("check_scat", " add Scatterplot")
                                                ),
                                                ),
                                       
                                       
@@ -112,7 +112,7 @@ ui <- dashboardPage(
                                       tabPanel("Boxplot",
                                       tabPanel("Boxplot",
                                                # selectInput("box_x", "x-axis", choices=colnames(coconut.df)),
                                                # selectInput("box_x", "x-axis", choices=colnames(coconut.df)),
                                                textOutput("box_explain"),
                                                textOutput("box_explain"),
                                                uiOutput("input_box_x"),
                                                #uiOutput("input_box_x"),
                                                #uiOutput("input_box_y"),
                                                #uiOutput("input_box_y"),
                                                actionButton("check_box", "add Boxplot")
                                                actionButton("check_box", "add Boxplot")


@@ -123,7 +123,7 @@ ui <- dashboardPage(
                                       tabPanel("Map",
                                       tabPanel("Map",
                                                # selectInput("map_data", "data", choices=colnames(coconut.df)),
                                                # selectInput("map_data", "data", choices=colnames(coconut.df)),
                                                textOutput("map_explain"),
                                                textOutput("map_explain"),
                                                uiOutput("input_map"),
                                                #uiOutput("input_map"),
                                                actionButton("check_map", "add Map")
                                                actionButton("check_map", "add Map")
                                       )
                                       )
                       )
                       )

import/CoCoQuest_import.R

deleted100644 → 0
+0 −36

File deleted.

Preview size limit exceeded, changes collapsed.

import/CoConUT_import.R

deleted100644 → 0
+0 −49

File deleted.

Preview size limit exceeded, changes collapsed.

import/Packages.R

0 → 100644
+10 −0
Original line number Original line Diff line number Diff line
install.packages("shiny")
install.packages("shinydashboard")
install.packages("jsonlite")
install.packages("DT")
install.packages("anytime")
install.packages("leaflet")
install.packages("timevis")
install.packages("Cairo")
install.packages("grDevices")