How can i put axis units in the middle with correct Gridline

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
Rahan
Posts: 12
Joined: Fri Jul 08, 2005 3:30 pm

How can i put axis units in the middle with correct Gridline

Post by Rahan » Fri Apr 20, 2007 12:21 pm

Hello,

i have a TimeSeries Chart like this
Image

The Problem: The month January is on the end of the scale. This confused the people who watch it too much.

I set the align with the command:
DateAxis axis = (DateAxis)plot.getDomainAxis();
axis.setTickUnit(new DateTickUnit(DateTickUnit.MONTH, 1, null));
axis.setTickMarkPosition(DateTickMarkPosition.MIDDLE);

axis.setDateFormatOverride(new SimpleDateFormat("MMM"));

Than i have something like this:


Image

But the Gridline does not begin with the 1 Jan.
Can anyone help me, to create a TimeSeries like this fake

Image

david.gilbert
JFreeChart Project Leader
Posts: 11734
Joined: Fri Mar 14, 2003 10:29 am
antibot: No, of course not.
Contact:

Post by david.gilbert » Fri Apr 20, 2007 5:03 pm

You won't get the result you want with a DateAxis, but the PeriodAxis class might work.
David Gilbert
JFreeChart Project Leader

:idea: Read my blog
:idea: Support JFree via the Github sponsorship program

Locked