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

avoid illegible ticks when the size of the domain exceeds x times the number of ticks #301

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Fil
Copy link
Contributor

@Fil Fil commented Apr 5, 2021

TODO:

http://localhost:8008/?test=mobyDickFaceted has approximately 8 times the number of autoticks (26 letters vs 3.3 autoticks), and it's acceptable because it's single letters (there's even a bit of space left).

Capture d’écran 2021-04-05 à 18 47 50

With a threshold at 10, and setting the height at the ultimate point before this kicks in, it's really become illegible.
threshold10

With a threshold at 8, it's just barely begun to be illegible.
threshold8

With a threshold at 5, it's packed, but still legible.
threshold5

closes #74

@mbostock
Copy link
Member

mbostock commented Apr 8, 2021

My preference would be to do this at the tickFormat level so that the tick lines are still drawn but only some of them are labeled. For example like so:

gh_plot_mbostock2

tickFormat: ((f, i) => d => i(d) < d ? null : f(d))(d3.utcFormat("%-m/%-d"), d3.utcWeek.every(4))

@mbostock
Copy link
Member

mbostock commented Apr 8, 2021

Also related to #212, where I’d like to special-case the behavior for ordinal date domains if possible. Though maybe it’s not possible since the dates could be irregularly spaced, so I’m not sure how we’ll know which ticks to label.

@Fil Fil force-pushed the fil/hide-ticks-74 branch from c5a2ff6 to e13196d Compare March 23, 2022 15:55
@Fil
Copy link
Contributor Author

Fil commented Feb 6, 2023

needs an update with the new tickSpacing option

@Fil Fil marked this pull request as draft February 6, 2023 12:56
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.

Hide tick labels when an ordinal x or y has a high-cardinality domain.
2 participants