d3.js

How to plot a directed Graph in R with networkD3?

半世苍凉 提交于 2020-02-21 05:12:11
问题 when I am ploting a directed graph with NetworkD3 , The edges are not directed , how can I fix it ? an Example : library(networkD3) data(MisLinks) data(MisNodes) forceNetwork(Links = MisLinks, Nodes = MisNodes, Source = "source", Target = "target", Value = "value", NodeID = "name", Group = "group", opacity = 0.8) I want the result to be directed This is the definetion of directed Graph: "A directed graph is graph, i.e., a set of objects (called vertices or nodes) that are connected together,

Why can I input an argument on a scale?

早过忘川 提交于 2020-02-15 13:21:12
问题 I'm doing a simple histogram: var width = 500, height = 500, padding = 50; d3.csv('mydata.csv', function(data) { var map = data.map(function(i) { return parseInt(i.age) }) var histogram = d3.layout.histogram() .bins(7)(map) console.log(histogram) var y = d3.scale.linear() .domain([0, d3.max(histogram.map(function(i) { return i.length; }))]) .range([0, height]) var x = d3.scale.linear() .domain([0, d3.max(map)]) .range([0, width]); var canvas = d3.select('body').append('svg') .attr('width',

Why can I input an argument on a scale?

孤街醉人 提交于 2020-02-15 13:18:47
问题 I'm doing a simple histogram: var width = 500, height = 500, padding = 50; d3.csv('mydata.csv', function(data) { var map = data.map(function(i) { return parseInt(i.age) }) var histogram = d3.layout.histogram() .bins(7)(map) console.log(histogram) var y = d3.scale.linear() .domain([0, d3.max(histogram.map(function(i) { return i.length; }))]) .range([0, height]) var x = d3.scale.linear() .domain([0, d3.max(map)]) .range([0, width]); var canvas = d3.select('body').append('svg') .attr('width',

Why can I input an argument on a scale?

社会主义新天地 提交于 2020-02-15 13:18:40
问题 I'm doing a simple histogram: var width = 500, height = 500, padding = 50; d3.csv('mydata.csv', function(data) { var map = data.map(function(i) { return parseInt(i.age) }) var histogram = d3.layout.histogram() .bins(7)(map) console.log(histogram) var y = d3.scale.linear() .domain([0, d3.max(histogram.map(function(i) { return i.length; }))]) .range([0, height]) var x = d3.scale.linear() .domain([0, d3.max(map)]) .range([0, width]); var canvas = d3.select('body').append('svg') .attr('width',

D3 tween - pause and resume controls

て烟熏妆下的殇ゞ 提交于 2020-02-14 02:24:48
问题 I am trying to edit this d3 example. More specifically, I will try to apply the pause-resume controls of a pause resume guide in addition with a control bar like this we have under videos. At the end I imagine to have something like this: How can apply the pause resume control in the beginning? 回答1: Here's a quick implementation. The pause essentially cancels the current transition and the play resumes it based on time/position it was paused: var pauseValues = { lastT: 0, currentT: 0 };

How to apply preferences to a d3.tree node

岁酱吖の 提交于 2020-02-08 10:00:26
问题 I have adapted a code from https://bl.ocks.org/mbostock/4063550 to make a nice figure for the tidy arrangement of layered nodes. Assume I have a similar flare.csv file as on the webpage. The code right now assigns color based on whether a node is on an internal circle (which means the node has two links) or on an outer circle. What I want instead is to assign a specific color (let's say blue) to the point located in the center (the parent node) whose name is flare. Also I want to assign a

How to apply preferences to a d3.tree node

℡╲_俬逩灬. 提交于 2020-02-08 09:58:45
问题 I have adapted a code from https://bl.ocks.org/mbostock/4063550 to make a nice figure for the tidy arrangement of layered nodes. Assume I have a similar flare.csv file as on the webpage. The code right now assigns color based on whether a node is on an internal circle (which means the node has two links) or on an outer circle. What I want instead is to assign a specific color (let's say blue) to the point located in the center (the parent node) whose name is flare. Also I want to assign a

Labels not displaying on D3 donut chart

元气小坏坏 提交于 2020-02-08 08:02:44
问题 New to D3. Making a donut chart but only some of the labels are displaying, not sure why. http://dailyspiro.com/impact.html var data = [ {name: "Facebook", val: 26}, {name: "Gmail", val: 19}, {name: "Twitter", val: 7}, {name: "Jane's Blog", val: 5}, {name: "Other", val: 21 } ]; var w = 400, h = 400, r = Math.min(w, h) / 2, labelr = r + 30, // radius for label anchor donut = d3.layout.pie(), arc = d3.svg.arc().innerRadius(r * .6).outerRadius(r); var vis = d3.select(".impact-chart") .append(

Labels not displaying on D3 donut chart

余生长醉 提交于 2020-02-08 08:02:41
问题 New to D3. Making a donut chart but only some of the labels are displaying, not sure why. http://dailyspiro.com/impact.html var data = [ {name: "Facebook", val: 26}, {name: "Gmail", val: 19}, {name: "Twitter", val: 7}, {name: "Jane's Blog", val: 5}, {name: "Other", val: 21 } ]; var w = 400, h = 400, r = Math.min(w, h) / 2, labelr = r + 30, // radius for label anchor donut = d3.layout.pie(), arc = d3.svg.arc().innerRadius(r * .6).outerRadius(r); var vis = d3.select(".impact-chart") .append(

Read local file text (tab separated values) with d3 or ajax cause syntax error in firefox development console

只愿长相守 提交于 2020-02-08 03:04:13
问题 The reading works. However I got a syntax error in the firefox console (which is tiresome when I read 30 files). The files are annotation files like (time \t value) with no headers like : 0.0 5.2 0.5 5.6 1.0 6.3 ... This is the ajax code : function getdatafromfile(filename) { // Read annotation file. Example : %timeinstant \t %value \n // Return an array of string var arraydata $.ajax({ type: "GET", url: filename, dataType: "text", async: false, success: function(csv) {arraydata = $.csv