Skip to content

Keep History's time axis readable past a year and on a phone - #105

Merged
1 commit merged into
mainfrom
history-axis-labels
Nov 9, 2026
Merged

1 commit merged into
mainfrom
history-axis-labels

Conversation

@blike

@blike blike commented Nov 9, 2026

Copy link
Copy Markdown
Owner

Summary

Two axis problems from #101:

  • Repeated labels past a year. Spans over a couple of months now tick on the first of a month,
    and over several years by year. Once the ticks cover a year, labels carry it (Jul ’24, with
    January shown as 2025), so no label repeats.
  • Overlapping labels on a phone. The axis measures its label strip and the labels in the
    page's font, and drops ticks until neighbours clear each other by 8px. This also fixes the
    7-day default, which overlapped at 390px.
6 months  Jun | Jul | Aug | Sep | Oct | Nov
1.1 yrs   Nov ’25 | 2026 | Mar ’26 | May ’26 | Jul ’26 | Sep ’26 | Nov ’26
3 yrs     2024 | Jul ’24 | 2025 | Jul ’25 | 2026 | Jul ’26
10 yrs    2018 | 2020 | 2022 | 2024 | 2026

Fixes #101.

Testing

  • Unit tests added/updated: three years and the 366–427-day band with no repeated label,
    year ticks, and tick dropping at 268px.
  • Existing tests passed.
  • Manually tested: not yet looked at in a browser at phone width.

Deployment

  • No special deployment requirements

Past a couple of months the axis stepped by 61 days at most, so a span
of more than a year drew about 18 ticks of month and day, and the same
dates came round again with no year to tell them apart. It now ticks on
the first of a month and, over several years, by year. A January, or a
tick a year or more from the last, reads as its year, and once the ticks
cover a year, other months carry theirs ("Jul ’24").

Labels were also placed without checking they fit, and overlapped at
phone width even on the 7-day default. The axis now measures its label
strip and the labels in the page's own font, and keeps only as many
ticks as clear each other by 8px.

Fixes #101
@blike blike mentioned this pull request Nov 9, 2026
3 of 4 tasks
blike added a commit that referenced this pull request Nov 9, 2026
Merges the all-time period (#99) and the time axis fix (#105) into the
map routes branch, so History's changes ship in one merge to main.
@blike blike closed this pull request by merging all changes into main in e097f29 Nov 9, 2026
@blike
blike deleted the history-axis-labels branch November 10, 2026 14:04
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.

History's time axis repeats labels past a year, and crowds on a phone

1 participant