Swapping Series, Group, and Label Orientation

How to:

The swapDataAndLabels property can be used to swap series and group orientation, and to swap the labels as well. When false (the default), values in a row in a data set are represented as series. It is the same as the swapData property, except it also swaps the series and group labels. When true, values in a column are represented as series.

Syntax: How to Swap Series and Group Orientation and Their Labels

"swapDataAndLabels": boolean

where:

"swapDataAndLabels": boolean

Can be:

true, which swaps the series, group, and label orientation.

false, which does not swap the series, group, and label orientation. This is the default value.

Example: Swapping Series, Group, and Label Orientation

The following request generates a vertical bar chart:

GRAPH FILE WF_RETAIL_LITE
SUM COGS_US GROSS_PROFIT_US REVENUE_US DISCOUNT_US
ACROSS TIME_DAYNAME
WHERE TIME_DAYNAME EQ 'FRI' OR 'SAT' OR 'SUN' OR 'MON'
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH VBAR
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$
*GRAPH_JS
"swapDataAndLabels": false,
"series": [
	{"series": 0, "color": "lightgreen"},
	{"series": 1, "color": "coral"},
	{"series": 2, "color": "lightblue"},
	{"series": 3, "color": "burlywood"}
	]
*END
ENDSTYLE
END

On the output:

  • The first set of bars represents all series (COGS_US, GROSS_PROFIT_US, REVENUE_US, and DISCOUNT_US) values for the first group value (day name FRI).
  • The second set of bars represents all series values for the second group value (day name SAT).
  • The third set of bars represents all series values for the third group value (day name SUN).
  • The fourth set of bars represents all series values for the third group value (day name MON).

Changing the swapDataAndLabels property to "true" generates the following chart, in which:

  • The first set of bars represents COGS_US (series 0) for each day name (group) value.
  • The second set of bars represents GROSS_PROFIT_US (series 1) for each day name (group) value.
  • The third set of bars represents REVENUE_US (series 2) for each day name (group) value.
  • The fourth set of bars represents DISCOUNT_US (series 3) for each day name (group) value.

The labels have also been swapped, to represent the new orientation:

WebFOCUS

Feedback