Changing from processing.js to d3.js