Candlesticks and XY lines have pixel offset from one another
Closed this issue · 1 comments
From FIXME
in OhlcPlotBuilder.java
:
FIXME: Candlestick renderer offsets center of candle from x-axis start pixel. When rendering general xy lines, those line points are drawn at the x-axis start pixel. This causes indicator lines to be misaligned by a few pixels from the OHLC bars and may provide false signals to those looking at charts.
Found in v1.5.6
https://github.com/matoos32/jfreechart-builder/blob/v1.5.6/src/main/java/com/jfcbuilder/builders/OhlcPlotBuilder.java#L279
Since initial implementation:
56640dc#diff-5f7449896404872cdff11efafb7c20a7d63447f210b85aa749e71a76afb70631R238
Needs confirmation if still is or really is an issue.
I wasn't able to reproduce this either in time-gapped or gapless charts.
Using the latest develop
a bit past v1.5.7
, I simply replaced the hard-coded use of StandardXYItemRenderer
with XYLineAndShapeRenderer
in the OhlcPlotBuilder
build() method. In the demo app this rendered a default black square on XY line data-points. The black squares appeared aligned with the horizontal center of the OHLC candles (bars), for both time-gapped and gapless charts.