Converting Bar, Line, and Area Chart Requests to Chart Attribute Syntax

Reference:

Traditional bar, line, and area charts have separate LOOKGRAPH parameter values for vertical and horizontal orientations and for side-by-side, stacked, absolute, and percent layouts.

With chart attribute syntax, one LOOKGRAPH value is used for all layouts and orientations of the same type of chart, and the layout and orientation are specified in the TYPE=REPORT declaration of the WebFOCUS StyleSheet.

For bar, line, and area charts, you must convert the LOOKGRAPH parameter to the correct value, make sure the orientation and layout are assigned correctly in the WebFOCUS StyleSheet, and assign the measures and sort fields to the correct attribute categories.

Note that chart attribute syntax clusters similar x-axis values together, so the output looks different from the output generated by the GRMERGE syntax, in which the combinations of sort field values on the x-axis are not clustered.

Reference: LOOKGRAPH Conversions for Bar Charts

The following table lists the traditional LOOKGRAPH values and the new LOOKGRAPH values along with the new CHART-ORIENTATION and CHART-SERIES-LAYOUT values.

LOOKGRAPH Parameter Values

TYPE=REPORT StyleSheet Attributes

Traditional

Convert to

CHART-ORIENTATION

CHART-SERIES-LAYOUT

HBAR

BAR

horizontal

side-by-side (default)

VBAR, BAR

BAR

vertical (default)

side-by-side (default)

HBRSTK1

BAR

horizontal

stacked

VBRSTK1, STACK

BAR

vertical (default)

stacked

HBRSTKPC

BAR

horizontal

percent

VBRSTKPC

BAR

vertical (default)

percent

Reference: LOOKGRAPH Conversions for Line Charts

The following table lists the traditional LOOKGRAPH values and the new LOOKGRAPH values along with the new CHART-ORIENTATION and CHART-SERIES-LAYOUT values.

LOOKGRAPH Parameter Values

TYPE=REPORT StyleSheet Attributes

Traditional

Convert to

CHART-ORIENTATION

CHART-SERIES-LAYOUT

HLINE

LINE

horizontal

absolute (default)

VLINE, LINE

LINE

vertical (default)

absolute (default)

HLINSTK

LINE

horizontal

stacked

VLINSTK

LINE

vertical (default)

stacked

HLNSTKPC

LINE

horizontal

percent

VLNSTKPC

LINE

vertical (default)

percent

Reference: LOOKGRAPH Conversions for Area Charts

The following table lists the traditional LOOKGRAPH values and the new LOOKGRAPH values along with the new CHART-ORIENTATION and CHART-SERIES-LAYOUT values.

LOOKGRAPH Parameter Values

TYPE=REPORT StyleSheet Attributes

Traditional

Convert to

CHART-ORIENTATION

CHART-SERIES-LAYOUT

HAREA

AREA

horizontal

absolute (default)

VAREA

AREA

vertical (default)

absolute (default)

HAREASTK

AREA

horizontal

stacked

VAREATK

AREA

vertical (default)

stacked

HARESTKP

AREA

horizontal

percent

VARESTKP

AREA

vertical (default)

percent

Reference: Attribute Category Assignments for Bar, Line, and Area Charts

The following table lists the attribute category conversions for bar, line, and area charts.

Type of Column or Parameter

Attribute Category

measure field

y-axis

GRXAXIS sort field

x-axis

GRLEGEND sort field

color

GRMULTIGRAPH sort field

page

Example: Converting a Bar Chart Request to Chart Attribute Syntax

The following example generates a vertical bar chart that separates the outermost sort field (BRANDTYPE) onto separate charts, distinguishes the next two sort fields (BRAND and PRODUCT_CATEGORY) by combining them on the graph legend, and places the PRODUCT_SUBCATEG sort field on the x-axis:

