datastorm-open / visNetwork

R package, using vis.js library for network visualization
Other
542 stars 127 forks source link

Access network instance from script #463

Open cboulanger opened 10 months ago

cboulanger commented 10 months ago

Hi,

I want to manipulate the vis.Network instance in the browser runtime generated by visNetwork from a script that gets injected into the page. The only way to access the object I found in the source was like this:

const container = document.getElementsByClassName("vis-network")[0]
const network = container.parentElement.chart

Isn't there a more elegant way that is not dependend on inspecting the DOM? If not, shouldn't there be one?