vis.js-network

Unable to fix position of two nodes in vis.js

冷暖自知 提交于 2021-01-28 10:25:03
问题 I am trying to fix the position of two nodes. They should be on top of each other, 400px apart in the y-dimension. var edges = [{ id:"1", fixed: {x:true, y:true}, x:0,y:-200 },{ id:"2", fixed: {x:true, y:true}, x:0,y:200 }, ...]; However, the position are not fixed and wander all over the place. This is the corresponding fiddle. Any ideas? 回答1: Maybe this workaround will work for you: 1) store nodes and edges in dataSets 2) set node positions on afterDrawing and update the dataSet network.on(

Unable to fix position of two nodes in vis.js

做~自己de王妃 提交于 2021-01-28 10:23:38
问题 I am trying to fix the position of two nodes. They should be on top of each other, 400px apart in the y-dimension. var edges = [{ id:"1", fixed: {x:true, y:true}, x:0,y:-200 },{ id:"2", fixed: {x:true, y:true}, x:0,y:200 }, ...]; However, the position are not fixed and wander all over the place. This is the corresponding fiddle. Any ideas? 回答1: Maybe this workaround will work for you: 1) store nodes and edges in dataSets 2) set node positions on afterDrawing and update the dataSet network.on(

Accessing node data in vis.js click handler

ぃ、小莉子 提交于 2020-01-22 14:00:19
问题 I am having a network graph of nodes and edges and would like to get the node data once it gets clicked. I currently have var network = new vis.Network(container, data, options); network.on( 'click', function(properties) { console.log('clicked node ' + properties.nodes); }); But this just gives me some internal id [105]. Is there a way to get the actual data that is associated with the node. 回答1: The node ids that you get in the properties is not "some internal id", but these are the id's of

SVG Foreign Object sizing inconsistent

徘徊边缘 提交于 2020-01-15 04:22:32
问题 I'm trying to make 2 html objects in SVGs and further use them inside Vis.js graphs. My first svg (Button) works as intended and looks good. My problem is that when I try to insert the table div the width/height are not what I have set them to be. Here's what I get: As you can see the button is larger than the red box even though the red box has a larger width and height (1000px x 800px versus 220px x 68px)! Here's my JavaScript: // THE RED BOX const tableComponent = `<svg xmlns="http://www

VISJS: save manipulated data to json

﹥>﹥吖頭↗ 提交于 2020-01-14 10:33:52
问题 I am using vis.js to create network graphs on a web page. My need is to store manipulated graphs to a database in JSON format, exporting the json from the network graph. I did not find any documentation about it, is it feasible to export vis.js network with manipulated data for storage (in either JSON or in a form convertable into JSON)? 回答1: As for data , here's my hacky way to extract it for storage (I'll try to cut off code bits irrelevant to the question): // get nodes and edges var nodes

How to change edge connection points between nodes VisJs

自闭症网瘾萝莉.ら 提交于 2020-01-06 06:41:15
问题 I'm trying to code a visualization pipeline in VisJs. So I have a graph and some nodes. The nodes can generate/use a few different data types. So I need something like this ------------------ | Node1 | ------------------ int char | | | | | | | | int string char ------------------ | Node2 | ------------------ So one node has more than 1 anchor points that only connect to it's own type. Can I change the location from where the edges are drawn to where they are connected in the node? Does anyone

How to limit zooming of a vis.js network?

可紊 提交于 2020-01-04 02:06:25
问题 I've implemented a simple network using vis.js. Here's my code: //create an array of nodes var nodes = [ { id: "1", label: "item1" }, { id: "2", label: "item2" }, { id: "3", label: "item3" }, ]; // create an array with edges var edges = [ { from: "1", to: "2", label: "relation-1", arrows: "from" }, { from: "1", to: "3", label: "relation-2", arrows: "to" }, ]; // create a network var container = document.getElementById('mynetwork'); // provide the data in the vis format var data = { nodes: