DataTextStackedTotalOnTop()

In this section:

This property controls the display of cumulative values on top of the stacked riser. This is different from regular Data Text Display on Stacked charts where cumulative totals appear on each segment of the riser. This option is available for bar, line, and area stacked charts.

Syntax:

setDisplay(getDataTextStackedTotalOnTop(), boolean);

where:

boolean

Is true or false. When boolean is true, cumulative values appear on the risers in the graph output. When it is false, cumulative values do not appear.

Note: The position of StackedTotal data text is on the bottom of the stack when the sum is negative and on the top of the stack when the sum is positive.

Example:

The following example illustrates a stacked bar chart where cumulative values appear on the risers.

GRAPH FILE CENTSTMT
SUM CENTSTMT.CONSOL.BUDGET_AMT
CENTSTMT.CONSOL.ACTUAL_AMT
CENTSTMT.CONSOL.ACTUAL_YTD
ACROSS CENTSTMT.CONSOL.PERIOD
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET 3D OFF
ON GRAPH SET GRID ON
ON GRAPH SET GRAPHEDIT SERVER
ON GRAPH SET VZERO ON
ON GRAPH SET STYLE *
*GRAPH_SCRIPT
setFillColor(getFrame(),new Color(255,218,185));  setDisplay(getDataTextStackedTotalOnTop(), true);
setPlace(true);
*END
TYPE=REPORT,BACKCOLOR=rgb(255 250 205),  $
ENDSTYLE
END

The output is:


Top of page

x
Format Option for the Stack Total Value

How to:

When generating a stacked graph, you can set the setUseDataTextStackTotalOnTopFormat(Boolean); API to true. This enables you to format the stack total value using the setTextFormatPreset(getDataTextStackedTotalOnTop(), int); API call.

For example, the following calls set the format option to true and then format the stack total using preset format 6:

setUseDataTextStackTotalOnTopFormat(true);
setTextFormatPreset(getDataTextStackedTotalOnTop(), 6); 


x
Syntax: How to Format the Stack Total Value
setUseDataTextStackTotalOnTopFormat(Boolean);

where:

Boolean

Can have the following values:

  • true, which enables formatting the stack total value using the setTextFormatPreset(getDataTextStackedTotalOnTop(), int); API call.
  • false, which disables reformatting the total stack value. This is the default value.


Example: Formatting the Stack Total Value

The following request enables the stacked total value format option, and then formats the stack total using preset format 6 ($#), which prefixes the number with a dollar sign ($):

GRAPH FILE WF_RETAIL_LITE
SUM COGS_US REVENUE_US
BY PRODUCT_CATEGORY
ON GRAPH PCHOLD FORMAT PNG
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH SET STYLE *
INCLUDE=ENIADefault_combine.sty,$
*GRAPH_SCRIPT
setPlace(true); 
setDataTextDisplay(true);
setDataTextPosition(4);
setDisplay(getDataTextStackedTotalOnTop(),true);
 setUseDataTextStackTotalOnTopFormat(true); 
setTextFormatPreset(getDataTextStackedTotalOnTop(), 6);  
*END
ENDSTYLE
END

The output is:


WebFOCUS