cytoscape-web

Cytoscape js - Call a function whenever a node is clicked

亡梦爱人 提交于 2021-02-10 20:31:02
问题 I initialized the cytoscape like this: var cy = cytoscape({ container: document.getElementById('cy'), elements: [ { data: { id: 'a' } }, { data: { id: 'b' } }, { data: { id: 'c' } }, { data: { id: 'ab', source: 'a', target: 'b' } }, { data: { id: 'ac', source: 'a', target: 'c' } }] }); Then I added a function which adds a new node whenever the user double clicks on the viewport. var nid = 1; document.getElementById("cy").ondblclick = function(e) { cy.add({ data: { id: nid }, renderedPosition:

Cytoscape js - Call a function whenever a node is clicked

烈酒焚心 提交于 2021-02-10 20:28:04
问题 I initialized the cytoscape like this: var cy = cytoscape({ container: document.getElementById('cy'), elements: [ { data: { id: 'a' } }, { data: { id: 'b' } }, { data: { id: 'c' } }, { data: { id: 'ab', source: 'a', target: 'b' } }, { data: { id: 'ac', source: 'a', target: 'c' } }] }); Then I added a function which adds a new node whenever the user double clicks on the viewport. var nid = 1; document.getElementById("cy").ondblclick = function(e) { cy.add({ data: { id: nid }, renderedPosition:

how to use different colors to mark nodes in cytoscape.js?

一笑奈何 提交于 2020-06-27 04:09:31
问题 currently I'm trying to realize this function: I've created a color selector on the website. Once a user selects a specific color, the colors of nodes he/she selected and their neighbouring nodes will be changed into the color selected after tap. For example, in the case below, if I select "red" and then choose the node "cytoscape", the "cytoscape" and the "cytoscape.js" will both be red. Now if I change the color into "green" and then I click on "test", the "test" node will change into green

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

Initializing cytoscape

穿精又带淫゛_ 提交于 2019-12-10 19:09:41
问题 being new to cytoscapeweb 2, i am following one of the provided example in order to learn how to use the API. i cant make it work and firebug reports the following message: Component returned failure code: 0x80004005 (NS_ERROR_FAILURE) var n = this.nodesGroup.getBBox(); in my html document, the cytoscapeweb div is embedded in a jquery tab widget (just to provide context) somewhere in my.html <div id="tabs"> <ul> <li><a href="#tabs-1">Interactors Selection</a></li> <li><a href="#tabs-2"

Cytoscape.js force-directed layouts and node placement

浪子不回头ぞ 提交于 2019-12-10 16:16:52
问题 I recently found out about Cytoscape.js and would like to try out the force-directed layouts: arbor and springy. Now, I have a couple of questions: Is it possible to achieve a graph, by using one of the layouts, in which the node placement is based on some algorithm and node coordinates are not necessary? For example, in VivaGraphJS the graph converges so that the connected nodes form groups and lone nodes move to the periphery. If this can be done on force-directed layout, can the forces be

How to use tooltip javascript library(qtip.js) together with cytoscape.js

a 夏天 提交于 2019-12-08 07:02:46
问题 I want to use qtip together with cytoscape.js to dispaly tooltips in nodes on mouseover event in graph created with cytoscape.js. I have placed following code inside ready: function() as shown below: cy.on('mouseover','node',function (event) { var eid = $(this).data('id'); $(this).qtip({ overwrite: false, content: eid, position: { my: 'right center', at: 'left center', target: $(this) }, show: { event: event.type, ready: true }, hide: { fixed: true } }, event); }); But, there is no tooltip

Increase width of selected edges only (cytoscape.js)

 ̄綄美尐妖づ 提交于 2019-12-07 19:44:13
问题 How can I predefine when I select a few nodes that are connected or simply edges, to make the width of the selected edges be bigger, without affecting the rest of edges of the entire network or the node's width? I predefined this when the nodes or edges are selected: $('#cy').cytoscape({ style: cytoscape.stylesheet() .selector(':selected') .css({ 'background-color': 'black', 'line-color': 'red', 'target-arrow-color': 'black', 'source-arrow-color': 'black', 'opacity': 1 })... but there is no