Plotting Dates in Graphs

In this section:

Numeric fields containing dates are recognized by the field formats specified in the Master File. Such fields can be used in ACROSS or BY phrases in GRAPH requests. To review the various format types, refer to the Describing Data With TIBCO WebFOCUS® Language manual.

Plotted dates are handled in the following manner:

You can selectively combine groups of date point plots to reduce the number of separate points on the horizontal axis. You do this with the IN-GROUPS-OF option. For example, if the date field format is I6YMD, you can display the data by month rather than by day by grouping it in 30-day increments:

ACROSS DATE IN-GROUPS-OF 30

This eliminates plot points for individual days. If your date format is YMD, you can redefine the format and divide the field contents by 100 to eliminate the days:

DATE/I4YM=DATE/100

Example: Including Date Fields in a Graph

The following example illustrates how month-first formatted date fields are displayed in a graph.

SET GRMERGE = ON
GRAPH FILE GGORDER
SUM QUANTITY
ACROSS ORDER_DATE
BY PRODUCT_DESC
WHERE PRODUCT_DESC EQ 'French Roast' OR 'Hazelnut' OR 'Kona' AND
ORDER_DATE GE '010197'
END

The output is:

Basic Date Support for X and Y Axes

Reference:

OLDDATES can be manipulated accordingly with the usage of YRTHRESH and DEFCENT SET parameters. If you do not specify the YRTHRESH and DEFCENT commands for dates with the Y format (for example, YMD, MDY, DMY, YM, etc.), the code will assume the format 19XX.

Reference: Date Support Limitations

  • The following date formats are supported:
    • SHORT (18) is completely numeric, such as 12/13/52 or 3:30pm.
    • MEDIUM (19) is longer, such as Jan 12, 1952.
    • LONG (20) is longer, such as January 12, 1952 or 3:30:32pm.
    • FULL (21) is almost completely specified, such as Tuesday, April 12, 1952 AD or 3:30:42pm PST.

    The default date format for the X and Y axes is MEDIUM. You can overwrite the default by using one of the following API calls (where xx is one of the numbers listed above):

    setTextFormatPreset(getX1Label(),xx); // for X Axis
    setTextFormatPreset(getY1Label(),xx); // for Y Axis

    The default date format for Data Text is LONG. This only applies to graphs with dates on the Y axis. Currently this format is not supported on the X axis. You can overwrite the default by using the following API call:

    setDataTextFormat(xx);

    For more information, see Customizing Graphs Using the Graph API and HTML5 JSON Properties.

  • In a graph with dates on the X axis and numeric fields on the Y axis, the tool tip displays the data format of the graph by default. This means that a date value will display its raw GMT value in milliseconds. This does not occur for dates on the Y axis and strings on the X axis, because the data format is already in date format.
  • DATETIME is not fully supported.
  • The ability to set the start and end dates for the appropriate axis is not supported.
  • The ability to set the step for dates is not supported.

Formatting Dates for Y-Axis Values

You can display date-formatted numbers for Y-axis fields and on tool tips. The following date formats are supported:

Display Format

Corresponding WebFOCUS Format

yy/mm/dd

YMD

yy/mm

YM

mm/dd/yyyy

MDYY

mm/dd/yy

MDY

mm/dd

MD

For complete details on date formats, see the Describing Data With TIBCO WebFOCUS® Language manual.