How to: |
Color binding enables you to associate (bind) BY field values to particular colors so that the same value will appear in the same color on different charts, regardless of the sequence or filter conditions. The BY field for which color binding is specified must be assigned to the color attribute category. For example, if the BY field is COUNTRY, that field should be assigned to the color attribute category. Then you can specify that the value France of the COUNTRY field should be red in every chart on every page of a report. The legend markers will also be bound to these colors.
type=data, marker-color=color, when=field eq value, $
where:
Specifies a color for the chart and legend marker when the condition in the WHEN phrase is satisfied. Color names, RGB color values, and hex color values are supported.
Is the name of the BY field that is assigned to the color attribute category whose values will be bound to specific colors.
Is the value that is bound to the color specified by the marker-color attribute.
The following request binds the field values of the PRODUCT_CATEGORY field to specific colors.
GRAPH FILE WF_RETAIL_LITE SUM COGS_US BY PRODUCT_CATEGORY BY BUSINESS_REGION 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/ibi_themes/Warm.sty,$ TYPE=DATA, COLUMN=BUSINESS_REGION, BUCKET=X-AXIS, $ TYPE=DATA, COLUMN=COGS_US, BUCKET=y-axis, $ TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=COLOR, $ TYPE=DATA, MARKER-COLOR=red, WHEN=PRODUCT_CATEGORY EQ 'Accessories',$ TYPE=DATA, MARKER-COLOR=orange, WHEN=PRODUCT_CATEGORY EQ 'Camcorder',$ TYPE=DATA, MARKER-COLOR=yellow, WHEN=PRODUCT_CATEGORY EQ 'Computers',$ TYPE=DATA, MARKER-COLOR=green, WHEN=PRODUCT_CATEGORY EQ 'Media Player',$ TYPE=DATA, MARKER-COLOR=blue, WHEN=PRODUCT_CATEGORY EQ 'Stereo Systems',$ TYPE=DATA, MARKER-COLOR=purple, WHEN=PRODUCT_CATEGORY EQ 'Televisions',$ TYPE=DATA, MARKER-COLOR=gray, WHEN=PRODUCT_CATEGORY EQ 'Video Production',$ ENDSTYLE END
The following version of the request binds the field values of the PRODUCT_CATEGORY field to the same colors, but filters out the product categories that start with the letter C.
GRAPH FILE WF_RETAIL_LITE SUM COGS_US BY PRODUCT_CATEGORY BY BUSINESS_REGION WHERE PRODUCT_CATEGORY NOT LIKE 'C%' 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/ibi_themes/Warm.sty,$ TYPE=DATA, COLUMN=BUSINESS_REGION, BUCKET=X-AXIS, $ TYPE=DATA, COLUMN=COGS_US, BUCKET=y-axis, $ TYPE=DATA, COLUMN=PRODUCT_CATEGORY, BUCKET=COLOR, $ TYPE=DATA, MARKER-COLOR=red, WHEN=PRODUCT_CATEGORY EQ 'Accessories',$ TYPE=DATA, MARKER-COLOR=orange, WHEN=PRODUCT_CATEGORY EQ 'Camcorder',$ TYPE=DATA, MARKER-COLOR=yellow, WHEN=PRODUCT_CATEGORY EQ 'Computers',$ TYPE=DATA, MARKER-COLOR=green, WHEN=PRODUCT_CATEGORY EQ 'Media Player',$ TYPE=DATA, MARKER-COLOR=blue, WHEN=PRODUCT_CATEGORY EQ 'Stereo Systems',$ TYPE=DATA, MARKER-COLOR=purple, WHEN=PRODUCT_CATEGORY EQ 'Televisions',$ TYPE=DATA, MARKER-COLOR=gray, WHEN=PRODUCT_CATEGORY EQ 'Video Production',$ ENDSTYLE END
Both charts are shown in the following image. Note that, although Media Player is represented by the fourth riser on chart 1 and the second riser on chart 2, it is green on both charts.
WebFOCUS | |
Feedback |