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

New labels should start 1/2 a bar-width to right #27

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Selbosh
Copy link

@Selbosh Selbosh commented Jan 24, 2018

Line 192 should add half a bar width to the horizontal starting position of labels in the enter() selection, otherwise they are incorrectly aligned with the bar during the transition.

Line 192 should add half a bar width to the horizontal starting position of labels in the `enter()` selection, otherwise they are incorrectly aligned with the bar during the transition.
@@ -189,7 +189,7 @@
return d.value;
})
.attr("text-anchor", "middle")
.attr("x", w)
Copy link
Author

Choose a reason for hiding this comment

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

Places label between two bars

@@ -189,7 +189,7 @@
return d.value;
})
.attr("text-anchor", "middle")
.attr("x", w)
.attr("x", w + xScale.bandwidth() / 2)
Copy link
Author

Choose a reason for hiding this comment

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

Places label in centre of new (invisible) bar

@scotthmurray
Copy link
Owner

Ah, thank you! Very good catch, and I expect you're the first person to notice this very small and fast-moving discrepancy. :-)

I'm going to leave this PR open for now; I'd like to apply this, but not until the code excerpts and explanations in the book can be updated at the same time.

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

Successfully merging this pull request may close these issues.

2 participants