Turning the Graph Function Into an Object in JavaScript, Part 7

Today I implemented the ability to rotate the tick labels on the graph axes. There are a few little tweaks left to implement and describe, but the figures below show how the various offsets work to position each label relative to the end of its associated tick mark. I added a small square to each label, the upper left pixel of which indicates the base location given to the textFill command to place the right-justified text. Finally, I added some text labels to show the relevant parameters as they are calculated and used. I’ll describe some of the more subtle details next time.

Notice how in the bottom example, with -45 degrees of rotation, the top of the y-axis label text reaches higher than the graph label text. When the code is written to locate the axes automatically, the calculation will take things like that into account.

This entry was posted in Software and tagged , , . Bookmark the permalink.

Leave a Reply