Skip to content

Commit

Permalink
use translate before rotate
Browse files Browse the repository at this point in the history
  • Loading branch information
xuanluo committed Sep 15, 2010
1 parent ac73833 commit 7a5c110
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions jquery.flot.axislabels.js
Original file line number Diff line number Diff line change
Expand Up @@ -96,11 +96,12 @@ Released under the GPLv3 license by Xuan Luo, September 2010.
x = plot.getPlotOffset().left + plot.width()/2 - width/2;
y = plot.getCanvas().height;
} else {
x = -(plot.getPlotOffset().top + plot.height()/2 - width/2);
y = height * 0.72;
x = height * 0.72;
y = plot.getPlotOffset().top + plot.height()/2 - width/2;
}
ctx.translate(x, y);
ctx.rotate((axisName.charAt(0) == 'x') ? 0 : -Math.PI/2);
ctx.fillText(opts.axisLabel, x, y);
ctx.fillText(opts.axisLabel, 0, 0);
ctx.restore();

} else {
Expand Down

0 comments on commit 7a5c110

Please sign in to comment.