Cleanup: generate axis ticks in-range instead of pruning after the fact (follow-up to #634)
Nessuno ha ancora preso questa issue.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 48/100
- Tipo di issue
- Refactoring
- Chiarezza
- Abbastanza chiara
- Stato di attività
- Tranquilla
- Stack tecnologico
- java
- Ambito
- data-visualization
Direzione di ricerca
Inizia con AxisTickCalculator_.calculate(), AxisTickLabels e PlotSurface_AxesChart, quindi esamina PR #996 e RegressionIssue634Test. Confronta gli approcci al clipping e alla generazione dei valori nell’intervallo, preservando ove possibile la densità di tick esistente. Il lavoro è completato quando il test di regressione ha esito positivo, la spaziatura della galleria rimane invariata e i formatter non vengono chiamati per valori fuori intervallo.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
Follow-up / tech-debt cleanup from the fix for #634 (PR #996).
Context
#634 was a negative Y-axis label appearing with all-positive data. Root cause: AxisTickCalculator_.calculate() deliberately overshoots the tick range — getFirstPosition() starts one grid step below minValue and the loop runs to maxValue + 2*gridStep — and the tick-label renderer (AxisTickLabels) clips only to the taller axis-column bounds, so overshoot labels leak into the plot margin. (Gridlines and tick marks already clip correctly to the plot bounds in PlotSurface_AxesChart.)
PR #996 fixed the visible bug by pruning ticks outside the data band [margin, margin+tickSpace] after the generation do-while settles. That was chosen deliberately to be behavior-preserving: pruning post-loop leaves the grid-step selection heuristics (areAllTickLabelsUnique / willLabelsFitInTickSpaceHint) seeing the exact same full set as before, so tick density on existing charts is unchanged.
What this issue tracks
Do the structurally cleaner version when there's time to validate it more broadly:
-
Preferred: make
AxisTickLabelsclip tick labels to the plot-content band, the same wayPlotSurface_AxesChartalready clips gridlines and tick marks — so all three consumers of the tick list clip consistently, instead of the calculator emitting values one consumer must drop.or
-
Generate ticks in-range from the start (fix
getFirstPosition+ the loop upper bound to emit exactly the nice multiples within[minValue, maxValue]), removing the overshoot entirely.
Why it wasn't done in #996
- Changing generation inputs (option 2) alters what the termination heuristics see, which can change the selected grid step / tick density on charts that never had the bug — a wide regression surface with no pixel-baseline tests to catch it.
- Option 1 needs the plot-content band (
margin/tickSpace) plumbed intoAxisTickLabels, which doesn't currently have it.
Bonus wart to fix along the way
With the current pruning approach, the user's tick-label formatting function is still called on the out-of-range values during generation (label computed, then discarded). A generate-in-range approach would avoid invoking the formatter on values outside the data band — relevant if a formatter has side effects or throws on unexpected inputs.
Acceptance
- No regression to #634 (add-only;
RegressionIssue634Teststill passes). - Tick density/spacing unchanged across the demo gallery (needs a render pass to confirm).
- Formatting function is not invoked for values outside
[minValue, maxValue].
- Lingua principale
- Java
- Stelle
- 1.6k
- Fork
- 399
- Merge medio
- 6g 15h
- PR unite (30g)
- 4
Preparare l'ambiente
Questo progetto non fornisce container di sviluppo, Dockerfile né guida per i contributori, quindi l'ambiente è a tuo carico: parti dal suo README e consulta la nostra guida al primo contributo per i passaggi generali.
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di knowm/XChart
-
OHLC: first and last candles are clipped at the plot edgesForse già presa @timmolter l’ha presa 61 giorni fa. ApertaAesthetics
Difficoltà 3/5 1-2 giorni Idoneità per principianti 68/100
-
`CategoryChart.addSeries` could support additional call signature for interoperability with ScalaAperta
Difficoltà 3/5 1-2 giorni Idoneità per principianti 45/100
-
AnnotationsAperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 35/100
-
Aesthetics Feature Request
Difficoltà 4/5 3-5 giorni Idoneità per principianti 35/100
-
Feature Request
Difficoltà 4/5 3-5 giorni Idoneità per principianti 45/100
Tutte le issue di knowm/XChart
Issue simili
-
human-required sync-failed
Difficoltà 2/5 1-3 ore Idoneità per principianti 68/100
Azure/osdu-spi-file#63 ·
I maintainer di solito rispondono entro 1 giorno
-
frontend quick win
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
CodeForPhilly/benefit-decision-toolkit#571 ·
I maintainer di solito rispondono entro 1 giorno
-
approved
Difficoltà 2/5 1-3 ore Idoneità per principianti 67/100
checkstyle/checkstyle#22129 ·
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno
-
Add Hardcharger JDBC driverForse già presa @prmoore77 l’ha presa oggi. Aperta
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
I maintainer di solito rispondono entro 1 giorno