plot icon indicating copy to clipboard operation
plot copied to clipboard

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

Open Fil opened this issue 4 years ago • 2 comments

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

Fil avatar Apr 05 '21 17:04 Fil

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 avatar Apr 08 '21 15:04 mbostock

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.

mbostock avatar Apr 08 '21 15:04 mbostock

needs an update with the new tickSpacing option

Fil avatar Feb 06 '23 12:02 Fil