highlightPoint: Row highlight

View source: R/scatterPlotMatrix.R

highlightPointR Documentation

Row highlight

Description

Asks to change the highlighted row.

Usage

highlightPoint(id, pointIndex)

Arguments

id

output variable to read from (id which references the requested plot)

pointIndex

index of the point to highlight; NULL means no point is to highlight.

Value

No return value, called from shiny applications for side effects.

Examples

 if(interactive() && require(shiny)) {
   library(shiny)
   library(scatterPlotMatrix)

   ui <- fluidPage(
     actionButton("highlightPointAction", "Highlight Last Point"),
     actionButton("clearHlPointAction", "Remove Highlighting"),
     p("These buttons sets/unsets a selected line"),
     scatterPlotMatrixOutput("spMatrix")
   )

   server <- function(input, output, session) {
     output$spMatrix <- renderScatterPlotMatrix({
       scatterPlotMatrix(iris)
     })
     observeEvent(input$highlightPointAction, {
       lastRowIndex <- nrow(iris)
       scatterPlotMatrix::highlightPoint("spMatrix", lastRowIndex)
     })

     observeEvent(input$clearHlPointAction, {
       scatterPlotMatrix::highlightPoint("spMatrix", NULL)
     })
   }

   shinyApp(ui, server)
 }


scatterPlotMatrix documentation built on June 22, 2024, 10:50 a.m.