Skip to content
This repository has been archived by the owner on Nov 7, 2019. It is now read-only.

Added axis label multiline support in canvas #18

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

echalone
Copy link

All \n line breaks in an axis label will now be displayed as such in a canvas axis label. Also, the axis label text can be automatically broken into multiple lines (if wished) if the length of the axis isn't enough. The alignment of and padding between this lines can be choosen.
Added axis options are...
axisLabelAdjustment (true/false): If the axis label should be broken into multiple lines at spaces in case the length of the axis isn't enough for the width of the label. Default is false.
axisLabelLinePadding (number): Padding between multiple axis label lines. Default is 5.
axisLabelAlignment ('left', 'center'/'middle', 'right): Alignment of multiple axis label lines (aligned according to widest line and reading direction). Default is 'center'.

Also: Fix in calculating canvas label size, the 0.72 multiplier was missing (but used when calculating position of line).

All \n line breaks in an axis label will now be displayed as such in a canvas axis label. Also, the axis label text can be automatically broken into multiple lines (if wished) if the length of the axis isn't enough. The alignment of and padding between this lines can be choosen.
Added axis options are...
axisLabelAdjustment (true/false): If the axis label should be broken into multiple lines at spaces in case the length of the axis isn't enough for the width of the label. Default is false.
axisLabelLinePadding (number): Padding between multiple axis label lines. Default is 5.
axisLabelAlignment ('left', 'center'/'middle', 'right): Alignment of multiple axis label lines (aligned according to widest line and reading direction). Default is 'center'.

Also: Fix in calculating canvas label size, the 0.72 multiplier was missing (but used when calculating position of line).
@markrcote
Copy link
Owner

This is pretty interesting. Unfortunately I neglected it for a few months, and it's now bitrotted. If you felt like cleaning it up, I'll merge it in (also, please keep the "function()" style, without the space after "function").

Removed spaces between keyword "function" and opening bracket and so on...
Added spaces in "degrees / 90"
@echalone
Copy link
Author

I've cleaned it up and removed the space after function etc... hope it's good enough to merge it now ;)

@markrcote
Copy link
Owner

Really sorry for neglecting this again. I'm testing it, and it does some weird things. I tried a very long x-axis label composed of just "foo" and "bar" repeated over and over, with spaces between. It wrapped the line, but every word after the first line was on its own line. It feels like a variable is not being reset somewhere.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants