cytoscape.js multiple instances on page

不羁岁月 提交于 2019-12-08 08:19:44

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!