fkling / JSNetworkX

Build, process and analyze graphs in JavaScript (port of NetworkX)
https://felix-kling.de/jsnetworkx/
Other
757 stars 185 forks source link

Dynamic node addition #72

Closed Narahiby closed 6 years ago

Narahiby commented 6 years ago

I need your help to add a node to the location I want, not randomly. I use this line to draw :

jsnx.draw(G, { element: '#canvas', layoutAttr: {charge: -800 ,linkDistance: 70, size : [0.5,0.5] }, nodeAttr: { r: function(d) { return d.data.count*2;}}, weighted: true, withLabels: true, labelStyle: {fill: 'black'}, edgeStyle: {'stroke-width': 3,fill: 'blue'}, edge_offset: 100,height : 400, width : 1000 } ,true);

and I use this line to add a node : G.addNode(x, {count: poids2});

I want node x to appear in the coordinate 400,200 of my drawing.

In adition, I tried to fix a node of my graph or to create a attraction points in the middle of my drawing

thanks for your help