Commit 551647c4 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl
Browse files

first try Map with data --> Radius with normed values

and trying fixing barcharts in different boxes
parent 82d4e992
Loading
Loading
Loading
Loading
+39 −13
Original line number Original line Diff line number Diff line
@@ -259,9 +259,16 @@ server <- function(input, output, session) {
    updateTabItems(session, "tabs",selected = "dashboard")
    updateTabItems(session, "tabs",selected = "dashboard")


  })
  })
  
  plotCounter <<- 0
  #ADD BARCHART BUTTON
  #ADD BARCHART BUTTON
   observeEvent(input$check_hist, {
   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(
     insertUI(
    
    
       selector= "#viewpanel", #wo will ichs hinhaben
       selector= "#viewpanel", #wo will ichs hinhaben
@@ -269,29 +276,37 @@ server <- function(input, output, session) {
                 status= "warning",
                 status= "warning",
                 solidHeader = TRUE,
                 solidHeader = TRUE,
                 collapsible = TRUE,
                 collapsible = TRUE,
                 selectInput("bar_x", "x-axis", choices=colnames(coconut.df)),
                 selectInput("bar_y", "y-axis", choices=colnames(coconut.df)),
                 
                 
                 plotOutput("bar", height = 250))
                 selectInput(xplotname, "x-axis", choices=colnames(coconut.df)),
                 selectInput(yplotname, "y-axis", choices=colnames(coconut.df)),
                 
                 plotOutput(plotname, height = 250))
     )
     )
     print("InsertUI wird aufgerufen.")
     
  
  
   })
   })


#DASHBOARD  
#DASHBOARD  
     #BAR VIEW
     #BAR VIEW
  
  
     output$bar <- renderPlot({
  local({     
   
    
    
    
       data<- structure(list(V1=as.numeric(coconut.df[[input$bar_y]]), 
     output[[plotname]] <- renderPlot({
                             V2=as.numeric(coconut.df[[input$bar_x]])),
       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")
                        .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
       #Neues Plot
       #Neues Plot
       barplot(data$V1,data$V2, 
       barplot(data$V1,data$V2, 
               ylab= input$bar_y,
               ylab= input$yplotname,
               xlab=input$bar_x)
               xlab=input$xplotname)


   })
   })
  })
   
    ## ALTES PLOT
    ## ALTES PLOT
   #a=1
   #a=1
    
    
@@ -429,11 +444,22 @@ server <- function(input, output, session) {
  # MAP VIEW 
  # MAP VIEW 
  output$map <- renderLeaflet({
  output$map <- renderLeaflet({
     print("MAP wird aufgerufen")
     print("MAP wird aufgerufen")
     data <- as.numeric(coconut.df[[input$map_data]])
     max_data<- max(data)
     print("MAX DATA")
     print(max_data)
     c<-1
     for(c in 1:length(data)){
       data[c]<-(data[c]/max_data)*5
     }
     print(data)
    
    m <<- leaflet()
    m <<- leaflet()
    x=1
    x=1
    m <- addTiles(m)
    m <- addTiles(m)
    for(x in 1:length(coconut.df$gps.latitude)){
    for(x in 1:length(coconut.df$gps.latitude)){
      m <- addCircleMarkers(m,lng=as.numeric(longitude[x]), lat=as.numeric(latitude[x]), radius = 1, color ="red") #addPolylines does not work
      
      m <- addCircleMarkers(m,lng=as.numeric(coconut.df$gps.longitude[x]), lat=as.numeric(coconut.df$gps.latitude[x]), radius = data[x], color ="red") #addPolylines does not work
      x=x+1}
      x=x+1}
    m
    m
  })
  })