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

Shiny integration #4

Open
danielkrizian opened this issue May 30, 2014 · 23 comments
Open

Shiny integration #4

danielkrizian opened this issue May 30, 2014 · 23 comments

Comments

@danielkrizian
Copy link
Owner

try to work on the shiny integration by implementing what is in rCharts and maybe improving by having a look at ggvis.
Can we use renderChart2 from other rCharts libraries?

@timelyportfolio
Copy link
Collaborator

I believe renderChart2 will work fine. As far as I can tell, the issue is with chartOutput which uses rCharts get_lib which does not allow for other packages in the system.file(...,package="rCharts"). I will update my fork of rCharts referenced in the readme to allow an option for other packages. I'll check with @ramnathv to see if there are any issues with this on the rCharts side.

@timelyportfolio
Copy link
Collaborator

I think this is more of an rCharts issue for single plots, so changed my dimple_layer branch of rCharts. To see it work, see this mini repo. Where we will need to make changes in this repo will be the layout_dygraphs for multiple charts. I'll explore this here.

@ramnathv
Copy link
Collaborator

Great work @danielkrizian and @timelyportfolio! I have been out-of-action with rCharts, but will pick up stuff starting next week. Focus will be to clean up existing code, incorporating all the pull requests and merging dev with master. Once I get that done, I will work on making the changes to get Shiny working with packages depending on rCharts.

@timelyportfolio
Copy link
Collaborator

@ramnathv changes required were minimal with commit-get_lib and commit-chartOutput . If you deem ok, they will get pulled with the dimple_layer branch.

@ramnathv
Copy link
Collaborator

Perfect. I think that should do the trick. I will just do a quick scan of any other places where get_lib is being called, so that we can update its signature.

@TonyDIRL
Copy link

@timelyportfolio I've tested the shiny - rcharts - dygraph example and can confirm it works - awesome.

Interestingly, on a windows machine running the shiny example on a shiny server causes several repaint issues with dygraph - essentially, several datapoints remain as residuals in the plot.

However, running the app locally with runApp() and had no such issues. Perhaps, isolated to my machine but would be interesting if other users have the same problem.

Thanks again - great to combine these tools.

@timelyportfolio
Copy link
Collaborator

I just realized that I was using dimple_layer locally, and that I never sent a pull request to @ramnathv for rCharts, so the change was not picked up. I have isolated these changes and sent a new pull request.

@TonyDIRL
Copy link

Hi,

I appreciate the following problem may have multiple roots but I thought I'd start here and see if the problem can be reproduced. As mentioned previously, on a windows machine running the example on a shiny server causes several repaint issues with dygraph after zooming and panning - essentially, several datapoints remain as residuals in the plot.

image

However, running the app locally with runApp() has no such issues. Perhaps, isolated to my setup but would be interesting if others can reproduce the same problem.

@danielkrizian
Copy link
Owner Author

Thanks @TonyDIRL. To reproduce, can you possibly share/link your code somehow (maybe through your forked repo)? That would be helpful for (diff) analysis

@timelyportfolio
Copy link
Collaborator

I experience the same issue on my Windows machine. I will try to debug it.

@TonyDIRL
Copy link

@danielkrizian - this problem seems specifically related to shiny-server. runApp() and runGist() do not seem to have repainting issues.

@TonyDIRL
Copy link

TonyDIRL commented Jul 6, 2014

Hi @timelyportfolio , was wondering if you had an opportunity to debug the repainting issues with dygraph on a shiny server?

@timelyportfolio
Copy link
Collaborator

Looked more at this tonight. Strange but it only occurs for me in Chrome. Seems to work fine for me in RStudio browser and IE. I'll keep trying to figure this out.

@timelyportfolio
Copy link
Collaborator

Ok, by inspecting the elements I think I am one step closer. When I change all of the canvasses to have height = 1000 and width = 400 and then gs[0].updateOptions({}) to refresh, it all works nicely. Now, I just need to see where the improper sizing takes place and why it is different in Chrome. Anybody have any ideas?

Chrome

image

IE

image

@TonyDIRL
Copy link

TonyDIRL commented Jul 7, 2014

Thank you @timelyportfolio for debugging. I tried in firefox previously but had similar issues to Chrome. Interestingly, the issue is inconsistent in Chrome - on occasion the correct canvas sizes are generated.

I've very little knowledge of html so I've posted this query on the Shiny google group so hopefully we will get some feedback there.

@timelyportfolio
Copy link
Collaborator

Quick update:

I made an app without Bootstrap, and I can confirm that Bootstrap is not causing the problem, so my first suspicion did not correct anything.

@timelyportfolio
Copy link
Collaborator

Calling all testers (@TonyDIRL)

Not at all what I thought. Error on my side comes in here. Somehow my Chrome was zoomed to 90%, and that caused the issue. When I CTRL+0 to return to 100% or manually overrode the scales with canvasScale=1 and hiddenScale=1, everything worked fine. I am not sure we need to change anything if this is the case. I guess we could consider skipping or modifying the canvasScale check. We might file an issue over at dygraphs.

Note: when I set zoom to something less than 100% in IE, I get the same issue.

@TonyDIRL
Copy link

TonyDIRL commented Jul 9, 2014

Nice work. @timelyportfolio. I can confirm across multiple machines and browser versions it is a zooming issue. Nice find - I was digging around this without success for quite a while.

Were you able to manually override the canvasScale=1 and hiddenScale=1 with some JS from within R?

I'll log the issue with dygraphs.

@danielkrizian
Copy link
Owner Author

@pshevtsov , could you send a pull request to danvk please? I think the simplest reproducible case we have right now is https://github.com/timelyportfolio/rCharts_dygraphs_shiny/, or can this case be further stripped down to pure JavaScript?

@timelyportfolio
Copy link
Collaborator

Actually, the tests included in dygraphs experience this same bug. For instance, set browser zoom to <100% and open zoom.html. You should see the same bug.

@danielkrizian
Copy link
Owner Author

Strange, to me the graph behaves correctly even when I zoom Chrome (Windows 7):

http://rawgit.com/danvk/dygraphs/master/tests/zoom.html

image

@timelyportfolio
Copy link
Collaborator

To get the error zoom < 100 then refresh.

@danielkrizian
Copy link
Owner Author

Ok, I see now (clicking refresh is needed). Thanks, well isolated

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

No branches or pull requests

4 participants