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

Ticks misalignment #75

Closed
bedwardvedicci opened this issue Feb 20, 2021 · 2 comments
Closed

Ticks misalignment #75

bedwardvedicci opened this issue Feb 20, 2021 · 2 comments

Comments

@bedwardvedicci
Copy link

bedwardvedicci commented Feb 20, 2021

I have noticed that the ticks do not seem to be well aligned in the axis, and i think it is a bug in the newer version of d3, because the ticks seem to be well aligned in d3 version 3.5.17.

To illustrate the issue, i tried to show the difference in those two "pens" :
d3 version 3.5.17: https://codepen.io/BedwardVedicci/pen/LYbjmwR // comments are in the "JS Window" of the pen
d3 version 6.5.0: https://codepen.io/BedwardVedicci/pen/poNrVBG // comments are in the "JS Window" of the pen

Changes made from "3.5.17" to "6.5.0" are as follows :

  • Changed "scale.linear()" To "scaleLinear()"
  • Changed "scale.threshold()" To "scaleThreshold()"
  • Changed ".svg.axis().scale(legendX).orient('bottom')" To ".axisBottom(legendX)"

Note: The misalignment may not seem obvious from first glance, but there is, you can be sure of that if you check the "x" attribute.

@mbostock
Copy link
Member

This is described in the 1.0 release notes:

https://github.com/d3/d3-axis/releases/tag/v1.0.0

The default appearance has been changed slightly to offset the axis by a half-pixel; this fixes a crisp-edges rendering issue on Safari where the axis would be drawn two-pixels thick.

@bedwardvedicci
Copy link
Author

But isn't this implementation affecting the accuracy of the axis? for example in the Map's legend, the offset applied on the ticks make the legend look inaccurate and makes the layout look a little bit "ugly".

So is there a way to remove the offset from the ticks?

@curran curran mentioned this issue Feb 22, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants