问题
I am having trouble having two instances of cytoscape setup on same webpage. I have two window vars "cy" and "cy2" that are being used for different graphs. They are functionally different graphs and need to be available on different parts of the page. I wanted to know how to get that setup correctly?
When I look at page elements, the one not showing has the width and height of the underlying canvases set to 0 by cytoscape.js. Can you please help me to understand what is being initialized wrong or how these values can get set like that.
Thanks gmania
chrome dev tool screen of cytoscape.js element div
回答1:
Take a look at the multiple instances demo: http://js.cytoscape.org/demos/310dca83ba6970812dd0
Also make sure you set dimensions properly in your CSS for each container. If you specify a div with zero size, then the internal Cy canvases will match.
来源:https://stackoverflow.com/questions/39541286/cytoscape-js-multiple-instances-on-page