How to: |
The trendline properties draw a trendline and equation label for individual series in bubble and scatter charts.
Note: You can also draw a trendline for all series using the global trendline property. For information, see Drawing Trendlines in Bubble and Scatter Charts (trendline).
"series": [ { "series": number, "trendline": { "enabled": boolean, "mode": "string", "order": number, "lineStyle": { "width": number, "color": "string", "dash": "string" }, "equationLabel": { "visible": boolean, "font": "string", "color": "string", "mode": "string" } } } ]
where:
Is a zero-based series number. If the series does not exist in the chart, the property is ignored.
Enables or disables the trendline. Valid values are:
Is string that defines the trendline mode (the type of equation used to generate the trendline). Valid values are:
Applies to polynomial mode. Specifies the degree of the polynomial. The default value is 3.
Defines the properties of the trendline.
Defines the width of the trendline in pixels. The default value is 1.
Is a color specification string that defines the color of the trendline. The default value is undefined, which uses the series color for the trendline color.
Is a string that defines the dash style of the trendline. Specify the length of a dash in pixels followed by the number of pixels between dashes (for example, "1 1", which generates a dotted line). The default value is no dash ("").
Controls the visibility of the equation label. Valid values are:
Is a string that defines the size, style, and typeface of the equation label. The default value is "8pt Sans-Serif".
Is a color defined by a color name or numeric specification string. The default value is "black".
Is a string that defines the equation label mode. Valid values are:
The following request generates a scatter chart with a linear trendline for series 2:
GRAPH FILE WF_RETAIL_LITE SUM DISCOUNT_US GROSS_PROFIT_US REVENUE_US BY BRAND ON GRAPH PCHOLD FORMAT JSCHART ON GRAPH SET LOOKGRAPH SCATTERS ON GRAPH SET STYLE * *GRAPH_JS "series": [ {"series": 0, "color": "red"}, {"series": 1, "color": "green"}, {"series": 2, "color": "blue", "trendline": {"enabled": true, "mode": "linear" }}] *END ENDSTYLE END
The output is:
The following version of the request adds a purple equation label:
GRAPH FILE WF_RETAIL_LITE
SUM DISCOUNT_US GROSS_PROFIT_US REVENUE_US
BY BRAND
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH SCATTERS
ON GRAPH SET STYLE *
*GRAPH_JS
"series": [
{"series": 0, "color": "red"},
{"series": 1,"color": "green"},
{"series": 2, "color": "blue", "trendline": {
"enabled": true, "mode": "linear", "equationLabel": {
"visible": true, "color": "purple"}}}]
*END
ENDSTYLE
END
The output is:
The following request styles the trendline to be two pixels wide, red, and dashed.
GRAPH FILE WF_RETAIL_LITE
SUM DISCOUNT_US
BY BRAND
ON GRAPH PCHOLD FORMAT JSCHART
ON GRAPH SET LOOKGRAPH SCATTER
ON GRAPH SET STYLE *
INCLUDE=IBFS:/FILE/IBI_HTML_DIR/ibi_themes/Warm.sty,$
TYPE=DATA, COLUMN=BRAND, BUCKET=x-axis,$
TYPE=DATA, COLUMN=DISCOUNT_US , BUCKET=y-axis,$
*GRAPH_JS
"series": [
{"series": 0, "color": "blue", "trendline": {"enabled": true,
"mode": "polynomial", "order": 3,
"lineStyle": {"width": 2, "color": "red", "dash": "2 4"},
}}]
*END
ENDSTYLE
END
The output is shown in the following image.
WebFOCUS | |
Feedback |