I'm trying to plot the candles without them overlapping eachother like in the added image.
I played around a bit with the domain range but i'm having trouble figuring out how to keep/set a minimum spacing between the candles.
If someone could point me in the right direction it would be greatly appreciated.
private DateAxis getTimeAxis() {
final DateAxis dateAxis = new DateAxis("TIME_AXIS");
dateAxis.setDateFormatOverride(DATE_TIME_FORMAT);
// this limits the visible candles but doesnt really solve the problem
// long start= ohlcs_series.getX(0,200).longValue(); // start from index 200
// long end = ohlcs_series.getX(0,607).longValue(); // last candle
//
// dateAxis.setRange(
// new Date(start),
// new Date(end + calculateEmptySpace())
// );
dateAxis.setLowerMargin(-0.025);
dateAxis.setUpperMargin(0.15);
Font bold = dateAxis.getLabelFont().deriveFont(Font.BOLD);
dateAxis.setLabelFont(bold);
return dateAxis;
}
/**
* Returns the width of 50 candles
* This is used to create some empty space after the last candle
* */
private long calculateEmptySpace(){
int indexOfLast = ohlcs_series.getSeries(0).getItemCount()-1;
long lastCandle = ohlcs_series.getX(0, indexOfLast).longValue();
long candle= ohlcs_series.getX(0,indexOfLast-50).longValue();
return lastCandle-candle;
}