Skip to content

Commit

Permalink
Assume fixed orientation.
Browse files Browse the repository at this point in the history
  • Loading branch information
mbostock committed May 31, 2016
1 parent dfa2dc0 commit e1d90ce
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/axis.js
Expand Up @@ -59,11 +59,15 @@ function axis(orient, scale) {

line = line.merge(tickEnter.append("line")
.attr("stroke", "#000")
.attr(x + "2", k * tickSizeInner));
.attr(x + "2", k * tickSizeInner)
.attr(y + "1", 0.5)
.attr(y + "2", 0.5));

text = text.merge(tickEnter.append("text")
.attr("fill", "#000")
.attr(x, k * spacing));
.attr(x, k * spacing)
.attr(y, 0.5)
.attr("dy", orient === top ? "0em" : orient === bottom ? ".71em" : ".32em"));

if (context !== selection) {
path = path.transition(context);
Expand Down Expand Up @@ -92,21 +96,20 @@ function axis(orient, scale) {
.attr("transform", function(d) { return transform(position, position, d); });

line
.attr(x + "2", k * tickSizeInner)
.attr(y + "1", 0.5)
.attr(y + "2", 0.5);
.attr(x + "2", k * tickSizeInner);

text
.attr(x, k * spacing)
.attr(y, 0.5)
.attr("dy", orient === top ? "0em" : orient === bottom ? ".71em" : ".32em")
.text(format);

selection
.filter(function() { return !this.__axis; })
.attr("fill", "none")
.attr("font-size", 10)
.attr("font-family", "sans-serif")
.attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle")
.attr("text-anchor", orient === right ? "start" : orient === left ? "end" : "middle");

selection
.each(function() { this.__axis = position; });
}

Expand Down

0 comments on commit e1d90ce

Please sign in to comment.