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

Can't select additional colours #64

Closed
martinschmelzer opened this issue Apr 5, 2016 · 20 comments
Closed

Can't select additional colours #64

martinschmelzer opened this issue Apr 5, 2016 · 20 comments

Comments

@martinschmelzer
Copy link

Hi,
really like the addin! But we got an issue here both on Mac and Windows. If we add a second colour (or more) we cannot select it with the mouse. We tried attaching shinyjs explicitly and tried both the current CRAN release and the Github version. My session info in the case of the Mac environment:

R version 3.2.3 (2015-12-10)
Platform: x86_64-apple-darwin14.5.0 (64-bit)
Running under: OS X 10.11.3 (El Capitan)

locale:
[1] de_DE.UTF-8/de_DE.UTF-8/de_DE.UTF-8/C/de_DE.UTF-8/de_DE.UTF-8

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

other attached packages:
[1] shiny_0.13.1

loaded via a namespace (and not attached):
[1] R6_2.1.2 htmltools_0.3 tools_3.2.3 rstudioapi_0.5 Rcpp_0.12.3 jsonlite_0.9.19 digest_0.6.9
[8] xtable_1.8-2 httpuv_1.3.3 mime_0.4 miniUI_0.1.1 shinyjs_0.5.2

@daattali
Copy link
Owner

daattali commented Apr 5, 2016

What do you mean you can't select it - when you move your cursor over the square with the number 2 and click, nothing happens? What about when you start the colour picker with multiple boxes, for example type colourPicker(3), it also doesn't work then?

Can you see open the app in your browser (by going to 127.0.0.0: according to what RStudio tells you the port is), opening the javascript console, and see if there are any errors?

@martinschmelzer
Copy link
Author

Yes correct, nothing happens! Thats the same case for manually starting it with more than 1 colour. I'll try checking the Javascript console and report back.

@martinschmelzer
Copy link
Author

When opend in the browser (Firefox) no errors show up when I try to select the second or third (or....) colour (tried manually starting the addin as well).
The only thing that pops up right after I started the addin is:
screenshot 2016-04-05 11 54 32

@daattali
Copy link
Owner

daattali commented Apr 5, 2016

Ah, so there is an error! It can't load the javascript. It's trying to load shinyjs-funcs.js and it's failing for some reason. I'll try to see why that happens......

@daattali
Copy link
Owner

daattali commented Apr 5, 2016

I'm guessing selecting colours from the second tab isn't working, and that in the third tab the loading image never disappears? Those are also things that require the javascript file

@martinschmelzer
Copy link
Author

Yes thats correct!

@martinschmelzer
Copy link
Author

Is that a local bug? Usually I have no problems with JS applications within RStudio...

@daattali
Copy link
Owner

daattali commented Apr 5, 2016

I tried installing shinyjs on a few different machines (all Windows) and it worked, so I'm not sure what's going on here....... I'll think about it. But at least we know where the problem is.

@daattali
Copy link
Owner

daattali commented Apr 5, 2016

Can you translate the first error message to me? And tell me the full name of the file that it's failing at? (shiny.m....)

@martinschmelzer
Copy link
Author

"The connection to ws: ..... was canceld during loading of the page."

Gotta go eat....be back in 30...

@daattali
Copy link
Owner

daattali commented Apr 5, 2016

I just tried installing on a Linux server I have and it worked there too. Strange.

That sounds like an error with shiny for some reason. I wish I had access to your computer so that I could debug :)

Can you see if that same error about the socket being cancelled also happens when you run an empty shiny app?

library(shiny)

ui <- fluidPage(
  "hello"
)

server <- function(input, output, session) {

}

shinyApp(ui = ui, server = server)

If that works and you don't see the error in the console, can you try this one?

library(shiny)

jscode <- "shinyjs.init = function() { alert('hello!'); }"

ui <- fluidPage(
  shinyjs::useShinyjs(),
  shinyjs::extendShinyjs(text = jscode, functions = c()),
  "hello"
)

server <- function(input, output, session) {

}

shinyApp(ui = ui, server = server)

If that works too and you get a popup saying "hello", can you try this: create a new file named myfuncs.js and put shinyjs.init = function() { alert('hello!'); } inside of it.

Then run this code

library(shiny)

ui <- fluidPage(
  shinyjs::useShinyjs(),
  shinyjs::extendShinyjs(script = "myfuncs.js", functions = c()),
  "hello"
)

server <- function(input, output, session) {

}

shinyApp(ui = ui, server = server)

@martinschmelzer
Copy link
Author

Sorry! Im back now :)
The first example works without any errors. The second works and the message pops up but it also says that "Connection to ws://127.0.0.1:5196/websocket/ was canceld while loading of the page."

@martinschmelzer
Copy link
Author

I just tried Chrome as well. Here the error log is at least in english ;)

screenshot 2016-04-05 14 45 40

I checked the path. shiny-funcs.js is just where it should be...

@martinschmelzer
Copy link
Author

Would'nt a work-around be to make shinyjs-funcs.js available by putting it in the www folder? Sorry if thats a stupid idea ;)

@martinschmelzer
Copy link
Author

Oh my...

just found out that the package V8 is needed forextendShinyjs() which loads shinyjs-funcs.js. After installing it it worked... -.-

@daattali
Copy link
Owner

daattali commented Apr 5, 2016

V8 is not a hard requirement. It's a suggested requirement, but this should work without it.

I see now that if I don't have V8, I get the same error. I'm not sure why having V8 makes a difference in whether the path works or not, but now we really nailed down where the problem is. Thank you so much for your patience and help! I'll report back when I find a solution

@martinschmelzer
Copy link
Author

Ah right. When I found the paragraph on V8 I just tried it without reading in detail what it is about. As long as it works now Im happy. Really useful tool ;) Looking forward to your fix anyhow...

@daattali
Copy link
Owner

daattali commented Apr 5, 2016

@pozelei I think I fixed it. If you don't mind, could you try uninstalling V8 (by just removing the folder V8 from your library) and make sure the colour picker still works?

@martinschmelzer
Copy link
Author

Yep, I can confirm it works now without the help of V8! :) Thx!

@daattali
Copy link
Owner

daattali commented Apr 6, 2016

Great, thank you!

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