D3 bar by date

HTML

<script src="http://d3js.org/d3.v3.min.js"></script>
<div id="graph"></div>

CSS

svg {
  font: 10px sans-serif;
}

.area {
  fill: steelblue;
  clip-path: url(#clip);
}

.axis path,
.axis line {
  fill: none;
  stroke: #000;
  shape-rendering: crispEdges;
}

.brush .extent {
  stroke: #fff;
  fill-opacity: .125;
  shape-rendering: crispEdges;
}

JavaScript

var margin = { top: 10, right: 10, bottom: 100, left: 40 },
      margin2 = { top: 430, right: 10, bottom: 20, left: 40 },
      width = 960 - margin.left - margin.right,
      height = 500 - margin.top - margin.bottom,
      height2 = 500 - margin2.top - margin2.bottom;

  var parseDate = d3.time.format("%b %Y").parse;

  var x = d3.time.scale().range([0, width]),
      x2 = d3.time.scale().range([0, width]),
      y = d3.scale.linear().range([height, 0]),
      y2 = d3.scale.linear().range([height2, 0]);

  var xAxis = d3.svg.axis().scale(x).orient("bottom"),
      xAxis2 = d3.svg.axis().scale(x2).orient("bottom"),
      yAxis = d3.svg.axis().scale(y).orient("left");

  var brush = d3.svg.brush()
      .x(x2)
      .on("brush", brushed);

  var area = d3.svg.area()
      .interpolate("monotone")
      .x(function (d) { return x(d.date); })
      .y0(height)
      .y1(function (d) { return y(d.price); });

  var area2 = d3.svg.area()
      .interpolate("monotone")
      .x(function (d) { return x2(d.date); })
      .y0(height2)
      .y1(function (d) { return y2(d.price); });



  // make some buttons to drive our zoom
  d3.select("body").append("div")
    .attr("id","btnDiv")
    .style('font-size','75%')
    .style("width","250px")
    .style("position","absolute")
    .style("left","5%")
    .style("top","200px")

  d3.select("#btnDiv")[0][0].innerHTML = [
    '<h3>Buttons To Drive Our Zoom</h3>',
    '<p>push a button and watch the brush react</p>',
    '<ul>',
    '<li>note: deliberately slowed down so each step can be seen and demonstrate how to inject transition</li>',
    '<li>also, play with the brush after drawn to see how it acts as if we drew with our mouse</li>',
    '</ul>'
  ].join('\n')
  

  var btns = d3.select("#btnDiv").selectAll("button").data([2001, 2002, 2003, 2004])

  btns = btns.enter().append("button").style("display","inline-block")

  // fill the buttons with the year from the data assigned to them
  btns.each(function (d) {
   ...