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 scaleBand might collapse #242

Open
Fil opened this issue Mar 31, 2021 · 0 comments · May be fixed by #243
Open

round scaleBand might collapse #242

Fil opened this issue Mar 31, 2021 · 0 comments · May be fixed by #243

Comments

@Fil
Copy link
Member

Fil commented Mar 31, 2021

Description of the issue:

When the domain's length is too large for the range, the step of scaleBand is less than 1. The round option will then collapse it, and all the values end up assigned to the same value, with a bandwith = 0.

A solution would be to say that, rather than collapsing, we simply don't round. The bandwidth might become smaller than 1 but it'll still be (strictly) positive. We get maybe fuzzy shapes, but that's better than zero-width.

Another approach would be to say that, in that case, we don't round the step but still round the resulting values. The shapes are never fuzzy, but two consecutive values might overlap, creating maybe a kind of Moiré pattern (that depends on what we do with the results, of course).

A related issue is that if rounding is here because we want the bars of a bar chart to fall precisely on a pixel, the concept is a bit more fuzzy now. On retina screens, this should become a 0.5px rounding of some sort. This might warrant an added option .roundingPrecision(0.5) [with 0.5 = 1/device pixel ratio]?

Fil added a commit that referenced this issue Mar 31, 2021
@Fil Fil linked a pull request Mar 31, 2021 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

1 participant