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

Round non zero #243

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open

Round non zero #243

wants to merge 3 commits into from

Conversation

Fil
Copy link
Member

@Fil Fil commented Mar 31, 2021

fixes #242

@@ -11,6 +11,7 @@ export default function band() {
step,
bandwidth,
round = false,
roundingPrecision = 1,
Copy link
Member

Choose a reason for hiding this comment

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

Should we employ the same test as d3-axis so that roundingPrecision can default to 0.5 if devicePixelRatio > 1?

https://github.com/d3/d3-axis/blob/4fc4f2bd287de20c4fc5f1da447ae1194d3acca6/src/axis.js#L39

Also, I think internally perhaps we should store the inverse rounding precision as an integer (e.g., precision = 2 if we want to round to the nearest half-pixel), so as to reduce the likelihood of floating point error.

Also, how about the shorter name scale.precision. Is that too ambiguous?

Copy link
Member Author

Choose a reason for hiding this comment

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

Agree with using devicePixelRatio and integer representation. For the name, I think precision presents the risk of being ambiguous (though we have no use for a scale's precision yet).

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

Successfully merging this pull request may close these issues.

round scaleBand might collapse
2 participants