GRAPH FILE WF_RETAIL_LITE
SUM REVENUE_US
BY BRANDTYPE 
BY BRAND 
BY PRODUCT_CATEGORY 
ACROSS PRODUCT_SUBCATEG
WHERE PRODUCT_SUBCATEG EQ 'Blu Ray' OR 'Smartphone' OR 'DVD Players' OR
'Headphones' 
ON GRAPH SET GRMERGE ADVANCED   
ON GRAPH SET GRMULTIGRAPH 1    
ON GRAPH SET GRLEGEND 2     
ON GRAPH SET GRXAXIS 1     
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH PCHOLD FORMAT JSCHART
END

The output is shown in the following image:

The following is the same request converted to chart attribute syntax. The BRANDTYPE sort field is assigned to the page category, the BRAND and PRODUCT_CATEGORY sort fields are assigned to the color category, the PRODUCT_SUBCATEG sort field is assigned to the x-axis category, and the REVENUE_US measure is assigned to the y-axis category. The ACROSS phrase is changed to a BY phrase, and the chart type is BAR:

GRAPH FILE WF_RETAIL_LITE
HEADING CENTER
"Brand Type = <BRANDTYPE"
SUM REVENUE_US
BY BRANDTYPE
BY BRAND 
BY PRODUCT_CATEGORY 
BY PRODUCT_SUBCATEG
WHERE PRODUCT_SUBCATEG EQ 'Blu Ray' OR 'Smartphone' OR 'DVD Players' OR
'Headphones'
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET EMBEDHEADING ON 
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=BRANDTYPE, BUCKET=page,$
TYPE=DATA, COLUMN=BRAND, BUCKET=COLOR,$
TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=color,$
TYPE=DATA, COLUMN=PRODUCT_SUBCATEG, BUCKET=x-axis,$
TYPE=DATA, COLUMN=REVENUE_US, BUCKET=y-axis,$
END

The output shown in the following image looks different from the GRMERGE output, since chart attribute syntax clusters similar x-axis values together. For example, the media players from all of the brands are displayed as one cluster of bars:

Example: Converting a Stacked Bar Chart Request to Chart Attribute Syntax

The following request generates multiple stacked bar charts. A new chart is generated for each value of BRANDTYPE (the GRMULTIGRAPH field), the field PRODUCT_CATEGORY is the GRLEGEND field, and the field BRAND is the GRXAXIS field:

GRAPH FILE WF_RETAIL_LITE
SUM REVENUE_US 
BY BRANDTYPE 
BY PRODUCT_CATEGORY 
ACROSS BRAND 
ON GRAPH SET AUTOFIT ON    
ON GRAPH SET GRMERGE ADVANCED   
ON GRAPH SET GRMULTIGRAPH 1  
ON GRAPH SET GRLEGEND 1   
ON GRAPH SET GRXAXIS 1    
ON GRAPH SET LOOKGRAPH VBRSTK1
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$
ENDSTYLE
END

The output is shown in the following image:

The following is the same request converted to chart attribute syntax. The CHART-SERIES-LAYOUT is stacked. The measure REVENUE_US is assigned to the y-axis category, the BRANDTYPE sort field is assigned to the page category, the PRODUCT_CATEGORY sort field is assigned to the color category, and the BRAND sort field is assigned to the x-axis category. The ACROSS sort phrase from the original request is changed to a BY sort phrase. The chart type is BAR:

GRAPH FILE WF_RETAIL_LITE
HEADING CENTER
"<BRANDTYPE"
SUM REVENUE_US 
BY BRANDTYPE
BY PRODUCT_CATEGORY 
BY BRAND 
ON GRAPH SET LOOKGRAPH BAR
ON GRAPH SET AUTOFIT ON
ON GRAPH SET EMBEDHEADING ON 
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$
type=report, chart-series-layout=stacked,$
type=data, column=brandtype, bucket=page,$
type=data, column=brand, bucket=x-axis,$
type=data, column=product_category, bucket=color,$
type=data, column=revenue_us, bucket=y-axis,$
END

The output is shown in the following image:

WebFOCUS

Feedback