d3 axis tick alignment

d3.js

Solution

here is an example of left aligning the ticks.

http://bl.ocks.org/mbostock/6186172

the idea is that after you create the ticks you collect them and aligne them:

svg.append("g")
    .attr("class", "x axis")
    .attr("transform", "translate(0," + height + ")")
    .call(xAxis)
  .selectAll("text")
    .attr("y", 6)
    .attr("x", 6)
    .style("text-anchor", "start");

Problem

I have a d3 bar chart with, and the axis tick marks are centered below the bars (as I would expect). In this case, I would actually like to left align the axis ticks and have the ticks under the left edge of the bar. Is that possible? EDIT: Javascript for constructing the axis ``` // note width is just the width of the chart var xScale = d3.scale.ordinal().rangeRoundBands([0,width], .1); var xAxis = d3.svg.axis().scale(xScale).orient("bottom"); ```

Original source