christophergandrud / d3Network

Tools for creating D3 JavaScript network graphs from R.
http://christophergandrud.github.io/d3Network/
171 stars 56 forks source link

zoom doesn't work in shiny app #15

Closed joey711 closed 9 years ago

joey711 commented 10 years ago

I can set the zoom option in d3ForceNetwork to TRUE, but the resulting app remains in the default configuration, no-zooming.

christophergandrud commented 10 years ago

It seems to be something to do with JavaScript not picking up the zoom when the graph is appended to a div, as opposed to the body. (You'll notice the same issue over at http://bl.ocks.org/benzguo/4370043, where zoom doesn't work, but it does when appended to the body http://bl.ocks.org/benzguo/raw/4370043/).

I'll keep looking into it.

christophergandrud commented 10 years ago

I don't think the issue was what I mentioned above.

I did a test of attaching the chart to a div with parentElement. Zooming works with this outside of Shiny, but not in. Hm. . .

christophergandrud commented 10 years ago

There seems to be a (somewhat) related problem with dragging links from sankey diagrams

trosendal commented 10 years ago

Same problem here in my application. My network plots are in tabs on a shiny page. I'm thinking that I might write the javascript to a temporary file and then open the javascript in a new window for a more detailed view and the ability to zoom. So far I've only got this working in my head, but I'm thinking the following structure will work. Write the standalone javascript to a temporary.html that is in a place that an nginx server can serve the content. Then I need to give the link to that file on the shinypage. Any thoughts on thins strategy? Is this overly complex?

christophergandrud commented 10 years ago

Still haven't found a good solution to the zoom problem in Shiny. Using an iframe from another file might indeed work.

happyshows commented 9 years ago

@christophergandrud , I found the same issue with Shiny, but I swear that zoom function worked once out of my 20 attempts :). This package is really good work and hope to see this solved soon.

christophergandrud commented 9 years ago

That's very curious.

NickStrange commented 9 years ago

I love the package, I am also hitting the zoom problem. It did once work for me - very early in the cycle Are there any workarounds?

christophergandrud commented 9 years ago

@NickStrange What version are you using?

NickStrange commented 9 years ago

Hi Thanks for getting back to me.

Nick

R version 3.2.0 (2015-04-16) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

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

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

other attached packages: [1] rjson_0.2.15 shiny_0.12.1 d3Network_0.5.2.1

loaded via a namespace (and not attached): [1] R6_2.0.1 plyr_1.8.3 htmltools_0.2.6 tools_3.2.0 whisker_0.3-2 Rcpp_0.11.6 digest_0.6.8
[8] xtable_1.7-4 httpuv_1.3.2 mime_0.3

Sent from my iPad

On Jun 15, 2015, at 11:44 AM, Christopher Gandrud notifications@github.com wrote:

@NickStrange What version are you using?

— Reply to this email directly or view it on GitHub.

christophergandrud commented 9 years ago

Have you tried networkD3?

NickStrange commented 9 years ago

I have just tried that. That solves the problem.

Thanks for your time

Nick

Sent from my iPad

On Jun 17, 2015, at 2:56 AM, Christopher Gandrud notifications@github.com wrote:

Have you tried networkD3?

— Reply to this email directly or view it on GitHub.

christophergandrud commented 9 years ago

Great. FYI d3Network is no longer supported so please use networkD3 when possible.