Axis X & Tick on the XYLineChart chart

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Axis X & Tick on the XYLineChart chart

Post by BO » Mon Oct 12, 2009 12:44 pm

Hi everybody,

I have one pb following but I don't know how to "fix" it

L'axis X = week that wants to mean a "period" (so from first day to 6 day)
actually, my chart is the frist one
but I want to change like the 2nd one! (the number of week 1, 2, 3 ... are in the center of 2 ticks!
how could i do it ?

Image

Do i have to use another chart ?

thanks very much
regards
BO
Last edited by BO on Tue Oct 13, 2009 2:55 pm, edited 1 time in total.

paradoxoff
Posts: 1634
Joined: Sat Feb 17, 2007 1:51 pm

Re: Axis X & Tick on the XYLineChart chart

Post by paradoxoff » Mon Oct 12, 2009 9:56 pm

Are you using a DateAxis or a NumberAxis as domain axis?
In the latter case, you could adjust the x values of your data items in a way that they are not longer 4 and 5 but 4.5 and 5.5, then hide the major tick marks, make the minor tick marks visible, do the same for the grid lines, and set the minor tick count to 2.

BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Re: Axis X & Tick on the XYLineChart chart

Post by BO » Tue Oct 13, 2009 7:26 am

hi
best idea
I will try it
thanks

BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Re: Axis X & Tick on the XYLineChart chart

Post by BO » Tue Oct 13, 2009 2:32 pm

Hi paradoxoff
sorry but I think I have a pb

I must to show the points for the last days of the week,
ie: X=[0+6/7], [1+6/7], [2+6/7], [3+6/7], and so on (such as [i+6/7] with i = week, 6/7 = 6th on 7 jours of week)

Could I still do it ? could you show somes snippet codes for me ?

thanks a lot

BO
Posts: 61
Joined: Wed Mar 01, 2006 2:17 pm

Re: Axis X & Tick on the XYLineChart chart

Post by BO » Wed Oct 14, 2009 4:28 am

hi
I have found one simple solution:

new NumberTickUnit( 1, new DecimalFormat("0 "));

(there are some " " in the format of NumberTickUnit)

Image

but now I want to not show zero ... I dit setAutoRangeIncludesZero(false); but it didn't work :roll:
I can start at 1 but i wonder if there is another way ...

thanks

Locked