Я пытаюсь добавить текст в круг. Я привел пример из http://mbostock.github.com/d3/tutorial/circle.html, но не смог получить правильный результат.
Фрагмент кода:
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]);
}) ;
Любые предложения о том, как получить эту работу? Большое спасибо!