d3.js

Very Simple D3: How to Draw an Arc?

為{幸葍}努か 提交于 2020-01-11 08:41:29
问题 It would be nice to learn D3. After reading many examples, I think I understand it. My first project is to make a color wheel, without transitions for simplicity. But it appears even that is not simple enough for my first project! For project zero, I am trying to get something to show on the screen. Hopefully something I wrote (and dear read has fixed), and not an example. What did I do wrong? http://jsfiddle.net/aGdMX/1/ var arc = d3.svg.arc() .innerRadius(40) .outerRadius(100) .startAngle(0

C3/D3 pie legend format / label overlap

我的梦境 提交于 2020-01-11 07:50:14
问题 I have a piechart using C3. I have changed the default legend names by adding values and percentages and now. I am looking for a way to format this legend nicely so that the values and percentages are positioned like columns. Is there a way to prevent the labels from overlapping? This is how far I got so far: var columns = ['data11', 'data2', 'data347', 'data40098']; var data = [150, 250, 300, 50]; var colors = ['#0065A3', '#767670', '#D73648', '#7FB2CE', '#00345B']; var padding = 5; var

Moving fixed nodes in D3

微笑、不失礼 提交于 2020-01-11 02:32:25
问题 I have nodes in a D3 force-directed layout that are set to . fixed = true. If I set the .x or .y values, the nodes themselves don't move to their new position. Here's my function: function fixNode(idArray, locationX, locationY) { for ( x = 0; x < idArray.length; x++ ) { for ( y = 0; y < nodes.length; y++ ) { if (nodes[y].id == idArray[x]) { nodes[y].fixed = true; nodes[y].x = 50; nodes[y].y = 50; break; } } } } UPDATE 1: Here is the working function based on Jason's advice: function fixNode

How to force y position of one branch in d3 sankey plugin?

跟風遠走 提交于 2020-01-10 10:43:21
问题 I would like to force one branch of sankey diagram to be on top. Instead of diagram like this: would like to generate diagram where nodes 1, 2, 7, 15, 10 and 14 are always on top: Link to fiddle with current code: http://jsfiddle.net/w5jfp9t0/1/ var margin = {top: 1, right: 1, bottom: 6, left: 1}; var width = 1052 - margin.left - margin.right; var height = 500 - margin.top - margin.bottom; var formatNumber = d3.format(",.0f"), format = function(d) { return formatNumber(d); }, color = d3.scale

How to force y position of one branch in d3 sankey plugin?

北战南征 提交于 2020-01-10 10:42:08
问题 I would like to force one branch of sankey diagram to be on top. Instead of diagram like this: would like to generate diagram where nodes 1, 2, 7, 15, 10 and 14 are always on top: Link to fiddle with current code: http://jsfiddle.net/w5jfp9t0/1/ var margin = {top: 1, right: 1, bottom: 6, left: 1}; var width = 1052 - margin.left - margin.right; var height = 500 - margin.top - margin.bottom; var formatNumber = d3.format(",.0f"), format = function(d) { return formatNumber(d); }, color = d3.scale

Creating a temporal range time-series spiral plot

≡放荡痞女 提交于 2020-01-10 08:53:08
问题 Similarly to this question, I'm interested in creating time series spirals. The solution doesn't necessarily have to be implemented in R or using ggplot, but it seems the majority of solutions have been implemented in R with ggplot, with a handful in Python and one in d3. My attempts so far have all used R. Unlike this question, I'm interested in displaying specific ranges of data without quantizing/binning the data. That is, I'd like to display a spiral timeline showing when particular

Can i use d3.js for creating interactive visualizations inside an android app?

别等时光非礼了梦想. 提交于 2020-01-10 07:41:54
问题 I am trying to create an interactive visualization within an android app. The data that will be visualized will be stored locally in a sqlite database and will be queried to generate visualizations. I have not yet decided whether to build a native app or a web app. Based on my research d3.js seems to fit the needs very well but I am unsure about how to use it in a mobile environment. 回答1: You can easily embed Javascript into an Android app using the WebView component or you can use PhoneGap

D3 graph (with links) over google maps

旧巷老猫 提交于 2020-01-10 03:02:26
问题 I am trying to modify this example by adding the links between the nodes (related). <!DOCTYPE html> <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=true"></script> <script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.29.1"></script> <style type="text/css"> html, body, #map { width: 100%; height: 100%; margin: 0; padding: 0; } .stations, .stations svg {

d3.js: How to remove nodes when link-data updates in a force layout

时间秒杀一切 提交于 2020-01-09 19:10:32
问题 I'm using a force layout graph to show a network but I have problems when updating my data. I already check How to update elements of D3 force layout when the underlying data changes, and of course the "Modifying a Force Layout" as well as the "General Update Pattern" by " mbostock " from D3.js (unfortunately, I can only post a maximum of two links...). My code based on the "Mobile Patent Suits" example with some modifications and differences. You can check my full code here: <!DOCTYPE html>

change SVG text to css word wrapping

本小妞迷上赌 提交于 2020-01-09 10:39:10
问题 The following code is used to show the text labels of a javascript tree diagram. nodeEnter.append("svg:text") .attr("x", function(d) { return d._children ? -8 : -48; }) /*the position of the text (left to right)*/ .attr("y", 3) /*the position of the text (Up and Down)*/ .text(function(d) { return d.name; }); This uses svg, which has no word wrapping ability. How do I change this do a normal paragraph so that I may use css to word wrap it. How do I make this regular text and not svg text? 回答1: