datastorm-open / visNetwork

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

Access network instance from script #463

Open cboulanger opened 1 year ago

cboulanger commented 1 year 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?