inst/shinyApp/plot1_Module.R
ca2b622a
 plot1_UI <- function(id){
   ns <- NS(id)
   plotlyOutput(ns("plot"))
 }
 
 plot1_Server <- function(id, rv){
   moduleServer(
     id,
     function(input, output, session){
       
       output$plot <- renderPlotly({
         req(rv$dat.t)
663f06af
         # in order to print the name of the method (and not the 
         # selected value from the method) on the 'x' label, this
         # name is retrieved from the list 'methodChoices' declared
         # in 'global.R
         method <- names(methodChoices)[methodChoices == rv$method]
ca2b622a
         rv$p <- ggplot(data = rv$dat.t, aes(x=value, color=Sample)) +
           stat_density(geom="line", position = "identity") +
663f06af
           theme(legend.position = "none") + labs(x=paste0(method, " Scores"), y="Density") +
ca2b622a
           scale_color_manual("Legend", values = rv$dd.col)
         ggplotly(rv$p, tooltip = "Sample", source = "click1")
       })
     }
   )
 }