This is smart techniques of D3.js which is taken from JQuery. By this methods you can apply multiple methods in single line of code. If is very fast and easy but first we need to know how it work.
First go with this D3.js code:
d3.select("body").append("p").text("New paragraph!");
We can write it as :
d3.select("body")
.append("p")
.text("New paragraph!");
d3 — References the D3 object
Without chain method we can write it as:
var body = d3.select("body");
var p = body.append("p");
p.text("New paragraph!");
Above method is complicated compare to chain method.