snaketron / BcellNet

Tool for network-based analysis of B-cell clonal expansion
MIT License
0 stars 1 forks source link

Make plot interactive #5

Closed thatsIch closed 7 years ago

thatsIch commented 7 years ago

Currently, the graphs are plotted as images and displayed directly. This makes it difficult to analyze the data. You should be able to hover over a community and see information of the community, respectively of the edge, node and maybe even zoom into the plot to analyze subgraphs.

interactive

thatsIch commented 7 years ago

You can achieve zooming by registering an event in the UI like double click

plotOutput("secondPatient",
            dblclick = "secondPatient_dblclick",
            brush = brushOpts(
              id = "secondPatient_brush",
              resetOnNew = TRUE
            )           
 )

and observe that event on the server side

observeEvent(input$secondPatient_dblclick, {
    brush <- input$secondPatient_brush
    if (!is.null(brush)) {
      ranges$x <- c(brush$xmin, brush$xmax)
      ranges$y <- c(brush$ymin, brush$ymax)

    } else {
      ranges$x <- NULL
      ranges$y <- NULL
    }
  })

the brush option allows us to select a specific range which needs to be zoomed in and rerendered on demand if wanted.

thatsIch commented 7 years ago

This was easily solved via the package visNetwork