Axis Unit

The AxisUnit node controls the placing of a unit tag on an axis. The tag is the value of the Title attribute in the node. By default, it is empty.

The axis unit is used for labeling only; it has no other effect on the chart.

Setting the Axis Unit

In this example, the axis unit for the x-axis is set to “hours” and the axis unit for the y-axis is set to “meters”. While not required, the axis titles are also set.

(Download Code)

 

import com.imsl.chart.*;

 

public class SampleAxisUnit extends JFrameChart {

   

    public SampleAxisUnit() {

        Chart chart = getChart();

        AxisXY axis = new AxisXY(chart);

        double y[] = {4, 2, 3, 9};

        new Data(axis, y);

       

        axis.getAxisX().getAxisTitle().setTitle("Time");

        axis.getAxisY().getAxisTitle().setTitle("Height");

       

        axis.getAxisX().getAxisUnit().setTitle("hours");

        axis.getAxisY().getAxisUnit().setTitle("meters");

    }

   

    public static void main(String argv[]) {

        new SampleAxisUnit().setVisible(true);

    }

}

 



Visual Numerics - Developers of IMSL and PV-WAVE
http://www.vni.com/
PHONE: 713.784.3131
FAX:713.781.9260