Commit b22b6574 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl

Map using data works

parent 551647c4
......@@ -16,13 +16,13 @@ server <- function(input, output, session) {
set.seed(122)
#Continue to data page
#Continue to data page
observeEvent(input$dataSite, {
updateTabItems(session, "tabs",selected = "data")
})
#DATA PAGE
#DATA PAGE
......@@ -184,7 +184,7 @@ server <- function(input, output, session) {
})
#View PAGE
#View PAGE
#Title Input
output$title <- renderText({ input$title })
......@@ -286,7 +286,7 @@ server <- function(input, output, session) {
})
#DASHBOARD
#DASHBOARD
#BAR VIEW
local({
......@@ -445,22 +445,35 @@ server <- function(input, output, session) {
output$map <- renderLeaflet({
print("MAP wird aufgerufen")
data <- as.numeric(coconut.df[[input$map_data]])
max_data<- max(data)
print("MAX DATA")
print(max_data)
max_data<<- max(data)
c<-1
for(c in 1:length(data)){
data[c]<-(data[c]/max_data)*5
data[c]<-(data[c]/max_data)*10
}
print(data)
m <<- leaflet()
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()
x=1
m <- addTiles(m)
for(x in 1:length(coconut.df$gps.latitude)){
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}
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
})
......@@ -522,7 +535,7 @@ server <- function(input, output, session) {
#SOME STUFF
#SOME STUFF
#histdata <- rnorm(500)
......
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