This post describes how to build a very basic density chart with d3.js. Only one category is represented, to simplify the code as much as possible. You can see many other examples in the density plot section of the gallery. If you're not sure what a density chart exactly is, please visit 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.x.ticks(40)
argument to control the bandwidth used for computation.density
gives a Y coordinate for each of the X axis ticks. It is possible to use this information to draw a curve with d3.line()
.