Hi Luke, Hi Suzanne, Hi list,
> Luke & Suzanne Catania wrote:
>
> I have some long axis labels and with the default axis settings and
> they actual overlap the min and max scale numbers on the scale, which
> then can't be read.. Is there anyway to move the labels a bit to the
> left of the scale values on the Y axis and a bit below the scale
> values on the X axis.
>
> Also I noticed an email to the list about the visad.AxisScale class
> having several methods to
> change the properties of the AxisScale, such as:
>
> setMajorTickSpacing()
> setMinorTickSpacing()
> createStandardLabels()
> setLabelTable()
>
> I don't see AxisScale available in my version of VisAD. Is there a
> newer version available and how can I tell what version I have? And
> are there any example code that shows how to user this class.
>
> Luke
>
Yes, AxisScale is relatively new; I don't know how you can get the VisAD
version number (I think at the moment they are all called VisAD 2.0 -
don't think there are build numbers; of course, I could be wrong);
anyway, there's example code from Don Murray, to be downloaded from
ftp://ftp.unidata.ucar.edu/pub/dmurray/ScaleTest.java
But first you need the latest visad.jar.
There wou'll find the code to set your own labels with a hash table:
// create table
Hashtable timeLabels = new Hashtable();
// put some values into it
timeLabels.put(new Double(0), "First");
timeLabels.put(new Double(10), "Last");
timeMap.getAxisScale().setLabelTable(timeLabels);
Wit the lines above, your axis should have a label "First" at the value
of 0 and the label "Last" at about 10 units.
Map test does something similar:
// get the AxisScale
AxisScale latAxis = latMap.getAxisScale();
// change tick props
latAxis.setMajorTickSpacing(30);
latAxis.setMinorTickSpacing(10);
latAxis.setTitle(""); // no title!
// create a hash table for user defined labels
Hashtable latTable = new Hashtable();
latTable.put(new Double(-90), "90S");
latTable.put(new Double(-60), "60S");
latTable.put(new Double(-30), "30S");
latTable.put(new Double(0), "Equator");
latTable.put(new Double(90), "90N");
latTable.put(new Double(60), "60N");
latTable.put(new Double(30), "30N");
latAxis.setLabelTable(latTable);
Example available from:
ftp://ftp.unidata.ucar.edu/pub/dmurray/MapTest.java
Hope that helps,
Ugo