posit-dev / posit-dev/ggsql

filter_breaks_to_range cannot filter temporal breaks, so out-of-domain ticks survive

Open Beginner friendly
#513 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug plot building
Dominant language
Rust
Stars
554
Forks
30
Avg merge
17h 27m
Merged PRs (30d)
8

Description

This issue was surfaced during the Hephaestus writer work

Summary

filter_breaks_to_range (src/plot/scale/breaks.rs:292) returns the break list unchanged unless both range endpoints are ArrayElement::Number, and inside the predicate it explicitly keeps any break that is not a Number. A Date / DateTime / Time scale therefore never gets filtered: a calendar-aligned major computed outside the resolved domain survives, and both writers place a tick off-panel.

Reproduction
VISUALISE Date AS x, Temp AS y FROM ggsql:airquality
DRAW line
SCALE x SETTING breaks => '2 months'
domain: ['1973-04-23', '1973-10-07']
values: ['1973-04-01', '1973-06-01', '1973-08-01', '1973-10-01', '1973-12-01']

1973-04-01 and 1973-12-01 are both outside the resolved domain.

Suggested fix

Filter on ArrayElement::to_f64() for the range endpoints and the breaks alike — which is exactly what the minor breaks path already does — falling back to the current pass-through only when a value has no numeric projection.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in src/plot/scale/breaks.rs at filter_breaks_to_range around line 292, then compare its numeric handling with the minor-breaks path's use of ArrayElement::to_f64(). Done means temporal breaks outside the resolved domain are removed while values without a numeric projection retain the current pass-through behavior; verify with the Date scale reproduction in the issue.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
data-visualization
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.