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