Assigning Chart Data to Attribute Categories

Topics:

How to:

Each field in the chart request is either a measure (value that can be aggregated) or a dimension (field that categorizes measures, used typically as sort fields in a chart request).

Some attribute categories can only be assigned to sort fields, some can only be assigned to measures, and some can be assigned to either.

The order of sort fields in the request and the type of chart being generated determine the category to which each field can be assigned.

The assignment of fields to attribute categories replaces the GRMERGE, GRMULTIGRAPH, GRLEGEND, and GRXAXIS parameters for merging charts. For information about converting requests with merge parameters to chart attribute syntax, see Converting Requests to Chart Attribute Syntax.

Syntax: How to Assign Chart Data to Attribute Categories

TYPE=DATA, COLUMN=colspec, bucket=category,$

where:

COLUMN=colspec

Is any valid column reference in a WebFOCUS StyleSheet.

For example, COLUMN=N1 represents the first column of output. This is usually the high-order BY field, as described in Understanding Column Sequence Numbers. Alternatively, you can specify the field name, for example, COLUMN=PRODUCT_CATEGORY. For information about WebFOCUS StyleSheet syntax, see the Creating Reports With WebFOCUS Language manual.

bucket=category

Describes the role this field is assigned in the chart.

Valid attribute category values vary by chart type. The list of all categories follows:

  • row assigns the field values to rows in a matrix or grid.
  • column assigns the field values to columns in a matrix or grid.
  • color assigns a field to the legend. If it is a measure, it generates a gradient legend.
  • measure assigns the field values as data values on the chart, not associated with an axis (as in a pie chart).
  • y-axis assigns the field values to the vertical axis (if you are using the default value for CHART-SERIES LAYOUT).
  • x-axis assigns the field values to the horizontal axis (if you are using the default value for CHART-SERIES LAYOUT).
  • size assigns the field values to the size of the markers (bubble charts) or to a size-by field.
  • tooltip adds the field values to the tooltip, All fields in the request are also part of the tooltip.
  • detail assigns the field values to an additional low level sort field, which generates additional data points. You must add this field as the lowest sort field in the request.
  • slider assigns the field values to a slider control. A slider creates an animation effect as you move the control along the slider bar. It is limited to one sort field only and should preferably be something time or sequence related such as YEAR.
  • page assigns the field values to independent pages (separate charts). The page attribute category can be used for bursting and distributing with ReportCaster.
  • latitude assigns the field values to the latitudes at which to display the symbols on bubblemap charts. This attribute corresponds to the y-axis attribute in a bubble chart.
  • longitude assigns the field values to the longitudes at which to display the symbols on bubblemap charts. This attribute corresponds to the x-axis attribute in a bubble chart.
  • location assigns the field values as the location values for the colored polygons on a choropleth or the symbols on a bubblemap.

Some attribute categories can be omitted, if you do not want them on the chart output or if they do not apply to the type of chart being created. Some attribute categories can be assigned to multiple fields in the request (for example, multiple fields assigned to the y-axis in bar or line charts).

Example: Generating Chart Pages

The following request generates a separate bar chart for each business region. The BUSINESS_REGION field is added as the first sort field and is assigned to the page category. The business region value is also added to the heading, which is embedded in the chart:

GRAPH FILE WF_RETAIL_LITE
HEADING
"Business Region: <BUSINESS_REGION " 
SUM COGS_US
BY BUSINESS_REGION   
BY BUSINESS_SUB_REGION
BY PRODUCT_CATEGORY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET EMBEDHEADING ON   
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$
TYPE=DATA, COLUMN=COGS_US, BUCKET=y-axis, $
TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=X-AXIS, $
TYPE=DATA, COLUMN=BUSINESS_REGION, BUCKET=page,$
TYPE=DATA, COLUMN = BUSINESS_SUB_REGION, BUCKET=color,$
ENDSTYLE
END

The output is shown in the following image. A separate chart is generated for each business region:

Instead of adding a heading to indicate the business region, you can add the field to the tooltip category as well as the page category. For information and an example, see Assigning a Field to Mulitple Attribute Categories.

Assigning Field Order Within a Category

