How to get absolute coordinates of object inside a group?

Others here have already mentioned SVGLocatable.getBBox() which is useful for grabbing the bounding box of an element in terms of its own local coordinate system. Unfortunately, as you noticed, this doesn’t take into account any of the transformations done on the element or on its parent elements. There are a couple other functions available that … Read more

d3 update data and update graph

I am new to D3 but this is what I have found and I mainly figured this out from the sparklines example here. Instead of drawing the line with this code: vis.selectAll(‘path.line’) .data([data]) .enter() .append(“svg:path”) .attr(“d”, d3.svg.line().x(function(d, i) {return x(i); }).y(y)); generate the line separately: var line = d3.svg.line().x(function(d, i) { return x(i); }).y(y) Then … Read more

read width of d3 text element

In a selection method (such as attr) : this.getComputedTextLength(). In a selection of one element, you can say selection.node().getComputedTextLength(). You can also use getBBox for the width and height

Reading DOT files in javascript/d3

⚠ Solution proposed here depends on two libraries marked as unsupported by their authors. To get Graphviz DOT files rendered in Javascript, combine the graphlib-dot and dagre-d3 libraries. The graphlibDot.read() method takes a graph or digraph definition in DOT syntax and produces a graph object. The dagreD3.render() method can then output this graph object to … Read more

How to convert to D3’s JSON format?

There’s no prescribed format, as you can usually redefine your data through various accessor functions (such as hierarchy.children) and array.map. But the format you quoted is probably the most convenient representation for trees because it works with the default accessors. The first question is whether you intend to display a graph or a tree. For … Read more

How to customize color in pie chart of NVD3

If you want to use specific color for pie chart.color(function(d){ return d.data.color }); Then, organize your data as: [ { key: “Cumulative Return”, values: [ { “label”: “One”, “value” : 29.765957771107, “color” : “#8c564b” } , { “label”: “Three”, “value” : 32.807804682612, “color” : “#e377c2” } ] } ]

D3.js: Using images (with filenames specified in data) as tick values on axis

Dataset: var dataset = [ { “bank”: “Bank 1”, “img”: “Picture1.png” }, { “bank”: “Bank 2”, “img”: “Picture2.png” }, { “bank”: “Bank 3”, “img”: “Picture3.png” } ]; D3 JS code: var w = 1000; var h = 700; var padding = 30; var wpadding = 120; var svg = d3.select(“body”) .append(“svg”) .attr(“width”, w) .attr(“height”, h+padding); … Read more

Real time line graph with nvd3.js

You probably want to look at: D3 Real-Time streamgraph (Graph Data Visualization), especially the link of the answer: http://bost.ocks.org/mike/path/ In general, I see two ways to deal with the vertical transition problem: oversampling having some linear interpolation between the real point, and the smaller the interval between points, the more “horizontal” the vertical transition will … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)