Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Display multi-word tick labels as multi-line #139

Closed
webmaven opened this issue Apr 8, 2014 · 7 comments
Closed

Display multi-word tick labels as multi-line #139

webmaven opened this issue Apr 8, 2014 · 7 comments
Labels
C-feature-request Category: A feature request or an enhancement resolved maybe

Comments

@webmaven
Copy link

webmaven commented Apr 8, 2014

When a tick or category label on the x-axis consists of several words, it enforces a fairly large minimum width on the chart in order to keep the labels from overlapping.

Possible solutions:

  1. Add an option to add newlines between words in a label, or
  2. Automatically insert newlines when the width of the label exceeds the width of the rect.
@masayuki0812
Copy link
Member

Thank you for suggestion. I'll try 2 and please give some time.

@lemonzi
Copy link
Contributor

lemonzi commented Apr 14, 2014

👍
Another option is to rotate the label, even completely (vertical).

@sbrunot
Copy link

sbrunot commented Oct 14, 2014

An interesting option would be, for any tick label, to allows the format function to return an array of strings instead of a single string. If an array of string is returned, a multi line label would be created for the tick (one line per entry in the array).

@lemonzi
Copy link
Contributor

lemonzi commented Oct 14, 2014

Well, in my case it was good to have automatic line wrapping depending on
the total plot size. But it would be a great addition, indeed!

Quim Llimona
http://lemonzi.me

2014-10-14 14:27 GMT+02:00 Sebastien Brunot [email protected]:

An interesting option would be, for any tick label, to allows the format
function to return an array of strings instead of a single string. If an
array of string is returned, a multi line label would be created for the
tick (one line per entry in the array).


Reply to this email directly or view it on GitHub
#139 (comment).

@masayuki0812
Copy link
Member

Thank you for your feedbacks. I implemented this and now it works only on category axis. And you can change the width of tick text by axis.x.tick.width, so if you want to change the width for word break, please use this option.

Btw, I introduced tspan within text for tick text, so please remember this if you're processing text element on your code.

@lemonzi
Copy link
Contributor

lemonzi commented Oct 27, 2014

Great, thanks a lot! 👍

dungsaga added a commit to dungsaga/c3 that referenced this issue Nov 3, 2014
formatted tick label can be an array of strings, each will be displayed
in a line
@masayuki0812
Copy link
Member

Please let me close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-feature-request Category: A feature request or an enhancement resolved maybe
Projects
None yet
Development

No branches or pull requests

4 participants