Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

OHLC: first and last candles are clipped at the plot edges

Aperta
#992 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

@timmolter ci sta già lavorando.

Dal 21/8/2026.

  • #1027 di @timmolter — aperta

Valutazione

Difficoltà
3/5
Tempo stimato
1-2 giorni
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Tranquilla
Stack tecnologico
java

Direzione di ricerca

Inizia da PlotContent_OHLC.doPaint, in particolare dal calcolo di xTransform e dalla gestione della larghezza delle candele. Riproduci il problema con un grafico contenente quattro candele larghe ed esamina la copertura dei test correlata di PR #991. Il lavoro è completato quando la prima e l’ultima candela vengono renderizzate completamente all’interno dell’area del grafico senza introdurre regressioni nel comportamento OHLC esistente.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Aesthetics

Description

In an OHLC candlestick chart, the x-axis range is set to exactly [dataMin, dataMax]. As a result, the first and last candles are centered on the plot's left/right boundaries, so roughly half of each edge candle body extends past the plot content area and is clipped.

Reproduction

A chart with few, wide candles makes this obvious (e.g. 4 candles) — the leftmost and rightmost candle bodies are visibly cut in half by the plot border. See screenshot discussion in #734 / PR #991.

Root cause

  • The first data point (x = xMin) maps to the left edge of the tick space and the last (x = xMax) to the right edge — PlotContent_OHLC.doPaint (xTransform = xLeftMargin + ((x - xMin) / (xMax - xMin) * xTickSpace)).
  • Each candle is drawn centered on that point, extending ±candleHalfWidth.
  • The only slack is the plot-content margin (getPlotContentSize() default 0.92 → ~4% of width per side). The candle half-width is xTickSpace / xData.length / 2, which for a small number of candles greatly exceeds that margin, so the edge candles overrun the boundary.

With realistic OHLC data (many narrow candles) the overrun is a thin sliver and largely unnoticeable, which is likely why it hasn't been reported before.

Suggested fix

Pad the x-axis range (or the mapped plot area) by ~half a candle width on each side, as most candlestick charting libraries do, so the first and last candles render fully inside the plot. This should be independent of the candle count.

Notes

Discovered while adding test coverage in PR #991 (issue #734, doji candles). This clipping is a pre-existing, general OHLC rendering behavior, unrelated to the doji fix.

Lingua principale
Java
Stelle
1.6k
Fork
398
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

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

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di knowm/XChart

Tutte le issue di knowm/XChart

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.