###Using d3.js Histogram Layout
D3.js Layouts perform all the calculations for rendering a specific visualization type and returns all the values needed to draw them.
Below example shows how easy it is to just pass data to d3.js histogram layout and get back all the x-y and width/height values to draw histogram chart like a regular bar chart.
Original d3 code: http://bl.ocks.org/mbostock/3048450
<iframe height='550' scrolling='no' src='//codepen.io/sepans/embed/LVLyNY/?height=550&theme-id=17280&default-tab=result' frameborder='no' allowtransparency='true' allowfullscreen='true' style='width: 100%;'>See the Pen d3.js and p5.js - histogram by Sepand Ansari (@sepans) on CodePen. </iframe>