d3.js

d3 drag behavior not working properly on html elements

蓝咒 提交于 2019-12-25 02:59:42
问题 I want to show multiple charts in a table, each chart is a separate svg, generated with d3. The height of each chart has to be easily adjustable - and I want that to be done in a similar manner as you adjust the 4 panels (html, javaScript, css, output) in jsFiddle, by dragging the mouse over a border between those panels - in my case it's only horizontal borders. I'd like to use d3.behavior.drag(). When the border (a div in a td of the table, or something like that) is dragged, the height of

how do I add another line dynamically?

限于喜欢 提交于 2019-12-25 02:58:55
问题 I'm trying to create dynamic line that randomly moves on the page, I also want to move the tip of the line with mouse movement so I tried adding another data in "linedata" variable but it only renders 1 line. the code below only has 1 data in "linedata" array, I tried something like var random = { a: Math.floor(Math.random()*randNum), b: Math.floor(Math.random()*randNum), }; linedata = [ "M 0 0 L 200 " + (100+random.a), "M 100 100 L 200 " + (100+random.b) ]; <!DOCTYPE html> <html> <head>

d3: Cannot read property 'weight' of undefined in d3.force implementation

北战南征 提交于 2019-12-25 02:55:13
问题 I understand that the question has been asked a million times. Yet i am unable to figure out what is the issue. I am trying to replicate the force directed graph as given in the link below [http://bl.ocks.org/paulovn/9686202][1] The jsfiddle link is http://jsfiddle.net/k8a3dyuL/ I am unable to understand why i am getting this error. I created a sample json object for which it worked as expected.I am able to establish connection between the nodes. "nodes": [ { "index": 0, "links": [ 1, 2, 3 ],

Angular nvD3 Error: Invalid isolate scope definition for directive nvd3 [duplicate]

依然范特西╮ 提交于 2019-12-25 02:50:49
问题 This question already has an answer here : AngularJS nvD3 Error - What versions are compatible? (1 answer) Closed 2 years ago . I'm trying to use AngularJS, D3, NVD3 , and Angular-NVD3 all together. I'm following the quick guide here: http://krispo.github.io/angular-nvd3/#/quickstart and the pie chart example here: https://github.com/krispo/angular-nvd3/blob/gh-pages/js/pieChart.js but it's just not working for me! I get this error in the console: Error : Error: Invalid isolate scope

TypeError: Cannot call method 'forEach' of undefined " in d3 js on MVC Razor

回眸只為那壹抹淺笑 提交于 2019-12-25 02:48:13
问题 Why I am getting error on below code in place of data.forEach I added D3 js as well but code is not able to identified the "data.forEach".please let me know how to resolve this issue on MVC razor. my data2.csv is below date,close 1971,0.357 1972,1.927 1973,1.870 1974,2.014 1975,10.995 1976,16.227 1977,16.643 1978,20.644 1979,22.478 my scripts is below var margin = { top: 20, right: 20, bottom: 30, left: 50 }, width = 600 - margin.left - margin.right, height = 400 - margin.top - margin.bottom;

How to make d3 directional force diagram reactive in meteor?

三世轮回 提交于 2019-12-25 02:37:17
问题 Try as I might, I can't seem to get meteor and d3 to play nicely when it comes to a directional force diagram. Since I'm new to both Meteor and d3, I'm not sure where my failing is.. What I'm trying to do is to get (re)create just the following sample graph, but one which is reactive to the mongo data source. Any help at all would be most appreciated! (Click here for live demo) // get the data d3.csv("force.csv", function(error, links) { var nodes = {}; // Compute the distinct nodes from the

How to put first row in tsv to row thead <th> in table and the rest go to tbody <td> with d3

谁说胖子不能爱 提交于 2019-12-25 02:34:19
问题 I'm trying to learn D3 by creating a table. The code below is what I have so far. Say my TSV data has 3 columns, I only want the first row ( 3 object from data ) => to be in my thead section and the rest ( 4th object of my data ) go into tbody section d3.text("test.tsv", function(text) { var data = d3.tsv.parseRows(text); var table = d3.select("body").append("table"), thead = table.append("thead"), tbody = table.append("tbody"); var hrows = thead.selectAll("tr") .data(data) .enter() .append(

How to get striped grey background resembling 100% to the barchart?

吃可爱长大的小学妹 提交于 2019-12-25 02:24:33
问题 This is a follow-up question to this question. How do I get the striped grey scale in the background which represents 100% and is parallel to Y-axis? jsFiddle Code: var data = [ { "age": "Under 18", "value": "582.13", "color": "#B3DA29" }, { "age": "18 - 22", "value": "583.98", "color": "#78C0F2" }, { "age": "23 - 34", "value": "603.00", "color": "#9B58B5" }, { "age": "35 - 60", "value": "607.70", "color": "#E54C3C" }, { "age": "60 - Above", "value": "610.00", "color": "#F2519D" } ]; var

D3 bar chart - last bar overhangs the end of the X axis

佐手、 提交于 2019-12-25 02:07:03
问题 I have a D3 stacked bar chart that is working great except that the last bar overhangs the right side of X axis and the left side of the axis is not touching the Y axis. This is because I had to move the bars so that they would be centered over the tick lines. I thought that if I padded the time scale by a date on either end that would take care of it, but instead the bars just spread out to take up the available space. Here is a JSFiddle: http://jsfiddle.net/goodspeedj/cvjQq/ Here is the X

d3.js Force Chart - image/node linkage and animation

蹲街弑〆低调 提交于 2019-12-25 02:00:31
问题 I've enhanced a force diagram to compare two profiles. I am trying to have the main node take on an image http://jsfiddle.net/LsMZp/5/ how do I get the image to be centrally aligned (sized correctly) and the thumbnail data passed in more dynamically from the json string. also if someone shares a particular interest - is there a better way of handling it - if the information is duplicated a link is formed but a nomad node remains left and unlinked. also is there a way to provide a stir of