Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

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

オープン
#992 コメント 1 件 リアクション 0 件 担当者 0 名 GitHub で見る

@timmolter がすでに取り組んでいます。

2026年8月21日 から。

  • #1027 @timmolter による — オープン

評価

難易度
3/5
見積もり時間
1〜2日
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
おおむね明確
活発さ
静か
技術スタック
java

調査の方向性

PlotContent_OHLC.doPaint から始め、特に xTransform の計算とローソク足の幅の扱いを確認してください。幅の広いローソク足が4本あるチャートで問題を再現し、PR #991 に関連するテストカバレッジを調べてください。完了条件は、既存の OHLC の動作を後退させることなく、最初と最後のローソク足がプロット領域内に完全に描画されることです。

索引モデルが issue の本文から書いたものです。

説明

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.

主要言語
Java
スター
1.6k
フォーク
399
平均マージ
1日 12時間
マージ済み PR(30日)
3

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

knowm/XChart のほかの issue

knowm/XChart の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。