Topics: |
Chart attribute syntax uses WebFOCUS StyleSheet attributes to assign roles to dimensions and measures in an HTML5 request. Using this syntax, you can generate chart types that are not available without it, and display multiple charts in a matrix array. This syntax also uses a simplified list of chart types and provides the ability to add sliders, pages, and additional detail to charts.
TYPE=DATA declarations in a WebFOCUS StyleSheet assign the fields in a request to attribute categories. Some examples of attribute categories are x-axis, y-axis, size, and color. For example, to assign the PRODUCT_CATEGORY field to the x-axis category, the syntax is:
TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=x-axis, $
The attribute categories available for a request vary depending on the chart type.
For complete information about chart attribute syntax, see the Creating HTML5 Charts With WebFOCUS Language manual.
The following request generates a bar chart. The sort field (PRODUCT_CATEGORY) is assigned to the x-axis, and both measures (COGS_US and GROSS_PROFIT_US) are assigned to the y-axis. The chart type is BAR.
GRAPH FILE WF_RETAIL_LITE SUM COGS_US GROSS_PROFIT_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=COGS_US, BUCKET=y-axis, $ TYPE=DATA, COLUMN=GROSS_PROFIT_US, BUCKET=y-axis, $ TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=x-axis, $ ENDSTYLE END
The output is shown in the following image:
Chart attribute syntax introduces the following new chart types:
The following request generates a matrix of bar charts.
GRAPH FILE WF_RETAIL_LITE SUM COGS_US GROSS_PROFIT_US BY TIME_DAYNAME BY BUSINESS_REGION BY PRODUCT_CATEGORY WHERE TIME_DAYNAME EQ 'FRI' OR 'MON' WHERE BUSINESS_REGION NE 'Oceania' 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=TIME_DAYNAME, BUCKET=row, $ TYPE=DATA, COLUMN=BUSINESS_REGION, BUCKET=column, $ TYPE=DATA, COLUMN=COGS_US, BUCKET=y-axis, $ TYPE=DATA, COLUMN=GROSS_PROFIT_US, BUCKET=y-axis, $ TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=x-axis, $ ENDSTYLE END
The output is shown in the following image.
The following request generates a matrix marker chart.
GRAPH FILE WF_RETAIL_LITE SUM COGS_US GROSS_PROFIT_US BY PRODUCT_CATEGORY BY BUSINESS_REGION WHERE BUSINESS_REGION NE 'Oceania' WHERE PRODUCT_CATEGORY LE 'D' ON GRAPH PCHOLD FORMAT JSCHART ON GRAPH SET LOOKGRAPH MARKER ON GRAPH SET STYLE * TYPE=DATA, COLUMN=COGS_US, BUCKET=color, $ TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=row, $ TYPE=DATA, COLUMN=BUSINESS_REGION, BUCKET=column, $ TYPE=DATA, COLUMN=GROSS_PROFIT_US, BUCKET=size, $ ENDSTYLE END
The output is shown in the following image.
The following request generates a data grid with default column totals (sums).
GRAPH FILE WF_RETAIL_LITE SUM COGS_US GROSS_PROFIT_US BY PRODUCT_CATEGORY BY PRODUCT_SUBCATEG BY TIME_QTR BY BUSINESS_REGION WHERE (BUSINESS_REGION NE 'Oceania' OR 'EMEA') AND (TIME_QTR EQ 1 OR 2) ON GRAPH PCHOLD FORMAT JSCHART ON GRAPH SET LOOKGRAPH DATAGRID ON GRAPH SET AUTOFIT ON ON GRAPH SET STYLE * type=data, column=product_category, bucket=row, $ type=data, column=product_subcateg, bucket=row, $ type=data, column=time_qtr, bucket=column, $ type=data, column=business_region, bucket=column, $ type=data, column=cogs_us, bucket=measure, $ type=data, column=gross_profit_us, bucket=measure, $ *GRAPH_JS dataGridProperties: { columnTotals:{visible:true} } *END ENDSTYLE END
The output is shown in the following image.
Chart attribute syntax lets you add additional fields to a request and, depending on the chart type, assign them to the color, size, slider, and detail attribute categories.
The following request generates a line chart with size-by and color-by fields.
DEFINE FILE WF_RETAIL_LITE
SIZE1 WITH WF_RETAIL_SALES.COGS_US =
IF WF_RETAIL_TIME_SALES.TIME_YEARQTR LT 200902 THEN 5
ELSE IF WF_RETAIL_TIME_SALES.TIME_YEARQTR LT 200903 THEN 50
ELSE 200;
END
GRAPH FILE WF_RETAIL_LITE
SUM COGS_US GROSS_PROFIT_US MSRP_US SIZE1
BY WF_RETAIL_TIME_SALES.TIME_YEARQTR
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH LINE
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/combine_templates/ENWarm.sty,$
TYPE=DATA, COLUMN=WF_RETAIL_TIME_SALES.TIME_YEARQTR, BUCKET=x-axis, $
TYPE=DATA, COLUMN=COGS_US, BUCKET=y-axis, $
TYPE=DATA, COLUMN=GROSS_PROFIT_US, BUCKET=y-axis, $
TYPE=DATA, COLUMN=MSRP_US, BUCKET=color, $
TYPE=DATA, COLUMN=SIZE1, BUCKET=size, $
*GRAPH_JS
series: [
{series:0, marker: {visible:false}},
{series:1, marker: {visible:true, shape:'circle'}}
]
*END
ENDSTYLE
END
The output is shown in the following image.
The following request generates a scatter chart with an additional detail sort field.
GRAPH FILE WF_RETAIL_LITE SUM COGS_US REVENUE_US BY PRODUCT_CATEGORY ON GRAPH PCHOLD FORMAT JSCHART ON GRAPH SET LOOKGRAPH SCATTER 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=REVENUE_US, BUCKET=x-axis, $ TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=color, $ ENDSTYLE END
The output is shown in the following image.
The following request generates a chart with a slider control.
GRAPH FILE WF_RETAIL_LITE SUM DISCOUNT_US BY WF_RETAIL_TIME_SALES.TIME_YEARQTR BY BUSINESS_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=DISCOUNT_US , BUCKET=y-axis, $ TYPE=DATA, COLUMN=BUSINESS_REGION, BUCKET=color, $ TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=x-axis, $ TYPE=DATA, COLUMN=WF_RETAIL_TIME_SALES.TIME_YEARQTR, BUCKET=slider, $ ENDSTYLE END
The output is shown in the following image.
In addition, you can generate separate chart pages using the page attribute category and add fields to the tooltip using the tooltip category.
For complete information about chart attribute syntax, see the Creating HTML5 Charts With WebFOCUS Language manual.
WebFOCUS | |
Feedback |