Gantt chart Minor ticks

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
nsurendiran
Posts: 17
Joined: Mon Oct 26, 2009 12:07 pm
antibot: No, of course not.

Gantt chart Minor ticks

Post by nsurendiran » Tue Oct 27, 2009 10:28 am

Hi All,

I 've downloaded v1.0.13 and implemented the MinorTicks. It looks great. Now what I want to know is that,

1) can we differentiate the color of the Ticks and MinorTicks differently.

I cant see any method to color/paint the MinorTicks seperately. It comes with Red color by default.

2) Can we set the rangeAxis.setMinorTickMarkInsideLength(float); -> to the height of the chart? instead by giving some hardcoded value? and how?


Any help would be appreciated.

Thanks
Surendran.

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

Re: Gantt chart Minor ticks

Post by paradoxoff » Tue Oct 27, 2009 7:38 pm

nsurendiran wrote: 1) can we differentiate the color of the Ticks and MinorTicks differently.
No, at present there is no separate "minorTickMarkPaint"/"minorTickMarkStroke" property, but it should´t be too hard to implement.
nsurendiran wrote: 2) Can we set the rangeAxis.setMinorTickMarkInsideLength(float); -> to the height of the chart? instead by giving some hardcoded value? and how?
If the axis is a domain axis of an XYPlot, call

Code: Select all

plot.setDomainMinorGridlinesVisible(true);
Is is that what you are looking for?
Note that the paint/stroke for the minor grid lines can be selected independently of the paint/stroke for the (major) grid lines.

nsurendiran
Posts: 17
Joined: Mon Oct 26, 2009 12:07 pm
antibot: No, of course not.

Re: Gantt chart Minor ticks

Post by nsurendiran » Wed Oct 28, 2009 5:09 am

Hi,

Thanks for the reply. I have done the differentiating colors between the Minor and Major Ticks by the following code.

Code: Select all


        CategoryPlot plot = chart.getCategoryPlot();
        plot.setRangeGridlinesVisible(true);
        plot.setRangeGridlinePaint(Color.BLUE); //Range Line Vertical Major Tick
        plot.setRangeGridlineStroke(new BasicStroke(1)); //width of Major Tick 

        DateAxis rangeAxis = (DateAxis) plot.getRangeAxis();
        rangeAxis.setTickMarkPaint(Color.PINK);   // color of the Minor Tick
the code which you suggested

plot.setDomainMinorGridlinesVisible(true);

is for the horizontal line. Coloring issue is resolved now for me with the above code I placed.

Still I have the height of the Minor ticks to be adjusted to the height of the chart.

Any suggestions?

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

Re: Gantt chart Minor ticks

Post by paradoxoff » Thu Oct 29, 2009 9:51 pm

Sorry, I didn´t see the "Gantt chart" in your thread title. :oops:
In that case we are dealing with a CategoryPlot. The range axis of CategoryPlot is a ValueAxis, and to show the minor grid lines, you would have to call
plot.setRangeMinorGridlinesVisible(true)
I am not sure whether it is that what you mean by "adjusting the minor ticks to the height of the chart" but it should be quite close.

nsurendiran
Posts: 17
Joined: Mon Oct 26, 2009 12:07 pm
antibot: No, of course not.

Re: Gantt chart Minor ticks

Post by nsurendiran » Tue Nov 03, 2009 5:15 am

Hi Thanks again for the reply.

Yes, this is the one I am looking for. And its working now

But I did a workaround and solved my problem , say if my chart height is 700, I have to set the minorGridlines height to 600, and it was working.

Code: Select all

DateAxis rangeAxis = (DateAxis) plot.getRangeAxis();
       rangeAxis.setMinorTickCount(4);
       rangeAxis.setMinorTickMarksVisible(true);        
       rangeAxis.setMinorTickMarkInsideLength(700.0f);  //height of the minor ticks        
       rangeAxis.setMinorTickMarkOutsideLength(0f);
Anyway Now I need not worried about the calculations. Thanks dude :)

PS: Could any one please tell me how can I upload an screenshot of my application? I already read that in the forum rules..
But I dont have any shared server, and its not accessbile via internet. So Is that possible for me to upload from my desktop?

Suren

Locked