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

Linked brushing between the visNetwork and plotly visualizations #38

Closed
julianstanley opened this issue Jun 17, 2020 · 3 comments · Fixed by #59
Closed

Linked brushing between the visNetwork and plotly visualizations #38

julianstanley opened this issue Jun 17, 2020 · 3 comments · Fixed by #59
Labels
enhancement New feature or request Phase 2 Features related to GSOC Phase 2 Milestones

Comments

@julianstanley
Copy link
Owner

@tdhock

This is a big Phase 2 feature that I should be all set to implement now.

I think it is impossible to have client-side communication between the visNetwork and plotly visualizations.

So, for now, that's going to have to be server-side. My (crude/brute-force) implementation idea right now is just to have a column shared between the changepoint segments and the nodes/edges in the graph. When a user hovers over a point, I can grab that information and use that to change node/edge/changepoint opacity.

@julianstanley julianstanley added enhancement New feature or request Phase 2 Features related to GSOC Phase 2 Milestones labels Jun 17, 2020
@tdhock
Copy link
Collaborator

tdhock commented Jun 17, 2020

"I think it is impossible to have client-side communication between the visNetwork and plotly visualizations" --- nothing is impossible!!! and conceptually there is no reason why this should not be possible (all of the data is already in the browser).

but I guess it would be difficult / hard hack? Can you please explain why? it seems like plotly has support for that so the problem is on the visNetwork side? I would suggest opening an issue with visNetwork to discuss the problem and possible solutions.

For now I think it is OK to go through the server but I think that will be too slow for the kind of interactions I had in mind:

  • hover over node -> highlight corresponding segments
  • hover over edge -> highlight corresponding changepoints
  • hover over segment -> highlight corresponding node + other segments with same node
  • hover over changepoint -> highlight corresponding edge + other changepoints with same edge

if you really have to hit the server for this kind of interaction, I would suggest using a click instead of a hover. (we typically expect quicker reaction times from hovers than for clicks) Does that make sense?

@julianstanley
Copy link
Owner Author

julianstanley commented Jun 17, 2020

nothing is impossible!!!

Indeed 😆

but I guess it would be difficult / hard hack?

Yeah, better phrasing would be "I don't know how to do it right now and suspect it would be difficult". Definitely not impossible (I wasn't much of a wordsmith typing this issue on my phone last night before bed 😅).

Background

Client-side crosstalk between two htmlwidget objects can be accomplished with the crosstalk package. For example, figure 17.31 in the plotly book. There might be other options that I don't know about.

The actual process of client-side crosstalk is still a big black box for me (that's on my to-learn-about list), but I've used the crosstalk package to connect two plotly graphs and it was super quick and easy.

crosstalk with visNetwork

Since visNetwork is built on htmlwidgets, it should work with crosstalk. The crosstalk devs provide instructions to make any htmlwidget package crosstalk-compatible (meaning that it can communicate with any other crosstalk-compatible widget).

Someone brought up visNetwork crosstalk support in January 2018 (here). Benoit seemed supportive & opened a branch a few days later, but hasn't made any progress since. I commented at the bottom of that issue about a month ago.

I can give that implementation a shot, but I suspect it'll be a decently-involved learning process. But, maybe there's an easier way?

if you really have to hit the server for this kind of interaction, I would suggest using a click instead of a hover. (we typically expect quicker reaction times from hovers than for clicks) Does that make sense?

That totally makes sense!

I think, to move forward with this, I think it might be reasonable to first implement those 4 interactions the server-hitting way with clicks. That implementation should be pretty quick (<1 week, I think?) and it'll give us an idea of whether hitting the server makes it impossibly slow.

Once that's done, I can try to implement proper crosstalk. That might end up being easy, or might end up being a huge time suck--I don't have enough background yet to know either way.

@julianstanley
Copy link
Owner Author

Yesterday and today I implemented linked brushing from plotly-->visNetwork. I couldn't figure out how to do it completely client-side yet, but the server-hitting side with hover, not with a click, actually works reasonably quickly on the shiny server. Still not ideal, but that's nice.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request Phase 2 Features related to GSOC Phase 2 Milestones
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants