cytoscape.js

Disable dragging nodes outside of area in cytoscape.js

馋奶兔 提交于 2020-05-18 08:30:09
问题 I am using cytoscape.js . I have allowed the user to drag the nodes, but right now it is also possible to drag the node outside of the 'canvas'. I have looked at the options at http://js.cytoscape.org/#core/initialisation but I don't know how to make sure the nodes cannot leave the visible area <div id="cy"></div> . 回答1: Try the automove extension: https://github.com/cytoscape/cytoscape.js-automove It lets you set rules for node position, like constraining within the current viewport or a

Disable dragging nodes outside of area in cytoscape.js

一曲冷凌霜 提交于 2020-05-18 08:28:44
问题 I am using cytoscape.js . I have allowed the user to drag the nodes, but right now it is also possible to drag the node outside of the 'canvas'. I have looked at the options at http://js.cytoscape.org/#core/initialisation but I don't know how to make sure the nodes cannot leave the visible area <div id="cy"></div> . 回答1: Try the automove extension: https://github.com/cytoscape/cytoscape.js-automove It lets you set rules for node position, like constraining within the current viewport or a

Increasing stack size in browsers

你离开我真会死。 提交于 2020-02-23 10:44:21
问题 Short question: I have a javascript that goes very deep in recursion. How can I increase the stack size so that I can execute it (something like "ulimit -s unlimited" in Unix systems)? Long story: I have to draw a graph and I use Cytoscape JS (http://js.cytoscape.org/) coupled with the Dagre layout extension (https://github.com/cytoscape/cytoscape.js-dagre). The drawing algorithm goes deep in the recursion and I end up getting "Uncaught RangeError: Maximum call stack size exceeded" in Chrome

Increasing stack size in browsers

允我心安 提交于 2020-02-23 10:43:28
问题 Short question: I have a javascript that goes very deep in recursion. How can I increase the stack size so that I can execute it (something like "ulimit -s unlimited" in Unix systems)? Long story: I have to draw a graph and I use Cytoscape JS (http://js.cytoscape.org/) coupled with the Dagre layout extension (https://github.com/cytoscape/cytoscape.js-dagre). The drawing algorithm goes deep in the recursion and I end up getting "Uncaught RangeError: Maximum call stack size exceeded" in Chrome

cytoscape.js disable grab&moving nodes

我只是一个虾纸丫 提交于 2020-02-02 06:29:06
问题 I'm having trouble building a graph network with cytoscapeJS. I can add nodes and handle them which is quite easy, but I'm not able to configure cytospace to disable Dragging/Moving nodes. I have found a JSbin from somebody where you can try: http://jsbin.com/vasenatimu/2/edit?html,js,output Have a look at http://js.cytoscape.org under 'Initialisation options', I tried all the options, but they dont solve my problem (I set nearly all options to false and I can still grab and select nodes).

Replace all elements and redraw graph softly in cytoscape.js

让人想犯罪 __ 提交于 2020-01-24 06:14:45
问题 Is there any one-command way to replace all elements of my graph with new data in cytoscape.js? In my case, after some operations on backend I have new graph-data and want to redraw my graph with this new data, but not to lose my camera settings, maybe something like cy.elements = my_elements; cy.redraw(); 回答1: Options: (1) cy.elements().remove(); cy.add( newEleJsons ); (2) cy.json({ elements: newEleJsons }); 来源: https://stackoverflow.com/questions/35770055/replace-all-elements-and-redraw

Is there a way of getting the cystoscape object associated with a DOM element?

允我心安 提交于 2020-01-16 16:13:29
问题 I currently do the following: let $cy = $('#cy'); let cy = cytoscape({ container: $cy, ... }); $cy.data('cytoscape', cy); The above allow me to reobtain the cytoscape object (e.g. in a event handler) as follows: let cy = $cy.data('cytoscape'); Is there a builtin method of obtaining the cytoscape object so I can avoid doing all this work (and technically mess with a element own by the library)? 回答1: It is generally assumed that you will keep Cytoscape instance in a shared variable in the code,

Is there a way of getting the cystoscape object associated with a DOM element?

烈酒焚心 提交于 2020-01-16 16:13:08
问题 I currently do the following: let $cy = $('#cy'); let cy = cytoscape({ container: $cy, ... }); $cy.data('cytoscape', cy); The above allow me to reobtain the cytoscape object (e.g. in a event handler) as follows: let cy = $cy.data('cytoscape'); Is there a builtin method of obtaining the cytoscape object so I can avoid doing all this work (and technically mess with a element own by the library)? 回答1: It is generally assumed that you will keep Cytoscape instance in a shared variable in the code,

How to use UI extension for Cytoscape.js in Typescript?

旧街凉风 提交于 2020-01-15 12:17:06
问题 Is it possible use Cytoscape UI extensions in Typescript? Layout extension can be used but when I need for example https://github.com/cytoscape/cytoscape.js-cxtmenu, I cant call function cy.cxtmenu( defaults ) because it isnt in cytoscape interface. Is there a way to use it? My code in index.ts: import cytoscape = require('cytoscape'); import contextMenus = require('cytoscape-cxtmenu'); cytoscape.use(contextMenus); const cy = cytoscape({ container: document.getElementById('cy'), ... }); let

Handle errors with cytoscape.js

寵の児 提交于 2020-01-14 14:19:23
问题 I am building a website where users will be inputting graph data, which is then rendered with cytoscape.js. Given that this is backed by user data, there may be instances where they put in invalid data, specifically edges that have missing targets. I'd like to capture this data and present it to the user so they can fix the errors. Currently, I get this error in the logs, but I'm unable to figure out how to capture the data. Can not create edge `TableOfBooks>att` with nonexistant target `att`