title: Access x value on axis d3
body: <p>I think this is a simple question but I'm not getting it. I have the following code for the x-axis of my bar chart, and I'm trying to access the x-value when the corresponding bar is clicked. I've tried selecting xAxis, x, and .domain, but I'm getting null values. </p>
  
  <pre><code>var x = d3.scale.ordinal()
      .domain(['191','192','255','902'])
      .rangeRoundBands([margin,w-margin], .1)
  
  var xAxis = d3.svg.axis().scale(x).orient("bottom").tickSize(3, 0)
  
  
  svg.selectAll(".series")
     .data(ratiodata)
     .enter()
     .append("g")
     .classed("series",true)
     .style("fill","url(#gradient)")
     .selectAll("rect").data(Object)
     .enter()
     .append("rect")
     .attr("class", "bar")
     .attr("x",function(d,i) { return x(x.domain()[i])})
     .attr("y",function(d) { return y(d.y0)})
     .attr("height",function(d) { return y(0)-y(d.size)})
     .attr("width",x.rangeBand())
     .on("click", function(d,i) {
           //Clicking on the bar currently displays elements from another dataset.//
           //Ratiodata is only used for displaying the bars//
        });
  </code></pre>