This post describes how to build a very basic heatmap with d3.js. You can see many other examples in the heatmap section of the gallery. Learn more about the theory of heatmap in data-to-viz.com. This example works with d3.js v4
and v6
div
that will be modified by d3 later on.svg
area. It specify the chart size and its margin. Read more.scaleBand()
is used, which allows to control the size of each square using the padding property
. If padding is close from 1, square are very small. (0 for very big)rect
element.