Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Added wrapping for axis tick labels #90

Merged
merged 4 commits into from
Nov 12, 2016
Merged

Conversation

SirKitboard
Copy link

Currently, long labels aren't wrapped on the axes. I updated the render code to support for newline characters. Ideally this should be automatic wrapping on long labels but this was good enough for my purposes and i'll try and add automatic wrapping later.

@SirKitboard
Copy link
Author

Just noticed my code offsets Y-axis text by a bit

@SirKitboard SirKitboard closed this Oct 4, 2016
@SirKitboard
Copy link
Author

Fixed Y-axis alignment

@SirKitboard SirKitboard reopened this Oct 4, 2016
@yang-wei
Copy link
Owner

yang-wei commented Oct 8, 2016

Can you give me a visual presentation of what does this code can solve =)

@yang-wei
Copy link
Owner

yang-wei commented Oct 8, 2016

So basically it solves this issue
#45

Copy link
Owner

@yang-wei yang-wei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a comment. Looks good to me

@@ -221,7 +221,11 @@ module.exports = React.createClass({
textAnchor={textAnchor}
{...optionalTextProps}
>
{tickFormat(tick)}
{`${tickFormat(tick)}`.split('\n').map((tickLabel) => (
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{tickFormat(tick)} should be enough instead wrapping it with template string ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thats what i did earlier but some tests failed with that so was forced into using template string

PhantomJS 2.1.1 (Mac OS X 0.0.0) BarChart renders barchart FAILED
    undefined is not a constructor (evaluating 'tickFormat(tick).split('\n')')

and 2 other failures

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see... tickFormat(tick) is not recognised as string

@SirKitboard
Copy link
Author

Here's a visual of what it fixes, Observe the X axis

Before Fix:
Old

After Fix
New

@yang-wei yang-wei merged commit 381b7e0 into yang-wei:master Nov 12, 2016
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.

2 participants