Axis Widget Class


Overview

An Axis widget can be used to provide horizontal or vertical annotation for one or more widgets. The Axis widget can display an axis line, major and minor tick marks, major and minor tick mark labels, auxiliary annotation and a title label. The annotation and tick marks can be scrolled when the associated widget is scrolled.

The displayable range of tick mark labels is defined by the starting and ending values of the Axis widget. The displayable size of the Axis widget is defined by its virtual length in pixels. The range of numbers displayed at a given time is defined by the virtual position in pixels and the width (horizontal Axis) or height (vertical Axis) in pixels of the widget window.


Using the Axis Widget with the Grid Class

The Grid class already provides one level of vertical and horizontal annotation (labeled tick marks). The Axis widget can be used when additional levels of annotation are required. The Grid class provides a set of constraint resources to position Axis children.

Creating an Axis Widget

An application creates an Axis widget as a child of a Grid widget. The Grid widget class defines constraint resources used to position the Axis widget.

Graphic Attributes

The appearance of an Axis widget can be customized extensively. Resources are provided to set the appearance (solid or 3D), the size and color of the axis line and tick marks. The annotation label font, color and orientation can also be set using the widget resources.

Scale

The Axis widget can use a linear or logarithmic scale. Other non-linear scales can be displayed by specifying an array of annotation labels and user defined locations using the auxiliary set of resources.

Axis Thumb

The thumb of a scrolled Axis widget is the visible part of the Axis, and thus the thumb size is equal to the width (horizontal Axis) or the height (vertical Axis) of the Axis window. The thumb size is always less than or equal to the virtual length of the Axis widget.

Floating Point Resources

The Axis widget defines floating point resources such as XmNminorIncrement and XmNmajorIncrement. The Xt library does not support floating point resources, and thus, those resources must be passed as an address rather than a value. Floating point resources can also be retrieved using the XtGetValues function. Similar to the function XtSetValues, you must specify the address of the floating point value in the XtSetArg or XtVaGetValues call. The floating point value returned is equal to constant XintUNDEFINED_FLOAT if the value of the resource is not defined.

Axis Widget Appearance

Below are two examples of the visual appearance of the Axis widget. The first example uses a linear scale, the second a logarithmic scale.


Figure 4: Linear Axis.


Figure 5: Logarithmic Axis.