force-layout

How do I replace a node with an image using D3 and CoffeeScript for a network visualization?

吃可爱长大的小学妹 提交于 2019-12-04 18:08:14
I've been attempting to solve this problem for days, and am completely stumped. I'm using this network implementation walk-through: http://flowingdata.com/2012/08/02/how-to-make-an-interactive-network-visualization/ I have successfully created my visualization through this walk-through, and now would like to replace a node with a small picture, based on the node's value. This is a great example of code to work from, where every node was replaced with an image. http: //bl.ocks .org/mbostock/950642 Specifically: node.append("image") .attr("xlink:href", "https://github.com/favicon.ico") .attr("x"

D3 Force Directed Graph ajax update

…衆ロ難τιáo~ 提交于 2019-12-04 17:41:49
问题 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

Move d3 circles away from center circle - force layout

早过忘川 提交于 2019-12-04 17:20:04
I'm working on d3 to represent nodes in circles, when the size of a circle is changed then the circles around them should move away from the one's size got changed from being overlapped. Consider the red circle above, when its size get changed then the others should move in the green arrow's direction. I tried with force simulation but I'm not able to achieve it and added the code below, I'm not sure what I'm doing wrong, can somebody help please? https://jsfiddle.net/m6s8dk7o/29/ var w = 900, h = 500; var svg = d3.select("body") .append("svg") .attr("width", w) .attr("height", h); var color =

Adding and removing nodes and links from force diagram in d3 based on filter dropdown

落爺英雄遲暮 提交于 2019-12-04 15:54:35
I'm trying to make a force diagram, with a couple of drop down boxes which filter the data on display. The first one (which is where I'm almost at now) checks for the type, and only shows nodes & links which have a source or target matching the type. What I have now, is the ability to select the filter, and the graph updates, it removes unnecessary nodes, and reformats the remaining ones to be correct. But it only works the first time. If I 're-filter' it starts to go haywire. Here's my full code, I'm very new to javascript (&d3), and I've been unashamedly stealing from bl.ocks.org, so please

d3: Multi-Foci Force key code component understanding

徘徊边缘 提交于 2019-12-04 15:38:29
The real magic for multi-foci force is done here; function tick(e) { var k = .1 * e.alpha; // Push nodes toward their designated focus. nodes.forEach(function(o, i) { o.y += (foci[o.id].y - o.y) * k; o.x += (foci[o.id].x - o.x) * k; }); node.attr("transform", function(d) { return "translate(" + d.x + "," + d.y + ")"; }); } but I'd appreciate some clarification about what's going on. alpha, I believe, is a force method that controls the rate at which the force comes to rest, accepting values in the range [0, 1] - higher values cause force to slow to a halt slower, lower values faster. We then

D3 selective Zoom

倖福魔咒の 提交于 2019-12-04 13:48:09
问题 I am working on a force directed graph layout with some added features: selectable links/nodes, tooltips, fisheye effect, and -- important for my question -- zoom and pan. Now, the zooming works very well like this: d3 ... .append('svg:g').call(d3.behavior.zoom().on("zoom", redraw))... Where the redraw function looks like this... function redraw() { trans = d3.event.translate; scale = d3.event.scale; vis.attr("transform", "translate(" + trans + ")" + " scale(" + scale + ")"); } However, this

How to visualize groups of nodes in a d3 force-directed graph layout

喜你入骨 提交于 2019-12-04 12:34:18
问题 I'm looking for a way to plug in groups to my force-directed graph visualization. I've found three related examples so far: Cola.js which would require adding another library and possibly retro-fitting my code to fit this different library. This block, which is pretty hard to untangle. This slide from mbostock's slide deck, which isn't what I want but on the right path... What I'd like most is a simple way of adding something very close to the structure from the first link, but without too

Setting different images for D3 force-directed layout nodes

扶醉桌前 提交于 2019-12-04 09:56:05
I've been trying to make a specific type of force direct graph, similar to this ( http://bl.ocks.org/mbostock/950642 ): However, instead of having all the same images I wish to have different images representing different information on the graph. My first step to this is being able to change all the circle images to random linked shapes. Whatever I try to implement in my code, the circles I have just disappear, instead of being replaced by different shapes. Any help on this problem would be great. Here is the code. Sorry, I'm also new to this site. // nodes var nodeSelecton = svg.selectAll("

Inserting a line break in D3 force layout node labels

℡╲_俬逩灬. 提交于 2019-12-04 06:29:56
So, I am playing with force directed graph, and I've made that .text on my node changes on mouse over to another text from data. My code looks like this: script: var data = {"nodes":[ {"name":"YHO", "full_name":"Yahoo", "type":1, "slug": "www.yahoo.com", "entity":"company", "img_hrefD":"", "img_hrefL":""}, {"name":"GGL", "full_name":"Google", "type":2, "slug": "www.google.com", "entity":"company", "img_hrefD":"", "img_hrefL":""}, {"name":"BNG", "full_name":"Bing", "type":2, "slug": "www.bing.com", "entity":"company", "img_hrefD":"", "img_hrefL":""}, {"name":"YDX", "full_name":"Yandex", "type"

D3 drawing a hull around group of circles

冷暖自知 提交于 2019-12-04 04:30:41
I want to draw a hull around a grouped force directed graph build with d3. I have build the graph with the circles. But I now want to join the intersections of the circles with a path(hull). If not joining the intersections, Drawing a hull surrounding the group of circles is enough. I tried the Force-Directed Layout with Convex Hull example. But I have the text and circles covering the text and links connecting the texts. var vertices = new Array(); var width = 960, height = 500; var color = d3.scale.category10(); var r = 6; var force = d3.layout.force().size([width, height]); var svg = d3