LogAxis minor tick marks not showing

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
daveb48
Posts: 10
Joined: Fri Dec 18, 2009 7:44 pm
antibot: No, of course not.

LogAxis minor tick marks not showing

Post by daveb48 » Wed Jan 13, 2010 9:13 pm

In a TimeSeries plot, using LogAxis, I am unable to get the minor tick marks to display correctly (Like LogarithmicAxis does, and I want only the major tick labels). In vers 1.0.12 I could not get them to display at all, and now in vers 1.0.13 only a single minor tick mark between a decade (see http://sol.spacenvironment.net:/~spacew ... t_3sec.png ).

I'm sure I'm doing something wrong, but after several hours I'm stumped as to what.

DateAxis domainXrt = new DateAxis( axslbl );
LogAxis rangeXrt = new LogAxis( "X-ray Flux" );
rangeXrt.setRange( 1.0E-9, 1.0E-3 );
rangeXrt.setNumberFormatOverride( new LogFormat( 10.0, " ", "E", true ) );
rangeXrt.setMinorTickCount( 9 );
XYItemRenderer rendererXrt = new XYLineAndShapeRenderer( true, false );
rendererXrt.setBaseSeriesVisibleInLegend( false );
rendererXrt.setSeriesPaint( 0, Color.red );
rendererXrt.setSeriesStroke( 0, new BasicStroke( 0.75f ) );
XYPlot plotXrt = new XYPlot( datasetXrt, domainXrt, rangeXrt, rendererXrt );
plotXrt.setDomainAxis( domainXrt );
plotXrt.setRangeAxis( rangeXrt );
JFreeChart jchart = new JFreeChart( topTitle, font, plotXrt, true );

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

Re: LogAxis minor tick marks not showing

Post by paradoxoff » Thu Jan 14, 2010 10:26 pm

Have you tried to call setMinorTickMarksVisible(true) on the LogAxis?
In 1.0.11, minor tick support was added for all ValueAxis subclasses, and maybe the default value of this flag was changed.

daveb48
Posts: 10
Joined: Fri Dec 18, 2009 7:44 pm
antibot: No, of course not.

Re: LogAxis minor tick marks not showing

Post by daveb48 » Thu Jan 14, 2010 10:31 pm

Bingo. It creates the tic marks on the side of the axis (would be nicer if they extended across the plot, but this helps). Thanks!

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

Re: LogAxis minor tick marks not showing

Post by paradoxoff » Fri Jan 15, 2010 8:03 am

daveb48 wrote: It creates the tic marks on the side of the axis (would be nicer if they extended across the plot, but this helps)
Call setRangeMinorGridlinesVisible(true) on the XYPlot :wink:
You can change the appearance of the minor gridlines by setRangeMinorGridlinesPaint(Paint) and setRangeMinorGridlinesStroke(Stroke). The same is possible for the domain axis.

daveb48
Posts: 10
Joined: Fri Dec 18, 2009 7:44 pm
antibot: No, of course not.

Re: LogAxis minor tick marks not showing

Post by daveb48 » Fri Jan 15, 2010 11:22 pm

Thanks for the suggestion, however, neither setRangeMinorGridlinesVisible(true) or setRangeMinorGridlinesPaint(true) worked. I did a get*() on both attributes, and they seem correct. I tried setWeight(int) and a few other methods as well, without effect. Could it be that LogAxis is "immune" to the some of the XYPlot attributes?

daveb48
Posts: 10
Joined: Fri Dec 18, 2009 7:44 pm
antibot: No, of course not.

Re: LogAxis minor tick marks not showing

Post by daveb48 » Sat Jan 16, 2010 1:55 am

I have found something that did work: (LogAxis, see Axis API) setMinorTickMarkInsideLength( float );

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

Re: LogAxis minor tick marks not showing

Post by paradoxoff » Sat Jan 16, 2010 6:03 pm

daveb48 wrote:Could it be that LogAxis is "immune" to the some of the XYPlot attributes?
No. The XYPlot uses the ticks returned from the axisState to draw the grid lines (major and minor based on the tick type).
At least the 1.0.12 version of the LogAxis should workl correctly, because this is what I am using regularly.

Locked