Applying Gradient Fill (All Graph Types)

How to:

You can apply a color gradient pattern and direction to any object or text in a graph.


Top of page

x
Procedure: How to Apply Gradient Fill
  1. From the Graph Editor, select Apply Gradient Fill to apply a gradient to an area object in a chart. The following dialog box appears:

    Apply Gradient Fill options

  2. Select a gradient fill pattern (for example, Blue to Black, Blue Tube, Red Tube) and direction (Right, Left, Down, Up, and so on.).
  3. Select an object in the chart.
  4. Select the Apply Gradient Fill button to apply the gradient fill to the object in the graph. Gradients can be applied to any object in the chart (including text objects).

Top of page

x
Syntax: How to Add Properties and Methods for Applying Gradient Fill

The selections in this dialog add the following properties and methods to the code that defines this chart:

setFillType(aGetObjectIDMethod (), 2);
setGradientDirection(aGetObjectIDMethod (), value);
setGradientNumPins(aGetObjectIDMethod (), value);
setGradientPinLeftColor(aGetObjectIDMethod (),new 
Color(value,value,value), value);
setGradientPinLeftColor(aGetObjectIDMethod (),new 
Color(value,value,value), value);
setGradientPinPosition(aGetObjectIDMethod (),value,value);
setGradientPinPosition(aGetObjectIDMethod (),value,value);
setGradientPinRightColor(aGetObjectIDMethod (),new Color (value, value, value), value);
setGradientPinRightColor(aGetObjectIDMethod (), new  Color (value, value, value), value);

Note: The aGetObjectIDMethod() is a notation convention used in this document to indicate one of the methods that returns an object ID. The Editor chooses the appropriate method based on the object that is selected in the chart. For example, the getO1Label() method is used if the O1 Axis Label is selected in the chart.



Example: Applying Properties for Gradient Fill

The following methods select the background object in the chart and assign the "Sunset" gradient to the object in the Radial, Center, Top direction.

setFillType(getBackgrnd(),2);
setGradientDirection(getBackgrnd(),10);
setGradientNumPins(getBackgrnd(),2);
setGradientPinLeftColor(getBackgrnd(),new Color(255,0,0),1);
setGradientPinLeftColor(getBackgrnd(),new Color(0,0,255),0);
setGradientPinPosition(getBackgrnd(),1.0,1);
setGradientPinPosition(getBackgrnd(),0.0,0);
setGradientPinRightColor(getBackgrnd(),new Color(255,0,0),1);
setGradientPinRightColor(getBackgrnd(),new Color(0,0,255),0);

WebFOCUS