Most of d3 graph code in place