Learning to implement charts in d3.js