Skip to content

Add axis.offset#76

Merged
mbostock merged 3 commits into
masterfrom
configurable-offset
Mar 10, 2021
Merged

Add axis.offset#76
mbostock merged 3 commits into
masterfrom
configurable-offset

Conversation

@mbostock

Copy link
Copy Markdown
Member

What do you think about making the current 0.5px offset configurable, and defaulting it to zero on devices with a devicePixelRatio ≥ 2? The purpose of this offset is to provide pixel-snapping, but that’s only necessary when the devicePixelRatio = 1, and these days, that’s uncommon.

@mbostock mbostock requested a review from Fil February 21, 2021 18:55

@curran curran left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM. Solid move.

@curran

curran commented Feb 22, 2021

Copy link
Copy Markdown
Contributor

Related to #75

@Fil

Fil commented Feb 23, 2021

Copy link
Copy Markdown
Member

I work daily on a density=1 desktop monitor :)

A density of 1.5 is quite common on Android phones, and it seems that it too would be better with offset = 0.

Here's the result of various settings:
https://observablehq.com/@d3/axis-offset-76

summary:

dpi offset result
1 0 bad
1 0.5 good
1.5 0 good
1.5 0.5 not so good
2 0 good
2 0.5 bad

1 / 0 😡
dpi1-offset0

1 / .5 😎
dpi1-offset0 5

1.5 / 0 😎
dpi1 5-offset0

1.5 / 1.5 😡
dpi1 5-offset0

2 / 0 😎
dpi2-offset0

2 / .5 😡
dpi2-offset0 5

(note that I used "download png", not screen grab :))

all.zip

@Fil Fil left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

just this change for 1.5

Comment thread src/axis.js Outdated
Co-authored-by: Philippe Rivière <[email protected]>
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.

3 participants