Labels and Titles

Topics:

The titles and labels that are included in the graph consist of the graph-wide titles (footnote, title, and subtitle) and ordinal and numeric axis labels and titles. All labels and titles can be defined, displayed, and auto-fitted using the properties and methods described in this section.

Graph-Wide Titles

You can use these properties to define, display, and auto-fit the graph title, subtitle, and footnote:

  • FootnoteAutofit(true/false)
  • FootnoteDisplay(true/false)
  • FootnoteString (String)
  • SubtitleAutofit(true/false)
  • SubtitleDisplay(true/false)
  • SubtitleString (string)
  • TitleAutofit (true/false)
  • TitleDisplay (true/false)
  • TitleString (string)

Ordinal Axis Labels and Titles

You can use these properties to control the appearance of labels and titles on an ordinal axis:

  • O1/O2ExcludeMaxLabel(true/false)
  • O1/O2ExcludeMinLabel(true/false)
  • O1/O2LabelAutofit (true/false)
  • O1LabelAutoskip (0...2)
  • O1/O2LabelDisplay (true/false)
  • O1/O2LabelRotate (0...2)
  • O1LabelStagger(true/false)
  • O1/O2LabelWrap (true/false)
  • O1LabelSkipBegin (value)
  • O1LabelSkipCount (value)
  • O1/O2TitleAutofit (true/false)
  • O1/O2TitleDisplay (true/false)
  • O1/O2TitleString (string)

You can use the ExcludeMinLabel and ExcludeMaxLabel properties to include/exclude the minimum and maximum labels on the ordinal axis.

The LabelDisplay and LabelAutofit properties determine whether labels are displayed and auto-fitted on the ordinal axis. See Label and Title Methods for methods that you can use to define ordinal axis labels.

You can use the LabelRotate, LabelStagger, and LabelWrap properties to control how labels are imaged on the ordinal axis.

You can use the LabelAutoSkip, LabelSkipBegin, and LabelSkipCount properties to omit some of the labels on the O1-axis. When LabelAutoSkip selects manual skip mode, LabelSkipBegin and LabelSkipCount properties define the beginning label and interval of labels to be omitted. When LabelAutoSkip selects automatic label skip mode, labels are omitted as necessary when the graph is made smaller in order to maintain a reasonable, readable label size (a minimum 8-point font size).

You can use the TitleAutofit, TitleDisplay, and TitleString properties to define, display, and auto-fit the title on an ordinal axis.

Numeric Axis Labels and Titles

These properties control the appearance of labels and titles on a numeric axis:

  • X1/Y1/Y2ExcludeMaxLabel(true/false)
  • X1/Y1/Y2ExcludeMinLabel (true/false)
  • X1/Y1/Y2LabelAutofit (true/false)
  • X1/Y1/Y2LabelDisplay (true/false)
  • X1/Y1/Y2LabelRotate (0...2)
  • X1/Y1/Y2LabelStagger (true/false)
  • X1/Y1/Y2TitleAutofit (true/false)
  • X1/Y1/Y2TitleDisplay (true/false)
  • X1/Y1/Y2TitleString (String)

You can use the ExcludeMinLabel and ExcludeMaxLabel properties to include/exclude the minimum and maximum labels on a numeric axis.

The LabelDisplay and LabelAutofit properties determine whether labels are displayed and auto-fitted on a numeric axis.

The LabelRotate and LabelStagger properties control how labels are imaged on a numeric axis.

The TitleAutofit, TitleDisplay, and TitleString properties define, display, and auto-fit the title on a numeric axis.

Label and Title Methods

These methods control the appearance of labels and titles:

  • get/setDataLabel(); Get/sets a label string at a specified series and group.
  • get/setAutoSkip(); Gets/sets automatic, manual, or no skipping of labels on an axis.
  • get/setExcludeMaxLabel(); Gets/sets whether or not maximum labels are imaged for an axis in a graph.
  • get/setExcludeMinLabel(); Gets/sets whether or not minimum labels are imaged for an axis in a graph.
  • get/setGroupLabel(); Gets/sets the label string assigned to a group object.
  • get/setLabelStagger(); Gets/sets the label stagger attribute for an axis object.
  • get/setSeriesLabel(); Gets/sets the label string assigned to a series object.
  • get/setSkipBegin(); When you use setAutoSkip() to select manual skipping of labels on an axis, use these properties to get/set the first label to be skipped.
  • get/setSkipCount(); When you use setAutoSkip() to select manual skipping of labels on an axis, use these properties to get/set the interval of labels to be skipped.

