This post describes how to build a very basic histogram with d3.js. Only one category is represented, to simplify the code as much as possible. You can see many other examples in the histogram section of the gallery. Learn more about the theory of histogram in data-to-viz.com.
div
that will be modified by d3 later on.svg
area. It specify the chart size and its margin. Read more.d3.histogram()
function that will compute the binning and returns the coordinates of each bar..append("rect")
approach.