jiahuang / d3-timeline

Simple JS timeline plugin for d3
1.04k stars 280 forks source link

rotateTicks rotates ticks and labels #22

Closed dpedowitz closed 9 years ago

dpedowitz commented 10 years ago

adding rotateTicks when you have times with labels rotates the ticks and the labels.

here's a patch to just rotate ticks:

  if (rotateTicks) {
    g.selectAll(".tick text")
      .attr("transform", function(d) {
        return "rotate(" + rotateTicks + ")translate("
          + (this.getBBox().width / 2 + 10) + "," // TODO: change this 10
          + this.getBBox().height / 2 + ")";
      });
  }
styrmis commented 10 years ago

I can confirm that this patch fixes the problem.

Thanks @dpedowitz for posting the fix.

TJMcDonald commented 9 years ago

I had to change g.selectAll(".tick text") to g.selectAll(".tick + text") to get it to work. I noticed that the text element follows the line element for the tick mark.

jiahuang commented 9 years ago

Thanks @dpedowitz. I've merged the fix.