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

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

and trying fixing barcharts in different boxes
parent 82d4e992
...@@ -259,39 +259,54 @@ server <- function(input, output, session) { ...@@ -259,39 +259,54 @@ 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
ui= box( title="Barchart", ui= box( title="Barchart",
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({
output[[plotname]] <- renderPlot({
print(plotname)
data<- structure(list(V1=as.numeric(coconut.df[[input$bar_y]]), data<- structure(list(V1=as.numeric(coconut.df[[input$xplotname]]),
V2=as.numeric(coconut.df[[input$bar_x]])), 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
...@@ -428,12 +443,23 @@ server <- function(input, output, session) { ...@@ -428,12 +443,23 @@ 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
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment