Plot.DrawAxis

Prototypes

void DrawAxis( double dX1, double dY1, double dX2, double dY2, double[] adMajorTickPos, String[] asMajorTickLabel <, double[] adMinorTickPos> )

void DrawAxis( double dX1, double dY1, double dX2, double dY2, double[] adMajorTickPos, String[] asMajorTickLabel, double[] adMinorTickPos <, double dTickAngle> )

Parameters

double dX1, dY1
An ordered pair specifying the coordinates of the beginning of the axis. These coordinates are assumed to be in the current coordinate system.

double dX2, dY2
An ordered pair specifying the coordinates of the end of the axis. These coordinates are assumed to be in the current coordinate system.

double[] adMajorTickPos
An array of fractional positions along the axis. Each element must be in the range [0, 1]. If adMajorTickPos[i] = z, the ith tick mark is (100z)% along the axis. For example, z=0 is the beginning of the axis, z=0.25 is one-quarter of the way along, and z=0.5 is halfway along the axis.

String[] adMajorTickLabel
An array of labels. The label adMajorTickPos[i] is the label for the ith tick mark.

double[] adMinorTickPos
An array of fractional positions between major tick marks. Each element must be in the range (0, 1). If adMinorTickPos[i] = z, the ith minor tick mark is (100z)% between major tick marks. For example, z=0.5 puts a minor tick mark halfway between each major tick mark. If this parameter is not specified or is null, no minor ticks are drawn.

double dTickAngle
The angle (in degrees above the horizontal) at which ticks are drawn. If this parameter is not specified, tick marks are drawn perpendicular to the axis and in a direction away from the plot's center.

Remarks

This method draws an axis with uniform or nonuniform tick marks. Note that the positions of the tick marks are determined by specifying a proportion along the axis and not by specifying data values. If you do not specify dTickAngle, the tick marks are drawn perpendicular to the axis. Because there are two directions perpendicular to the axis, the direction chosen may not be the direction you prefer. To explicitly set perpendicular tick marks, set dTickAngle to 180*PI*atan2(dX1-dX2, dY2-dY1) or 180*PI*atan2(dX2-dX1, dY1-dY2)) where PI = 4*atan(1). The axis is drawn using the current drawing attributes. The line and tick marks are drawn using the current pen characteristics and the text is drawn using the current text characteristics.

Example
x = { 1 2 3 4 5 6 7 8 };
y = { 2 1 4 5 6 5 6 9 };
declare LinePlot plot;
plot = LinePlot.Create( "Sample Data", x, y );
plot.DrawUseNormalizedCoordinates( -1, 1, -1, 1 ); 
/* draw axes in user-defined coordinates */
MajorTickPos = { 0 0.25 0.75 1 }; /* no tick at origin */
MajorTickLabels = { "-1" "-0.5" "0.5" "1" };
plot.DrawAxis( -1, 0, 1, 0, MajorTickPos, MajorTickLabels );
plot.DrawAxis( 0,-1, 0, 1, MajorTickPos, MajorTickLabels );
See Also

Plot.DrawNumericAxis