cytoscape.js

Loading and using JSON for Cytoscape.js

时光怂恿深爱的人放手 提交于 2019-12-06 12:00:31
问题 Context I want to use cytoscape.js for visualizing graphs. While I am capable with a myriad of languages ( C++ , Mathematica , R , etc), I am new to Javascript , JSON , HTML , and CSS . Thus it would be favorable to learn these languages through this use case (implementing graphs with cytoscape.js ). Please keep this in mind in your answer. I have previously asked how to [remotely load cytoscape.js and how to get graphs display (requires a div). Since then I have created a script that turns a

A hidden Cytoscape graph cannot be displayed later

你离开我真会死。 提交于 2019-12-06 11:04:26
问题 I have 2 Bootstrap columns (each width is 6 out of 12), the one on the left has some buttons, the one on the right contains a Cytoscape graph initialized with 5 nodes. Initially, when the page loading finished, the Cytoscape graph is set to be hidden. $('.cyto_div').hide(); My intention is that when the "Show" button is clicked, the Cytoscape graph should appear. $('.cyto_div').show(); However, only the panel covering the Cytoscape graph appears, the graph itself doesn't appear. When I resize

How to lock the position of a cytoscape.js node within its parent node

孤街醉人 提交于 2019-12-06 06:48:37
问题 I want to lock the position of a node relative to its parent compound node, such that if I grab and drag the parent node, the child node moves with it, but the child is not individually grabbable. If I set the child to be ungrabbable and/or locked, then it doesn't move with its parent, but if I don't, it can be individually dragged, which I don't want. Can this be done? Failing that, is there a way to programmatically grab/ungrab a node so that I can listen for a grab event and then grab the

Exporting and importing JSON data to Cytoscape.js

爱⌒轻易说出口 提交于 2019-12-06 06:17:15
问题 Based on this question and answer, I've made this JSFiddle. What I'm trying to do is to find a way to properly export / import JSON data to cytoscape.js. I'm using JSON.stringify(cy.json()) to get JSON data from elements, and on the other hand I'm cleaning the cy area and using cy.add(text-input) to add the elements back. I.e.: you can add a node, copy it's JSON data generated, then you can refresh the browser and paste the JSON data from node directly, tryng to add it to cy . But I couldn't

Adding cytoscape node at the location of mouse cursor

微笑、不失礼 提交于 2019-12-06 06:13:44
I want to add a cytoscape node at the location of mouse arrow, on a click event on the canvas. How can I do this? My approach : (not working so well) I am able to create a node on a click but I am not able to make sure the position of the created node is at the place where I have clicked. Using something like this: $("#cy").click(function(event){ pos = getMousePosition(this, event) cy.add([ { group: "nodes", data: { id: "testid" }, position: pos }, ]); }); I have not been able to define getMousePosition() correctly. How should I define this function to get the node rendered at the right

cytoscape save graph as image by button

回眸只為那壹抹淺笑 提交于 2019-12-06 05:21:05
问题 I saw in the cytoscape.js tutorial that there are ways to represent the graph as image (png, jpg), but there is a way to represent it as regular graph, and if the user would want he can save it as image by click on button or similar option? Didn't find simple way for that. I am using python flask as my server side and cytoscape js for the graphes. 回答1: You don't need server side code to save files from the browser anymore. You can save files using the saveAs() API in JS. Here's a polyfill:

cytoscape.js disable grab&moving nodes

断了今生、忘了曾经 提交于 2019-12-05 18:55:43
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). Can you help me with this? initOptions.autoungrabify: true or cy.nodes().ungrabify() You can also disable

A hidden Cytoscape graph cannot be displayed later

故事扮演 提交于 2019-12-04 17:28:04
I have 2 Bootstrap columns (each width is 6 out of 12), the one on the left has some buttons, the one on the right contains a Cytoscape graph initialized with 5 nodes. Initially, when the page loading finished, the Cytoscape graph is set to be hidden. $('.cyto_div').hide(); My intention is that when the "Show" button is clicked, the Cytoscape graph should appear. $('.cyto_div').show(); However, only the panel covering the Cytoscape graph appears, the graph itself doesn't appear. When I resize the browser, then the Cytograph with 5 nodes appear. I suspect somewthing to do with cy.resize(), but

Loading and using JSON for Cytoscape.js

情到浓时终转凉″ 提交于 2019-12-04 16:19:30
Context I want to use cytoscape.js for visualizing graphs. While I am capable with a myriad of languages ( C++ , Mathematica , R , etc), I am new to Javascript , JSON , HTML , and CSS . Thus it would be favorable to learn these languages through this use case (implementing graphs with cytoscape.js ). Please keep this in mind in your answer. I have previously asked how to [remotely load cytoscape.js and how to get graphs display (requires a div ) . Since then I have created a script that turns a graph as represented in one of the other languages I use, into the JSON format indicated here .

How to lock the position of a cytoscape.js node within its parent node

会有一股神秘感。 提交于 2019-12-04 12:36:33
I want to lock the position of a node relative to its parent compound node, such that if I grab and drag the parent node, the child node moves with it, but the child is not individually grabbable. If I set the child to be ungrabbable and/or locked, then it doesn't move with its parent, but if I don't, it can be individually dragged, which I don't want. Can this be done? Failing that, is there a way to programmatically grab/ungrab a node so that I can listen for a grab event and then grab the parent instead/as well? Compound grabbing/locking logic with children probably needs to be improved in