force-layout

d3.js: suggested node position in force layout

狂风中的少年 提交于 2019-12-02 16:49:58
I would like to create a graph where nodes have suggested positions, but I would also like to use the force layout to ensure the nodes themselves don't overlap. Is this possible in d3? Yes, you can do this by: Disabling the default gravity and charge forces. Implementing collision detection . Implementing "custom" gravity that attracts each node to its suggested position. Here's a live example: http://bl.ocks.org/1804919 Similar techniques were used in Shan Carter's visualization of Obama's 2013 budget proposal , which are further discussed in a tutorial by Jim Vallandingham . 来源: https:/

avoid d3.js circles overlapping

こ雲淡風輕ζ 提交于 2019-12-02 16:44:57
You can see in this bl.ock http://bl.ocks.org/3012590 that there are many points geo-referenced in Paris, with the big circle over the little ones: I would like to get something similar to http://vallandingham.me/vis/gates/ , so that circles get closely appended by its border. Sorry, I could not find the answer in this code, i am missing something I think. Is there an easy fix to get that? tried different negative charge forces, causing problems if circle size changes (if all circles in Paris become little, then they become too far away each other)? If your goal is to prevent overlap, then

D3 force layout - .exit().remove() just giving back errors on tick event

ⅰ亾dé卋堺 提交于 2019-12-02 01:17:02
问题 I have a problem with link.exit().remove(); and node.exit().remove(); . If I set it in the initializeGraph method then I get several errors with the tick function I think. So my question is how or why do I get those errors: Uncaught TypeError: undefined is not a function graph-d3.js:156initializeGraph graph-d3.js:156updateForceUsingNewNodes graph-d3.js:108createGraph graph-d3.js:18$.ajax.success ajax-stuff.js:106j jquery-2.1.1.min.js:2k.fireWith jquery-2.1.1.min.js:2x jquery-2.1.1.min.js:4n

D3.js Force Layout - showing only part of a graph

ぐ巨炮叔叔 提交于 2019-12-02 01:12:43
Good morning, just starting with the awesome d3js library ... I want to show only a portion of a graph with the force directed layout. The idea is to have one node declared as the "center" and show all nodes within a distance of two (for example) from this center node, the neighbors of the center node and the neighbors of the neighbors. If the user clicks on one of the displayed nodes it becomes the "new" center node and a different "subgraph" is displayed. I wonder if there is an example around implementing this kind of subgraph layout and if some kind of a "node-distance" algorithm is

Recreating collapsible force layout using d3 v4

蹲街弑〆低调 提交于 2019-12-01 23:13:34
问题 I've been trying to create a Collapsible force layout using d3js v4, similar to this one: https://mbostock.github.io/d3/talk/20111116/force-collapsible.html I've been able to create the layout itself. But not able to update it. Can anyone help? Here's my js code: var width = 960, height = 600; var root = { "name": "server1900", "children": [{ "name": "server913", "_children": null, "children": [{ "name": "server948" }, { "name": "server946" }] }, { "name": "server912", "_children": null,

D3 force layout - .exit().remove() just giving back errors on tick event

邮差的信 提交于 2019-12-01 21:13:05
I have a problem with link.exit().remove(); and node.exit().remove(); . If I set it in the initializeGraph method then I get several errors with the tick function I think. So my question is how or why do I get those errors: Uncaught TypeError: undefined is not a function graph-d3.js:156initializeGraph graph-d3.js:156updateForceUsingNewNodes graph-d3.js:108createGraph graph-d3.js:18$.ajax.success ajax-stuff.js:106j jquery-2.1.1.min.js:2k.fireWith jquery-2.1.1.min.js:2x jquery-2.1.1.min.js:4n.prop.on.c jquery-2.1.1.min.js:4n.event.dispatch jquery-2.1.1.min.js:3r.handle jquery-2.1.1.min.js:3

Recreating collapsible force layout using d3 v4

喜欢而已 提交于 2019-12-01 20:49:23
I've been trying to create a Collapsible force layout using d3js v4, similar to this one: https://mbostock.github.io/d3/talk/20111116/force-collapsible.html I've been able to create the layout itself. But not able to update it. Can anyone help? Here's my js code: var width = 960, height = 600; var root = { "name": "server1900", "children": [{ "name": "server913", "_children": null, "children": [{ "name": "server948" }, { "name": "server946" }] }, { "name": "server912", "_children": null, "children": [{ "name": "server984" }, { "name": "server983" }] }, { "name": "server911", "_children": null,

Problems adding and removing nodes in a force-layout using d3.js

点点圈 提交于 2019-12-01 12:26:25
I am trying to visualize the server availability (and later other things, once this works) by fetching data from the Zabbix API. You can see an example on how the data returned looks like [here][1] in the Zabbix API Documentation. Getting the data is not the problem, but I am having some trouble with d3.js's data joining I think, or rather how I am supposed to do this. After fetching the data I get a array of servers sorted alphabetically, and I want the new servers to appear, the ones removed to just disappear and any changes in availability (or otherwise - in the future) to be reflected with

Problems adding and removing nodes in a force-layout using d3.js

蓝咒 提交于 2019-12-01 11:10:39
问题 I am trying to visualize the server availability (and later other things, once this works) by fetching data from the Zabbix API. You can see an example on how the data returned looks like [here][1] in the Zabbix API Documentation. Getting the data is not the problem, but I am having some trouble with d3.js's data joining I think, or rather how I am supposed to do this. After fetching the data I get a array of servers sorted alphabetically, and I want the new servers to appear, the ones

How to approach filtering nodes and edges rendered via d3.js according to user preference?

对着背影说爱祢 提交于 2019-12-01 10:45:47
Link to my code (Plunker) I am developing a network diagram in D3.js force layout for academic purpose. I have so far coded a graph which displays nodes and edges. I have an auto-complete text box in jquery where user can enter a node name. D3.js (Only part of code. For complete code see my plunker link): var force = d3.layout.force() .nodes(d3.values(nodes)) .links(links) .size([width, height]) .linkDistance(100) .charge(-1546) .on("tick", tick) .start(); var svg = d3.select("#schemio") .append('svg') .attr("width", width) .attr("height", height); var link = svg.selectAll(".link") .data(force