Skip to content

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.
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

})
.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