So I working on the iteration of inserting information into a circle object to display.
<script type="text/javascript">
var data = d3.json("example.json", function(error, data){
console.log("I'm working");
console.log(data);
var svg = d3.select("svg");
console.log(data.length);
for (i = 0; i < data.length; i ++) {
svg.append("circle")
.attr("cx", Math.random()*500)
.attr("cy", Math.random()*500)
.attr("r", 25)
.attr("fill", "red")
.append("text")
.text(function(d) { return data[i].name } )
.attr('dx', function(d) {return '1em';})
.attr('dy', function(d) {return (0.08*this.parentNode.getBBox().height/2 + 0.5)+'em';})
}
svg.selectAll("circle").attr("fill", "red");
svg.selectAll("text").attr("fill", "black")
})
so far I have attached the information to each circles. However I still cannot display the name of the objects I have no idea how to about showing connections through the data.