Wednesday, 2 April 2014

Draw a line in Console...

I am understanding the constructions in d3 but I am missing something in my pages.

I can draw a nice big vertical line in the Console assuming the webpage loads d3.

This is the code:

>d3.select("body").append("svg").attr("width", 50).attr("height", 500).append("line").attr("x1", 10).attr("y1", 10).attr("x2", 10).attr("y2", 400) .attr("stroke-width", 10) .attr("stroke", "black");

Better to show it like this:

d3.select("body")
.append("svg")
.attr("width", 50)
.attr("height", 500)

.append("line")
.attr("x1", 10)
.attr("y1", 10)
.attr("x2", 10)
.attr("y2", 400)
.attr("stroke-width", 10) 
.attr("stroke", "black");

No comments:

Post a Comment