control of tick marks on log axis

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Locked
David Mechner

control of tick marks on log axis

Post by David Mechner » Mon Aug 12, 2002 10:16 pm

Hi,

I'm having a lot of trouble controling display of tick marks on a (vertical) log axis. I can control the upper and lower bounds, but the ticks only seem to appear at powers of 10. I'd like to make arbitrary tick marks and grid lines (at, say, 50, 100, 150) but supplying a NumberTickUnit with a size of 50 doesn't seem to work (I still only see a tick at 100). Code snippet is below:

XYPlot plot = chart.getXYPlot();
NumberAxis axis = new VerticalLogarithmicAxis("Price",
Axis.DEFAULT_AXIS_LABEL_FONT,
Axis.DEFAULT_AXIS_LABEL_PAINT,
Axis.DEFAULT_AXIS_LABEL_INSETS,
false, // labels drawn vertical?
true, // tick labels visible
Axis.DEFAULT_TICK_LABEL_FONT,
Axis.DEFAULT_TICK_LABEL_PAINT,
Axis.DEFAULT_TICK_LABEL_INSETS,
true, // tick marks visible
Axis.DEFAULT_TICK_STROKE,
false, // auto range
false, // auto range includes zero
new Double(40),
40.0,
160.0,
false, // inverted
false, // auto tick unit selection
new NumberTickUnit(50.0, new DecimalFormat("0")),
true, // grid lines visible
ValueAxis.DEFAULT_GRID_LINE_STROKE,
ValueAxis.DEFAULT_GRID_LINE_PAINT,
ValueAxis.DEFAULT_CROSSHAIR_VISIBLE,
0.0,
ValueAxis.DEFAULT_CROSSHAIR_STROKE,
ValueAxis.DEFAULT_CROSSHAIR_PAINT,
false // log10ticklabels
);
plot.setRangeAxis(axis);


Any tips would be appreciated (including the tip that it won't work, if that's the case).

Thanks,
-David

David Gilbert

Re: control of tick marks on log axis

Post by David Gilbert » Tue Aug 13, 2002 1:43 pm

Hi David,

I've got a feeling that there isn't a lot you can do to control the tick sizes for log axes...but I didn't write those classes so I'm not sure yet. Note that there are some enhancements in the CVS version of JFreeChart that will be included in 0.9.3 when it is released. You might want to check those out...

Regards,

DG.

Locked