AxisObject Object Class


Overview

A Chart object automatically creates several AxisObject objects. AxisObject objects are used both to provide annotation to the plot and to provide a coordinate system to map user coordinates to and from device coordinates.

The Chart object creates two additional sets of axes (two vertical axes and two horizontal axes) that are used to provide annotation for the plot and to define the user coordinate system. Function XintChartGetComponent lets you access the ID of one of the horizontal axes and one of the vertical axes. The axes in each set are synchronized, so when one is modified the other one is automatically updated. See Plot2D resources XmNxAxisPlacement and XmNyAxisPlacement to control which axes are visible.

The resources listed below can be used to customize the appearance of the axis objects.


Axis Limits and Increments

The limits and increments of the horizontal and vertical AxisObject associated with a 2D plot are controlled using Plot2D resources XmNxLimits, XmNyLimits, XmNxIncrements and XmNyIncrements. See section Plot2D below for more information on how to set those resources. If you don't specify those resources, the axis will be automatically scaled based on the content of the data displayed in the Plot2D object.

Inherited Resources and Behavior

The AxisObject object class inherits behavior and resources from the Xt Object and Graphic object classes.
The following resources are defined by the AxisObject object class:
NameTypeDefaultAccess
XmNannotationAngleint0CSG
XmNannotationFontString"*-Helvetica*-120-*"CSG
XmNannotationFormatString"%g"CSG
XmNannotationPlacementintXintANNOTATION_OUTSIDECSG
XmNaxisLineThicknessint2CSG
XmNendPointsXintEndPoints *{10., 10., 90., 90.}CSG
XmNincrementsXintIncrements *{20., 10.}CSG
XmNlabelStringNULLCSG
XmNlabelFontString"*-Helvetica*-140-*"CSG
XmNlimitsXintLimits *{0., 100.}CSG
XmNlogScaleBooleanFalseCSG
XmNmajorGridLineStyleintXintLINE_NONECSG
XmNminorGridLineStyleintXintLINE_NONECSG
XmNreverseOrderBooleanFalseCSG
XmNtickPlacementintXintTICK_OUTSIDECSG


XmNannotationAngle

Specifies the angle of rotation in degrees for the axis annotation with respect to the axis base line. Best results are obtained for angle values between -45 and 90.

XmNannotationFont

Specifies the font used to draw the axis annotation.

XmNannotationFormat

Specifies the format used to draw the annotation. Use any C format descriptor (e.g. "%5.2f") suitable for displaying floating point data.

XmNannotationPlacement

Specifies where to locate the annotation with respect to the axis line. You can specify one of the following constants:

Resource ValueDescription
XintANNOTATION_NONENo annotation is displayed.
XintANNOTATION_INSIDEAnnotation is displayed inside the plot area.
XintANNOTATION_OUTSIDE (default)Annotation is displayed outside the plot area.
XintANNOTATION_CROSSAnnotation is displayed on both sides.


XmNaxisLineThickness

Specifies the axis line thickness in pixels.

XmNendPoints

Specifies the axis geometry which is defined by specifying the two end points of the axis bounding box in the parent coordinate system. This resource is specified as a pointer to a data structure of type XintEndPoints which takes the following form:

   typedef struct {
                    float x1, y1;
                    float x2, y2;
   } XintEndPoints;

This resource is automatically set for an Axis object that is used inside a Chart object.


XmNincrements

Specifies the major and minor increment for the axis annotation. This resource is specified as a pointer to a data structure of type XintIncrements which takes the following form:

   typedef struct {
                   float major_increment;
                   float minor_increment;
   } XintIncrements;

This resource should not be set directly for an Axis object created inside a Chart object. Use Plot2D resources XmNxIncrements and XmNyIncrements instead.


XmNlabel

Specifies a string that is used to draw the axis title label. Specify NULL if you don't want an axis title label.

XmNlabelFont

Specifies the font used to draw the axis title label.

XmNlimits

Specifies the limits for the axis widget. This resource is specified as a pointer to a data structure of type XintLimits which takes the following form:

   typedef struct {
                    float minimum;
                    float maximum;
   } XintLimits;

This resource should not be set directly for an Axis object created inside a Chart object. Use Plot2D resources XmNxLimits and XmNyLimits instead.


XmNlogScale

Specifies whether to use a linear scale (False) or a logarithmic scale (True). If you specify a logarithmic scale, make sure that the data range is strictly positive.

XmNmajorGridLineStyle, XmNminorGridLineStyle

Specifies how to draw the major (minor) grid lines associated with the AxisObject. For a vertical axis, these resources control the horizontal grid lines; for a horizontal axis, these resources control the vertical grid lines. You can specify one of the following constants:

Resource ValueDescription
XintLINE_NONE (default)No grid lines are drawn.
XintLINE_SOLIDGrid lines are drawn using a solid line.
XintLINE_ON_OFF_DASHGrid lines are drawn using a on-off dash pattern
XintLINE_DOUBLE_DASHGrid lines are drawn using a double dashed patterns.


XmNreverseOrder

Specifies whether to invert the axis or not. By default (False), the axis places the minimum value on the left (horizontal axis) or at the bottom (vertical axis). If you specify True, the axis will place the minimum value on the right (horizontal axis) or at the top (vertical axis).

XmNtickPlacement

Specifies where to locate the major and minor tick marks with respect to the axis line. You can specify one of the following constants:

Resource ValueDescription
XintTICK_NONENo tick marks are displayed.
XintTICK_INSIDETick marks are displayed inside the plot area.
XintTICK_OUTSIDE (default)Tick marks are displayed outside the plot area.
XintTICK_CROSSTick marks are displayed on both sides.


Graphic Class Inherited Resources

AxisObject inherits behavior and resources from the Graphic class. The set of resources that can be accessed along with the proper defaults is listed below.

Graphic Class
NameTypeDefaultAccess
XmNcolorPixelforegroundCSG
XmNdashListchar *NULLCSG
XmNfontchar *"Helvetica*120*"CSG
XmNhighlightModeintXintHIGHLIGHT_HANDLECSG
XmNlineStyleintXintLINE_SOLIDCSG
XmNlineThicknessint1CSG
XmNmoveBooleanTrueCSG
XmNsensitiveBooleanTrueCSG
XmNshapeBooleanTrueCSG
XmNstippleColorPixelforegroundCSG


Functions

The following functions can be used to do conversion between pixel coordinates and axis object coordinates.

XintAxisObjectUserToPixel

Converts a user coordinate expressed in the Axis object coordinate system into a pixel location. The function returns False if the coordinate is outside the axis range.

     Boolean XintAxisObjectUserToPixel (...)

ObjectaxisID of the Axis object.
doubleuser_coordinateUser coordinate to convert to a pixel location.
int *pixelReturns the pixel location corresponding to user_coordinate.


XintAxisObjectPixelToUser

Converts a pixel location into a user coordinate expressed in the Axis object coordinate system. The function returns False if the coordinate returned is outside the axis range.

     Boolean XintAxisObjectPixelToUser (...)

ObjectaxisID of the Axis object.
intpixelPixel coordinate to convert.
float *user_coordinateReturns the user coordinate corresponding to pixel.


Macros

The XintIsAxisObject macro returns True if the specified object is an AxisObject object. It returns False otherwise.

     Boolean XintIsAxisObject (Object object)