Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

parcoord PKG: double-click an axis name does not reorder tick values (mtcars cyl axis) #45

Open
sfd99 opened this issue Apr 27, 2021 · 2 comments

Comments

@sfd99
Copy link

sfd99 commented Apr 27, 2021

Hi Kenton!

Your Intro to ‘parcoords
article (and the pkg itself),
is great!.

I noticed the following bug(?)
in the mtcars display:

If I select (for ex.),
the Porsche 914-2 model,
it correctly displays: 4 in the cyl axis.

But if the user wants to reorder that cyl axis
and double-clicks
on the axis name:
cyl ,
the line will now show (incorrectly)
the value: 8 in the cyl axis!.
But the Porsche has 4 cylinders,
not 8...

In other words:
the Porsche orange line has moved
but the axis tick values (4,6,8),
have not been reordered!.

The value 4
is still at the bottom of the cyl axis
and 8 is still at the top,
after reordering the cyl axis.

This will happen for either:
reorderable = FALSE or TRUE...

Here's the Code to reproduce:

start of R code

library(shiny)
library(parcoords)
library(d3r)

ui <- fluidPage(
    sidebarLayout(
        sidebarPanel(
           
        ),
       
        mainPanel(
            parcoordsOutput("par_plot")
        )
    )
)

server <- function(input, output) {
   
    output$par_plot<- renderParcoords({
        data(mtcars)
        parcoords(mtcars, rownames = TRUE, brushMode = "1d-axes-multi",   reorderable = FALSE,
                  alphaOnBrushed = 0.15,
                  color = list(
                      colorBy = "cyl",
                      colorScale = "scaleOrdinal",
                      colorScheme = "schemeCategory10"
                  ),
                  withD3 = TRUE)
    })
}

shinyApp(ui = ui, server = server)

** end of R code **

Help, Kenton!

RAY
San Francisco
Rstudio, R - latest versions
Ubuntu Linux 20.04
parcoords PKG 1.0.0

@timelyportfolio
Copy link
Owner

timelyportfolio commented May 21, 2021

Thanks @sfd99 for the kind words and well-explained issue. So sorry for the slow response. I will start to research. Can you confirm whether the below outside of Shiny works or not?

        data(mtcars)
        parcoords(mtcars, rownames = TRUE, brushMode = "1d-axes-multi",   reorderable = FALSE,
                  alphaOnBrushed = 0.15,
                  color = list(
                      colorBy = "cyl",
                      colorScale = "scaleOrdinal",
                      colorScheme = "schemeCategory10"
                  ),
                  withD3 = TRUE)

I believe non-Shiny works on my machine, but I might be overlooking something.

I see an error in the JavaScript console, but the error seems to only prevent correct reversal of the axis when in Shiny context.

@sfd99
Copy link
Author

sfd99 commented May 21, 2021

Hi Kenton -

Great to interact with you again!.

Ok,

  • the Shiny version (my code, above),
    shows the old problem.
  • the NON-Shiny version (your code, above),
    shows NO problem!.
    Works perfectly!.
    ie:
    the 4,6,8 vertical axis tick values
    get rearranged if you double-click on CYL (as expected).

So,
seems to be a SHINY problem...

btw:
the reason I prefer to use the SHINY version (my code above),
is that sometimes any non-SHINY version,
will not show in my Rstudio [Viewer] tab.

The Viewer will sometimes only show
an empty, white display.
That blank, empty Viewer problem also happens
with plots of some other PKGS,
so it's not exclusive to parcoord. :-)
It's a different Rstudio-bound problem.

Anyhoo,
that's why I prefer to use
the SHINY version of parcoord always.

Hope this helps, Kenton...
RAY
San Francisco
Rstudio, R - latest versions
Ubuntu Linux 20.04
parcoords PKG 1.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants