d3.js

XHR / Post Request using D3

你。 提交于 2019-12-30 10:30:51
问题 I was doing a research on how to make POST requests using the amazingly powerful D3 (which I can fully fully recommend for data visualization) and found the xhr2 branch where the authors of D3 are currently working on xhr POST request (and other request types) support. Seems like it is a brand new feature as the merge request is from yesterday (18 September 2012) :) And as curious I am I already wanted to try it out, using the following code sequence (which I have from this location) d3.text(

How to force nvd3 to display the equal number of ticks as that of the values plotted on the graph-nvd3

本秂侑毒 提交于 2019-12-30 10:27:10
问题 How can force nvd3 graph to have certain number of ticks to be displayed, for example, please find below the image of the graph plotted: as seen below I have 7 values pushed to the array holding the 7 days of the week. However looks like they have more number of ticks than the actual values. What I'm looking for is something similar to this:http://nvd3.org/examples/line.html However when i hover over these ticks they are misaligned as shown: thats where the graph line should be and thats

Axis tick labelling

我的未来我决定 提交于 2019-12-30 09:30:09
问题 The x axis of my line graph represents money. Is there any way to append a € symbol to the beginning of each tick? At the moment they are just values 2000000, 250000, 300000.... I would like them to display €2000000, €250000, €300000.... I tried adding the € to my .CSV file but it caused an error when I tried to call the data to make my axis. 回答1: Use the tickFormat function: https://github.com/mbostock/d3/wiki/Quantitative-Scales#wiki-linear_tickFormat For example: axis.tickFormat( function

Rebinding exports in d3.js v4

喜你入骨 提交于 2019-12-30 08:14:11
问题 I'm creating a map using the modules system. I'm more or less used to D3.js v3 but I am still getting used to v4. I am trying to add a dispatch but I don't know how to rebind the exports in V4, as this function is not available now. So for my dispatch (_dis) and my particular event ("changetype"), the rebind in d3 v3 would be right before returning the exports, for example: d3.mapDots = function (districts){ var _dis = d3.dispatch('changetype'); (...) exports.color = function(_c){ if(

Coordinate trigonometry - calculate midpoint in arc for flightpath

こ雲淡風輕ζ 提交于 2019-12-30 07:50:11
问题 I am trying to draw flightpaths on a map using SVGs. I'm using d3 on top of Leaflet, but the frameworks used shouldn't make a difference to my problem - it's trig. http://fiddle.jshell.net/zw8TR/26 The way I'm trying to do this is by creating a quadratic bezier curve (I'm open to other/easier ways if you know of any). What I need to calculate is 1 control point, perpendicular to the midpoint of each line. This point should always bias to a higher y value / latitude than the midpoint, to

d3.js tooltips on path

℡╲_俬逩灬. 提交于 2019-12-30 07:32:48
问题 a lot of what I've read regarding d3.js and tooltips makes reference to having individual points on a graph. instead, my graph graph is using one long path to render. I was wondering how I would apply mouseover methods to such a path, where I would then tie a tooltip div accordingly http://jsfiddle.net/ericps/xJ3Ke/6/ svg.append("path") .attr("class", "area") .attr("clip-path", "url(#clip)") .style("fill", "url(#gradient)"); 回答1: You can set a layer of invisible objects representing each

D3: Hyperlinks in tree diagram

末鹿安然 提交于 2019-12-30 07:28:58
问题 I'm having trouble hyperlinking child elements in a Reingold-Tifold tree graph. The graph is built in D3 and is based on the one that Mike Bostock uses an example: http://bl.ocks.org/mbostock/4339184 My code and a segment of my JSON file are below. At this point, the graph works fine - if I click on a parent node, it expands to reveal a series of child nodes that are contained in my JSON file. But when I get to the child level, I want to make the word hyperlinked. I don't understand how to do

How to add a force drag event in D3 and make the node stay where i leave it?

二次信任 提交于 2019-12-30 07:20:14
问题 i have a D3 api which is showing some relationship between the nodes .I want to apply force.drag() event here where I will drag the node in a position and leave the node and it will stay there.I have a working fiddle here,which is showing the relationship among the nodes.can anyone help me from here to do this event in this api? .. this is the fiddle var node = vis .selectAll("g.node") .data(data.nodes) .enter() .append("svg:g") .attr("class", "node") .call(force.drag); http://jsfiddle.net

Disable d3 brush resize

六月ゝ 毕业季﹏ 提交于 2019-12-30 06:54:25
问题 Is it possible to have a brush that is a static width ie a brush that is not resizable? It would still need to be draggable. There doesn't seem to be anything indicating whether it's possible in the documentation. 回答1: There's no explicit option for that, but all you need to do is reset the domain in the brush event handler, for example var brush = d3.svg.brush().on("brush", brushed); function brushed() { brush.extent(desiredDomain); } 回答2: Resize can be prevented by hiding the resize handles

Disable d3 brush resize

 ̄綄美尐妖づ 提交于 2019-12-30 06:53:06
问题 Is it possible to have a brush that is a static width ie a brush that is not resizable? It would still need to be draggable. There doesn't seem to be anything indicating whether it's possible in the documentation. 回答1: There's no explicit option for that, but all you need to do is reset the domain in the brush event handler, for example var brush = d3.svg.brush().on("brush", brushed); function brushed() { brush.extent(desiredDomain); } 回答2: Resize can be prevented by hiding the resize handles