timelyportfolio/parcoords

Brush does not appear to reset correctly with crosstalk and DT

JasonAizkalns opened this issue · 1 comments

So I think something weird is going on with the clearing the brush from parcoords. Consider the example below.

  1. Create a brush on the parcoords viz and note how many records are filtered in the DT output (e.g., "Showing N of 10 of 150 entries").
  2. Clear that brush (by clicking on parcoords) and notice how things do not reset in the DT output.

NOTE: If you click on the DT output after the brush, things seems to correct themselves?

---
title: "Parcoords and Crosstalk"
output: html_document
runtime: shiny
---

```{r setup, include=FALSE}
library(shiny)
library(tidyverse)
library(parcoords)
library(crosstalk)
library(DT)
```

## Here's some stuff

```{r stuff, echo = FALSE}
checkboxGroupInput(
        "cb_vars", 
        "Select variables",
        choices = colnames(iris),
        inline = TRUE,
        selected = colnames(iris)[1:2]
    )

parcoordsOutput("pc_plot")

dataTableOutput("tbl")

iris_react <- reactive({
    iris %>% 
        select(input$cb_vars)
})
    
shared_iris <- SharedData$new(iris_react)

output$pc_plot <- renderParcoords({
    parcoords(
        shared_iris,
        rownames = FALSE,
        brushMode = "1D-axes",
        alpha = 0.3
    )
})

output$tbl <- renderDataTable({
  shared_iris
},
  style = "bootstrap",
  class = "compact",
  width = "100%",
  rownames = FALSE,
  server = FALSE,
  options = list(
    dom = NULL
  )
)

```

This doesn't solve your problem, I just want to thank you for your minimal DT/crosstalk/parcoords example. If you can live without the checkBoxes, you can even render this thing out to standard html without shiny.

---
title: "Parcoords and Crosstalk"
output: html_document
---

```{r main, echo = FALSE}
shared_iris <- crosstalk::SharedData$new(iris)

parcoords::parcoords(
  shared_iris,
  rownames = FALSE,
  brushMode = "1D-axes",
  alpha = 0.3
)

DT::datatable(shared_iris)
```