In this section: |
You can include API calls in WebFOCUS procedures to create dynamic, sophisticated graphs that showcase your business data.
If you save a graph generated by a WebFOCUS procedure in Scalable Vector Graphics (SVG) or Portable Network Graphics (PNG) format, you can produce a high quality image for display or print, with advanced features provided by the API calls.
The setAutoHideDataTextOnSmallRisers property, when enabled, suppresses the display of data text if the height of the riser is smaller than the height of the data text.
Syntax:
void setAutoHideDataTextOnSmallRisers(boolean);
boolean = getAutoHideDataTextOnSmallRisers();
where:
Can be one of the following:
Suppresses the display of data text that is larger than its riser.
Displays all data text regardless of the height of the riser. This value is the default.
Example:
setAutoHideDataTextOnSmallRisers(true);
With setAutoHideDataTextOnSmallRisers(true), the risers that are too small for data text do not have any text in them.
setAutoHideDataTextOnSmallRisers(false);
With setAutoHideDataTextOnSmallRisers(false), the risers that are too small for data text still have the text in them. The text in the small risers overwrites text from other risers.
The setAltFmtMatchAxisLabelColor property controls whether Y-axis Labels associated with the alternate frame region inherit the color specified for that region. When enabled, the labels are colored with the color specified for the region. When disabled, labels are displayed using the default color.
Syntax:
void setAltFmtMatchAxisLabelColor(boolean);
boolean = getAltFmtMatchAxisLabelColor();
where:
Can be one of the following:
Causes Y-axis labels to inherit the color of alternate frame regions.
Causes Y-axis labels to use the default color. This value is the default.
Example:
The following request sets the setAltFmtMatchAxisLabelColor property to true:
setDisplay(getY1AltFmtFrame(),true);
setAltFmtFrameNumColors(getY1AltFmtFrame(),2);
setAltFmtFrameSeparator(getY1AltFmtFrame(0),80.0);
setFillColor(getY1AltFmtLabel(0),new Color(0,0,0));
setFillColor(getY1AltFmtFrame(1),new Color(255,0,0));
setReferenceLineValueY1(0,80.0);
setLineWidth(getReferenceLineY1(0),2);
setFillColor(getY1AltFmtFrame(0),new Color(232,232,232));
setAltFmtMatchAxisLabelColor(true);
With setAltFmtMatchAxisLabelColor(true), the Y-axis labels inherit the color red when the alternate frame region is red and inherit the color grey when the alternate frame region is grey.
Changing setAltFmtMatchAxisLabelColor() to false, causes the Y-axis labels to use the default color, not the colors of the alternate frame regions.
setAltFmtMatchAxisLabelColor(false);
How to: |
There are two methods you can use to automatically render the color and style of graph risers:
You can automatically shade groups of risers by lightening or darkening the color values in each successive group. You implement this type of shading by setting the color mode to 4, setting a looping index equal to the number of risers in each group, and setting an automatic color lightening or darkening factor:
setColorMode(4); setSeriesLooping(s); setAutoColorLerpFactor(f);
where:
Implements automatic repeated riser shading.
Identifies the number of risers in each group on the graph.
Is a double-precision number between -1 and 1 that represents the factor for lightening or darkening each successive group of risers. A positive factor specifies that each successive group of risers will be lighter than the previous group. A negative number specifies that each successive group of risers will be darker than the previous group. Zero indicates that each successive group of risers will be shaded exactly the same as the previous group.
The following implements repeated lightening of groups of risers. It sets the color mode to 4, the series looping index to 5, and the automatic color factor to 1:
-*Autoshade base on every 5 series setColorMode(4); setSeriesLooping(5); setAutoColorLerpFactor(1); -*
ENDSTYLE ON GRAPH SET STYLE * INCLUDE=IBFS:/CFG/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$ ENDSTYLE END
On the output, the riser colors repeat after five car values because the looping index is 5:
You can automatically create a gradient color effect between the risers in a graph. You implement this type of coloring by setting the color mode to 5, setting a starting color for the gradient, and setting an ending color for the gradient:
setColorMode(5); setAutoColorGradientStartColor({Color.start_color|new Color(r1,g1,b1)}); setAutoColorGradientEndColor({Color.end_color|new Color(r2,g2,b2)});
where:
Implements automatic gradient riser shading.
Identifies the starting color for the gradient.
Is the code for the red, green, and blue components of the starting color.
Identifies the ending color for the gradient.
Is the code for the red, green, and blue components of the ending color.
The following implements automatic gradient riser coloring. It sets the color mode to 5, the start color to dark gray (192,192,192) and the end color to green (25,92,92):
-*Gradient effect setColorMode(5); setAutoColorGradientStartColor(new Color(192,192,192)); setAutoColorGradientEndColor(new Color(25,92,92)); -*
ENDSTYLE ON GRAPH SET STYLE * INCLUDE=IBFS:/CFG/FILE/IBI_HTML_DIR/javaassist/intl/EN/ENIADefault_combine.sty,$ ENDSTYLE END
On the output, the riser colors form a gradient from the start color (dark gray) to the end color (green):
You can customize text that appears in a ToolTip when hovering over chart risers.
Graph functionality has been enhanced to allow setting the color of the HTML page that surrounds the image directly from the graph procedure.
GIF graph images can be embedded into a PDF document by using output format PDF/GIF.
WebFOCUS |