force-layout

D3: Using node attribute for links instead of index in array

本小妞迷上赌 提交于 2019-12-03 11:48:47
问题 I'm a D3.js beginner working on a network visualization, and I can't figure out how to properly specify my links for the force layout. The problem is that by default, d3 interprets the "source" and "target" of the links to be the indices of the nodes in the "nodes" array. However, in my data, the source and target refer to the id numbers of the nodes, which I've stored in a node attribute. How do I get the links to point to node.id instead of node.index ? Here is where I guess I should do it:

Is there a tap and double tap event in d3.js force directed graph

守給你的承諾、 提交于 2019-12-03 11:29:08
I am working on a force directed graph using d3.js. I need to handle tap and double tap event on nodes for mobile devices. Mouseover and click functions need to replicated as tap and double tap in d3.js. I have managed to get a touch event working but have no clue on how to capture double tap event in a mobile device. Mark Roper D3 has the touches event and using this you can get touch position coordinates from inside your event handler, but this doesn't give you any special handling for or help identify long press and doubletap. You can add support for long press and double tap yourself. For

D3 Force Directed Graph ajax update

╄→尐↘猪︶ㄣ 提交于 2019-12-03 11:06:50
I am using d3.js and jquery with a PHP back-end (based on yii framework) to create a dynamic force directed graph to represent the current state of hosts and services on the network that we are monitoring using Nagios. The graph shows root -> hostgroups -> hosts -> services. I have created a server side function to return a JSON object in the following format { "nodes": [ { "name": "MaaS", "object_id": 0 }, { "name": "Convergence", "object_id": "531", "colour": "#999900" }, { "name": "maas-servers", "object_id": "719", "colour": "#999900" }, { "name": "hrg-cube", "object_id": "400", "colour":

Collapsible/hierarchical AND force-directed graph in d3.js

风格不统一 提交于 2019-12-03 08:56:35
问题 There are numerous examples of force-directed graphs (i.e. nodes and links) and collapsible trees (i.e. parent-child nodes) but I cant find an example of the combination of these - other than some 1-level clustered networks like this - http://static.cybercommons.org/js/d3/examples/force/force-cluster.html. That is I need a full hierarchy of nodes (with any number of levels) with links between various nodes across the hierarchy. Has anyone got an example of this? And if so I'd ultimately like

d3.js force directed layout constrained by a shape

為{幸葍}努か 提交于 2019-12-03 07:56:02
I was wondering if there is a way to create a force directed layout with d3.js and restrict it by an arbitrary shape in such a way that all the nodes are equivalently distributed within the shape and the distance between the border and the nodes is equally to the distance between the nodes I hope there is already such a solution out there. Otherwise my idea is to start with the force directed layout and check the distances from the nodes to the borders in each iteration. Any suggestions from yourside? Frank van Wijk Your idea is mine too. In the tick function you could add additional forces.

D3.js - Is it possible to animate between a force-directed graph and a node-link tree?

穿精又带淫゛_ 提交于 2019-12-03 07:45:18
I am using the D3.js library and looking at the force-directed graph demo: http://mbostock.github.com/d3/ex/force.html I am also looking at the node-link tree: http://mbostock.github.com/d3/ex/tree.html What I would like to do is: - Start with the force-directed graph and when the user clicks on a node, have it animated smoothly into a tree, with the selected node in the center. - Then, when the user clicks on any empty space in the canvas, it should animate back to the force-directed graph. Has anyone done anything like this before, or have any advice as to the best approach to take? I am new

Stop Force Layout on d3js and start free dragging nodes

半腔热情 提交于 2019-12-03 06:43:28
I'm using the force layout to represent a directed unweighted network. My inspiration comes from the following example: http://bl.ocks.org/mbostock/1153292 Since my own data are really a mess, I'd like to stop the layout and move nodes by dragging them manually. I'd also like that the movement of a node doesn't change the position of others. And it's necessary that links become longer, to reach the node which has been moved. Is there a simple way to do this? riccardo.tasso At the end I found this related question which implements a solution which I'll adopt. D3 force directed graph with drag

d3.js: suggested node position in force layout

巧了我就是萌 提交于 2019-12-03 03:19:29
问题 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? 回答1: 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

avoid d3.js circles overlapping

a 夏天 提交于 2019-12-03 03:14:00
问题 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

Space out nodes evenly around root node in D3 force layout

流过昼夜 提交于 2019-12-02 23:59:49
I am just starting on D3, so if anyone has any general suggestions on thing I might not be doing correctly/optimally, please let me know :) I am trying to create a Force Directed graph with the nodes spaced out evenly (or close enough) around the center root node (noted by the larger size). Here's an example of the layout I'm trying to achieve (I understand it won't be the same every time): I have the following graph: var width = $("#theVizness").width(), height = $("#theVizness").height(); var color = d3.scale.ordinal().range(["#ff0000", "#fff000", "#ff4900"]); var force = d3.layout.force()