Learn R Programming

parallelPlot (version 0.4.0)

highlightRow: Row highlight

Description

Asks to change the highlighted row.

Usage

highlightRow(id, rowIndex)

Value

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

Arguments

id

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

rowIndex

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

Examples

Run this code
 if(interactive() && require(shiny)) {
   library(shiny)
   library(parallelPlot)

   ui <- fluidPage(
     actionButton("highlightRowAction", "Highlight Last Row"),
     actionButton("clearHlRowAction", "Remove Highlighting"),
     p("These buttons sets/unsets a selected line"),
     parallelPlotOutput("parPlot")
   )

   server <- function(input, output, session) {
     output$parPlot <- renderParallelPlot({
       parallelPlot(iris)
     })
     observeEvent(input$highlightRowAction, {
       lastRowIndex <- nrow(iris)
       parallelPlot::highlightRow("parPlot", lastRowIndex)
     })

     observeEvent(input$clearHlRowAction, {
       parallelPlot::highlightRow("parPlot", NULL)
     })
   }

   shinyApp(ui, server)
 }

Run the code above in your browser using DataLab