Some categories can have multiple fields assigned to them. By default, the fields are assigned to a category in the order in which the assignments appear in the StyleSheet. For example, the first y-axis field assigned becomes the leftmost measure in a vertical bar chart. If you want to specify the order in which the fields should be assigned to the category, use an index number suffix. For example, using the following declarations, UNITS will come first regardless of its order in the request, since its suffix (.1) is explicitly set to be lower than that of BUDUNITS (.2):

type=data, column=budunits, bucket=y-axis.2, $
type=data, column=units, bucket=y-axis.1, $

Example: Specifying Field Order

The following request generates a bar chart. the bars represent the GROSS_PROFIT_US and REVENUE_US measures. The bar representing GROSS_PROFIT_US is first because the StyleSheet declarations specify GROSS_PROFIT_US before REVENUE_US:

GRAPH FILE WF_RETAIL_LITE
SUM 
GROSS_PROFIT_US 
REVENUE_US
BY PRODUCT_CATEGORY  
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$
type=data, column=product_category, bucket=x-axis, $
type=data, column=gross_profit_us, bucket=y-axis, $
type=data, column=revenue_us, bucket=y-axis, $
ENDSTYLE 
END

The output is shown in the following image:

The following version of the request displays the bars for REVENUE_US first by adding a .1 suffix to the attribute category for the REVENUE_US field:

GRAPH FILE WF_RETAIL_LITE
SUM 
GROSS_PROFIT_US 
REVENUE_US
BY PRODUCT_CATEGORY  
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$
type=data, column=product_category, bucket=x-axis, $
type=data, column=gross_profit_us, bucket=y-axis, $
type=data, column=revenue_us, bucket=y-axis.1, $
ENDSTYLE 
END

The output is shown in the following image:

Specifying Multiple Y-Axes

An attribute category can have a subscript, enclosed in parentheses, if there is more than one version of it. For example, to indicate the y2-axis, use the following:

y-axis(2) 

Any number of y-axes can be specified using subscripts.

A category can have both a subscript and a suffix. For example, to indicate the first field in the y2-axis category, use the following:

y-axis(2).1

Example: Generating Split Y-Axes

The following request assigns the measure DISCOUNT_US to the y-axis, the measures GROSS_PROFIT_US and MSRP_US to the y2-axis, and the measure REVENUE_US to the y3-axis. The axes are drawn as split y-axes (stacked on top of each other) because the blaProperties:splitY property is set to true:

GRAPH FILE WF_RETAIL_LITE
SUM DISCOUNT_US GROSS_PROFIT_US REVENUE_US MSRP_US
BY PRODUCT_CATEGORY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$
type=data, column=product_category, bucket=x-axis,$
type=data, column=discount_us, bucket=y-axis,$
type=data, column=GROSS_PROFIT_US, bucket=y-axis(2),$
type=data, column=MSRP_US, bucket=y-axis(3),$
type=data, column=REVENUE_US,  bucket=y-axis(2),$
*GRAPH_JS
"blaProperties": {"splitY": true},
"legend": {"visible": false}
*END
ENDSTYLE
END

The output is shown in the following image:

Assigning a Field to Multiple Attribute Categories

To assign a field to multiple attribute categories, enclose the list of categories in parentheses and separate them with a blank space:

TYPE=DATA, COLUMN=colspec, bucket=(category1 category2 ...),$

For example, the following declaration adds a field to both the page and tooltip categories:

TYPE=DATA, COLUMN=N1, BUCKET=(page tooltip),$

Example: Assigning a Field to the Page and Tooltip Categories

The following request generates a separate bar chart for each business region. The BUSINESS_REGION field is added as the first sort field and is assigned to the page and tooltip categories:

GRAPH FILE WF_RETAIL_LITE
SUM COGS_US
BY BUSINESS_REGION
BY BUSINESS_SUB_REGION
BY PRODUCT_CATEGORY
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$
TYPE=DATA, COLUMN=COGS_US, BUCKET=y-axis, $
TYPE=DATA, COLUMN=BUSINESS_SUB_REGION, BUCKET=color, $
TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=x-axis, $
TYPE=DATA, COLUMN=BUSINESS_REGION, BUCKET=(page tooltip),$
ENDSTYLE
END

The following image shows that the business region generates a new page and has been added to the tooltip:

WebFOCUS

Feedback