I want to rotate the text for x-axis of graph. Below is the code I am using
context.rotate(20*Math.PI/2);
context.fillText(name, startX + (i * barWidth) + i, chartHeight + 10, 200);
context.rotate(-20*Math.PI/2);
I am rotating it back to original position after writing the text. But somehow it is not working. Working code can be found at http://intercepter.comli.com/example3.html
I have gone through this article and have tried it but it is just not working. Please help me out
Rotating by
20*Math.PI/2is similar to not rotating anything, ’cause :Not sure how do you want to rotate your text, but instead of
you may try to use transformations like this:
See the working DEMO: