In coffeescript:
y = d3.scale.linear().range([0, h])
yAxis = d3.svg.axis().scale(y).ticks(4).orient("left")
y.domain([0, 300])
svg = d3.select("#chart").append("svg:svg")
.attr("width", w + m[1] + m[3])
.attr("height", h + m[0] + m[2])
.append("svg:g")
.attr("transform", "translate( #{m[3]}, #{m[0]}) translate(0,
#{h}) scale(1,-1)") # shift inward, offset, and flip
svg.append("svg:g")
.attr("class", "y axis")
.call(yAxis);
This works well except the text labels come out flipped over. I might
be able to re-orient them by putting them in a different layer but I
worry about what would happen if I switched to a log scale. Does
anyone have a good way of dealing with this or am I going about this
all wrong?
Mike