JuliaPlots / PlotlyJS.jl

Julia library for plotting with plotly.js

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for Plotly click/select/hover events

wilsongoode opened this issue · comments

I have PlotlyJS.jl running in a Pluto.jl notebook. I have a graph/network plotted where each node represents an image. I'd like to be able to view a preview of each image when I hover over its node.

If there is a way to embed HTML in hover, please point me to it!

As a second option, I thought I might be able to link the hovered node to a subplot that could display the image, but I was unable to access the data of the node. I know that plotly.js fires off events with data on clicks/selects and hovers. I'd like to be able to use the data (in this case an image filename).

Attached is a screenshot of the graph in question, with one node hovered.
Screen Shot 2022-09-21 at 7 35 42 PM

After banging my head for a while against the docs of the relevant packages, I thought I might be able to use javascript to access the DOM and pull out the relevant information, but it only works in the console.

Any advice would be appreciated. Am I barking up the wrong tree?

Nope -- this is the right tree!

This should work in other contexts (like the standalone plot windows or vs code) as documented here http://juliaplots.org/PlotlyJS.jl/stable/syncplots/#SyncPlots

Not sure what it would take to get this working with Pluto.jl and unfortunately I don't have the time right now to try to get it working. Perhaps other community members can provide support here??

Thanks for your response @sglyon. I've decided to switch over to JS, skipping plotly.js and working directly with D3.js. This has provided the level of control I needed for this project.