Creating a Bar Chart with d3.js

Set up D3

d3.select('#data').append('p').text('I\'ve been appended!');
D3 appending a paragraph

Binding Data

var dataset = [1, 2, 3];

d3.select('#data').selectAll('p')
    .data(dataset)
    .enter()
    .append('p')
    .text('I\'ve been appended!');
D3 appending multiple paragraphs

Creating a Bar Chart

d3.select("#data").selectAll("div")
  .data(complaintdata)
  .enter()
  .append("div")
  .attr("class", "bar")
  .style("height", function(d) {
      var barHeight = d * 5;
      return barHeight + "px";
  });