Commit 82d4e992 authored by Stephanie Wegscheidl's avatar Stephanie Wegscheidl
Browse files

multiple barcharts first try

parent f5e5da56
Loading
Loading
Loading
Loading
+52 −35
Original line number Diff line number Diff line
@@ -11,9 +11,11 @@ library(timevis)
library(plotly)



server <- function(input, output, session) {
  set.seed(122)
  

#Continue to data page  
  observeEvent(input$dataSite, {
    
@@ -188,7 +190,6 @@ server <- function(input, output, session) {
  output$title <- renderText({ input$title })

  #barchart
  
  output$input_hist_x <- renderUI({
    if (is.null(input$nut))
     return(NULL)
@@ -259,21 +260,29 @@ server <- function(input, output, session) {

  })
  
#DASHBOARD  
  #ADD BARCHART BUTTON
   observeEvent(input$check_hist, {
     insertUI(
       
  #barchart
  output$hist_box <- renderUI({
    if(input$check_hist)
      box(  title="Barchart",
       selector= "#viewpanel", #wo will ichs hinhaben
       ui= box(  title="Barchart",
                 status= "warning",
                 solidHeader = 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))
     )
     print("InsertUI wird aufgerufen.")
  
   })

#DASHBOARD  
     #BAR VIEW
  
     output$bar <- renderPlot({
    print("BAR wird aufgerufen.")

       data<- structure(list(V1=as.numeric(coconut.df[[input$bar_y]]), 
                             V2=as.numeric(coconut.df[[input$bar_x]])),
                        .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
@@ -282,7 +291,7 @@ server <- function(input, output, session) {
               ylab= input$bar_y,
               xlab=input$bar_x)

    
   })
    ## ALTES PLOT
   #a=1
    
@@ -299,7 +308,7 @@ server <- function(input, output, session) {
      #g
    #hist(bluetooth)

  })

  
  
  #TIMELINE
@@ -348,6 +357,9 @@ server <- function(input, output, session) {
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
            selectInput("line_x", "x-axis", choices=colnames(coconut.df)),
            selectInput("line_y", "y-axis", choices=colnames(coconut.df)),
            #add_tooltip(data_tooltip, "hover"),
            plotOutput("line", height = 250))
  })
  
@@ -359,9 +371,6 @@ server <- function(input, output, session) {
                     .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
    plot(data$V1,data$V2, type="l", ylab=input$line_y, xlab=input$line_x)
 
    
    
    
  })
  
  # Scatterplot
@@ -371,6 +380,8 @@ server <- function(input, output, session) {
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
            selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
            selectInput("scat_y", "y-axis", choices=colnames(coconut.df)),
            plotOutput("scat", height = 250))
  })
  
@@ -381,7 +392,7 @@ server <- function(input, output, session) {
                     .Names=c("V1","V2"), row.names=c(NA,6L), class = "data.frame")
    print("SCAT wird aufgerufen")
    
    plot(data$V1, data$V2, type="p", labx=input$scat_x, laby=input$scat_y )
    plot(data$V1,data$V2, type="p", xlab=input$scat_x, ylab=input$scat_y )
  })
  
  # Boxplot
@@ -391,6 +402,7 @@ server <- function(input, output, session) {
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
            selectInput("box_x", "x-axis", choices=colnames(coconut.df)),
            plotOutput("box", height = 250))
  })
  
@@ -400,7 +412,7 @@ server <- function(input, output, session) {
    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", labx=input$box_x )
    boxplot(data$V1, type="box", xlab=input$box_x )
  })
  
  #MAP
@@ -410,6 +422,7 @@ server <- function(input, output, session) {
            status= "warning",
            solidHeader = TRUE,
            collapsible = TRUE,
            selectInput("map_data", "data", choices=colnames(coconut.df)),
            leafletOutput("map", height = 250))
  })
  
@@ -427,8 +440,12 @@ server <- function(input, output, session) {
  
  
  
  
 
  # TOOLTIP
  data_tooltip <- function(x){
    if(is.null(x)) return(NULL)
    if(is.null(x$ID)) return(NULL)
    paste0(coconut.df[[input$line_x]])
  }
  
  #DownloadButton
  #TODO: MAKE IT WORK!
+13 −16
Original line number Diff line number Diff line
@@ -75,15 +75,14 @@ ui <- dashboardPage(
                       tabsetPanel(
                                       tabPanel("Barchart",
                                       #Barchart
                                       checkboxInput("check_hist", "Barchart", FALSE),
                                       selectInput("bar_x", "x-axis", choices=colnames(coconut.df)),
                                       selectInput("bar_y", "y-axis", choices=colnames(coconut.df))
                                       actionButton("check_hist", "add Barchart")
                                       
                                       #uiOutput("input_hist_x"),
                                       #uiOutput("input_hist_y")
                                       ),
                                       #TIMELINE
                                       tabPanel("Timeline",
                                       checkboxInput("check_time", "Timeline", FALSE),
                                       actionButton("check_time", "add Timeline"),
                                       textOutput("texttimeline")
                                       #selectInput("time_data", "data", choices=colnames(coconut.df))
                                       #uiOutput("input_time_x"),
@@ -91,36 +90,34 @@ ui <- dashboardPage(
                                       ),
                                       #Linechart
                                       tabPanel("Linechart",
                                       checkboxInput("check_line", "Linechart", FALSE),
                                       selectInput("line_x", "x-axis", choices=colnames(coconut.df)),
                                       selectInput("line_y", "y-axis", choices=colnames(coconut.df))
                                       actionButton("check_line", "add Linechart")
                                       
                                       #uiOutput("input_line_x"),
                                       #uiOutput("input_line_y")
                                       ),
                                       #Scatterplot
                                       tabPanel("Scatterplot",
                                                checkboxInput("check_scat", "Scatterplot", FALSE),
                                                selectInput("scat_x", "x-axis", choices=colnames(coconut.df)),
                                                selectInput("scat_y", "y-axis", choices=colnames(coconut.df))
                                                actionButton("check_scat", " add Scatterplot")
                                                
                                                ),
                                       #Boxplot
                                       tabPanel("Boxplot",
                                                checkboxInput("check_box", "Boxplot", FALSE),
                                                selectInput("box_x", "x-axis", choices=colnames(coconut.df))#,
                                                actionButton("check_box", "add Boxplot")

                                                #selectInput("box_y", "y-axis", choices=colnames(coconut.df))
                                       ),
                                       #MAP
                                       tabPanel("Map",
                                       checkboxInput("check_map", "Map", FALSE),
                                       selectInput("map_data", "data", choices=colnames(coconut.df))
                                       actionButton("check_map", "add Map")
                                       
                                       )
                       )
                  ),
                    mainPanel(column(width = 12,
                    mainPanel(id="viewpanel", column(width = 12,
                                   
                                   h2(textOutput("title")),
                                   
                                   uiOutput("hist_box"),
                                   #uiOutput("hist_box"),
                                   uiOutput("time_box"),
                                   #timevisOutput("time"),
                                   uiOutput("line_box"),