I think my question is very similar to a previous post. In JFreeChart I set the bounds of axis in a time series graph using the setRange method of DateAxis.
DateAxis dateAxis = (DateAxis)plot.getDomainAxis();
plot.setDomainAxis(dateAxis);
dateAxis.setRange(firstDate, lastDate);
However, when I use this and try to reduce the number of tick units displayed
DateFormat dateFormat = new SimpleDateFormat("MMM-yyyy");
TickUnits tickUnits = new TickUnits();
tickUnits.add(new DateTickUnit(DateTickUnitType.YEAR, 1, dateFormat));
dateAxis.setStandardTickUnits(tickUnits);
the first tick unit shown is the next Jan 1 from the firstDate. I have seen methods like dateAxis.setTickMarkPosition(DateTickMarkPosition.START); but they do not achieve what I wish. I would like the first tick unit to be the firstDate I specified.
For greater clarity my question is the same problem as this post on another site, to which there was no reply.
I did a little hack to get things working. Instead of using
firstDateandlastDateto set thedateAxisI usedfirstDateminus one day andlastDateplus one day.