57
rated 0 times
[
62]
[
5]
/ answers: 1 / hits: 117212
/ 12 Years ago, wed, november 28, 2012, 12:00:00
I am trying to add some text into circle. I have been following example from a mbostock tutorial, but wasn't able to get the right output.
The code snippet is:
var data;
var code;
d3.json(/json/trace.json, function(json) {
data = json;
console.log(data);
// get code for visualization
code = data[code];
alert(code);
var mainSVG = d3
.select(#viz)
.append(svg)
.attr(width, 900)
.attr(height, 900);
mainSVG
.append(circle)
.style(stroke, gray)
.style(fill, white)
.attr(r, 100)
.attr(cx, 300)
.attr(cy, 300);
circle = mainSVG.selectAll(circle).data([code]);
});
Any suggestions how to get this work?
More From » svg