Skip to content

in Shiny JS getting passed as a string #6

@timelyportfolio

Description

@timelyportfolio

@jcheng5, @ramnathv, @yihui | I wondered if you might be able to add some insight on this strange situation. When using parcoords, the JS_EVALS get passed as a character and fail when rendered with renderParcoords in Shiny, but work perfectly even in Shiny when rendered statically with parcoords. Here is a simple example that fails on my machine. sessionInfo() pasted below code. I'll keep digging but I have not found anything so far.

library(shiny)
library(parcoords)

p1 <- parcoords(
  mtcars,
  ,color = list(
    colorScale=htmlwidgets::JS('d3.scale.category10()')
    , colorBy = "cyl"
  )
)

# test p1 ; should color by cyl
p1

# JS_evals
htmlwidgets:::JSEvals(p1$x)

ui <- shinyUI(fluidPage(
  tags$h1("shiny")
  ,parcoordsOutput("DiamondPlot")
  ,tags$h1("static")
  ,p1
))

server <- function(input, output, session) {
  output$DiamondPlot <- renderParcoords({
    p1
  })
}

shinyApp(ui,server)
R version 3.1.2 (2014-10-31)
Platform: x86_64-w64-mingw32/x64 (64-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     

other attached packages:
[1] parcoords_0.1     shiny_0.11.1.9002

loaded via a namespace (and not attached):
 [1] digest_0.6.4      htmltools_0.2.7   htmlwidgets_0.3.2 httpuv_1.3.2      jsonlite_0.9.14  
 [6] mime_0.2          R6_2.0.1          Rcpp_0.11.4.6     RJSONIO_1.3-0     tools_3.1.2      
[11] xtable_1.7-4      yaml_2.1.13 

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions