Alternate Formatting

In this section:

Alternate formatting objects and methods can be used to apply different colors to sections of an axis and axis labels. You may also define a text label to show with an alternate formatted section.


Top of page

x
Alternate Formatting Objects

The following objects support alternate formatting of an axis and axis labels.

Use setDisplay() and omit the nIndex parameter to enable alternate formatting of the axis and/or axis labels.

Example:

setDisplay(getY1AltFmtFrame(),true);//Enable alt format of Y1Axis
setDisplay(getY1AltFmtLabel(),true);//Enable alt format of labels

When alternate formatting is enabled for an axis, use the alternate formatting methods to define how many sections/colors will be defined and the location on the axis to separate the sections.


Top of page

x
Alternate Formatting Methods

In this section:



x
get/setAltFmtFrameNumColors()

These methods get/set the number of colors/sections to be used for alternate formatting of an axis. Alternate formatting can be used to assign different colors to individual sections of an axis and axis labels. You may also define a text string label that is shown with the alternate formatted section.

int getAltFmtFrameNumColors (IdentObj idObj);
void setAltFmtFrameNumColors (IdentObj idObj, int newValue);

where:

idObj

Is the object ID of an alternate formatting axis object (for example, getY1AltFmtFrame(), getO1AltFmtFrame(), and so on).

newValue

For setAltFmtFrameNumColors(), number of colors/sections to use for alternate formatting of the specified axis (idObj). It can be a value in the range 1...100. The default value is 2.

Return:

int; For getAltFmtFrameNumColors(), number of colors/sections that are used for alternate formatting of the specified axis (idObj).



x
get/setAltFmtFrameSeparator()

These methods get/set the location on an axis where alternate formatting is applied.

Syntax:

double getAltFmtFrameSeparator (IdentObj idObj);
void setAltFmtFrameSeparator(IdentObj idObj,double newValue);

where:

idObj

Is the object ID of an alternate formatting axis object (for example, getY1AltFmtFrame(), getO1AltFmtFrame(), and so on).

newValue;

For setAltFmtFrameSeparator(), the location on the axis where alternate formatting will be applied. For a numeric axis, specify a value that is within the range of values on the specified axis. For the ordinal (O1) axis, specify a group number that is within the range of groups on the ordinal axis.

Return:

double; For getAltFmtFrameSeparator(), the location on the axis where alternate formatting has been applied.


Top of page

x
Applying Colors & Labels

After an alternate formatting object has been enabled with setDisplay() and alternate formatting methods define the number of colors/sections and frame separator location, use the setDisplay() method again to enable each section and setFillColor() to apply colors to each section.

Example:

setDisplay(getY1AltFmtFrame(),true); 
setDisplay(getY1AltFmtLabel(),true); 
setAltFmtFrameNumColors(getY1AltFmtFrame(),3); 
setAltFmtFrameSeparator(getY1AltFmtFrame(0),30.0); 
setAltFmtFrameSeparator(getY1AltFmtFrame(1),45.0); 
setDisplay(getY1AltFmtFrame(0),true); 
setDisplay(getY1AltFmtFrame(1),true); 
setDisplay(getY1AltFmtFrame(2),true); 
setFillColor(getY1AltFmtFrame(0),new Color(255,0,0)); 
setFillColor(getY1AltFmtFrame(1),new Color(255,255,0)); 
setFillColor(getY1AltFmtFrame(2),new Color(0,255,0)); 
setFillColor(getY1AltFmtLabel(0),new Color(255,0,0)); 
setFillColor(getY1AltFmtLabel(1),new Color(255,0,0)); 
setFillColor(getY1AltFmtLabel(2),new Color(255,0,0)); 

Use the setTextString() method to define section labels.

Example:

setTextString(getY1AltFmtLabel(0),"Label Section 0"); 
setTextString(getY1AltFmtLabel(1),"Label Section 1"); 
setTextString(getY1AltFmtLabel(2),"Label Section 2"); 

These two code segments produce a chart in the following format:

graph with colors and labels


WebFOCUS