Debian Codegraph @

tests/test-modules/107_scatterplot/R/linked-scatterplot-module.R

raw
1
2
3
4
5
6 linkedScatterUI <- function(id) {
7 ns <- NS(id)
8
9 fluidRow(
10 column(6, plotOutput(ns("plot1"), brush = ns("brush"))),
11 column(6, plotOutput(ns("plot2"), brush = ns("brush")))
12 )
13 }
14
15 linkedScatterServer <- function(id, data, left, right) {
16 moduleServer(
17 id,
18 function(input, output, session) {
19 # Yields the data frame with an additional column "selected_"
20 # that indicates whether that observation is brushed
21 dataWithSelection <- reactive({
22 # dput(input$brush)
23 brushedPoints(data(), input$brush, allRows = TRUE)
24 })
25
26 output$plot1 <- renderPlot({
27 scatterPlot(dataWithSelection(), left())
28 })
29
30 output$plot2 <- renderPlot({
31 scatterPlot(dataWithSelection(), right())
32 })
33
34 return(dataWithSelection)
35 }
36 )
37 }