When you use these methods, you may supply an object ID as an input parameter to assign or retrieve the attribute to or from a specific label. If you do not specify a label object, the methods assign the attribute to or retrieve the attribute from the first item in the selection list. If the object ID does not identify a label object or the first item in the selection list is not a label object, a set operation applies the attribute to the object but it will not have any effect on the appearance of the graph.

Formatting Date and Time Values for Y-Axis Labels

Military time uses a 24-hour time format where numbers between zero (0) and one (1), or times using a 12-hour format with AM and PM indicators, are converted to times between 0:00 and 23:00. Numbers greater than one are cycled so that they map to one of these hours as well, except for cumulative military time, in which case they add to the original value.

The following table illustrates the mapping of hours between formats, using Excel general format as the initial value:

General Format

Military Cycle

AM/PM Cycle

Military Cumulative

0

0:00

12:00AM

0:00

0.25

6:00

6:00 AM

6:00

0.5

12:00

12:00PM

12:00

0.75

18:00

6:00PM

18:00

1.00

0:00

12:00AM

24:00

1.25

6:00

6:00 AM

30:00

1.75

18:00

6:00PM

42:00

2

0:00

12:00AM

48:00

Two methods support these time formats for y-axis labels:

  • setTextFormatPreset must be set to 32 for the object to be formatted, such as Y1 Labels. The data for the Y1 axis must be in Java Date Format, which is based on java.text.DateFormat. This is defined as the milliseconds since January 1, 1970, 00:00:00 GMT
  • setSimpleDateFormat(string) specifies the date and time options to display, where string can be a combination of the following format codes:

    Format Character

    Description

    Example

    G

    Era designator

    AD

    Y

    Four-digit year

    2014

    M

    Month in year

    July or 07

    d

    Day in month

    10

    D

    Day in year

    360

    E

    Day in week

    Tuesday

    F

    Day of week in month

    2 (second Wed. in July)

    h

    Hour in A.M./P.M. format (1~12)

    12

    H

    Hour in military cycle format (0~23)

    22

    K

    Hour in A.M./P.M. (0~11)

    10

    m

    Minute in hour

    30

    s

    Second in minute

    55

    S

    Millisecond

    234

    w

    Week in year

    40

    W

    Week in month

    1

    a

    A.M./PM. marker

    PM

    z

    Time zone

    Eastern Standard Time

    '

    Escape for text

    Delimiter

    "

    Single quotation mark

    `

    The default format for the SimpleDateFormat string is: HH:MM

For example:

setTextFormatPreset(getY1Label(), 32);   
setSimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); 

A sample of output for these API calls is:

Sun 2004.07.18 at 04:14:09 PM PDT

Example: Specifying Date and Time Formats for Y-Axis Labels

The following request generates varying time values to use as the measure on the chart and displays y-axis labels in the format "E yyyy.MM.dd 'at' hh:mm:ss a zzz":

DEFINE FILE WF_RETAIL_LITE
ZZ/I11 WITH ID_SALES  = ZZ + 1;
KUM/I11 WITH ID_SALES  =  ZZ * 5;
DATUM/YYMD WITH ID_SALES = DATEADD(TIME_DATE, 'D', ZZ);
END
 
GRAPH FILE WF_RETAIL_LITE
SUM DATUM
BY TIME_DATE
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
  setPlace(true);
  setFontSizeAbsolute(getY1Label(),true);
  setFontSizeInPoints(getY1Label(),6);
  setPlaceResize(getY1Label(),0);
  setTextFormatPreset(getY1Label(), 32);   
  setSimpleDateFormat("E yyyy.MM.dd 'at' hh:mm:ss a zzz"); 
*END 
 ENDSTYLE
 END

The output is:

Using Nested/Multi-Dimensional Labels

Nested/multi-dimensional labels are supported on the O1 axis with these properties and methods:

  • setO1LabelCallback(); This method assigns a callback function to the nested labels interface.
  • getO1LabelCallback(); This method determines if a callback function has been assigned with setO1LabelCallback().

WebFOCUS

Feedback