SetGradient Method
The SetGradient method is used to set the gradient fill to custom colors. Use the Name property to set the gradient to a predefined color gradient.
Syntax
object.SetGradient(Stops, Colors, Opacity)
Parameter | Type | Description |
Stops | Variant | required, percent locations in the color gradient for each custom color |
Colors | Variant | required, Grapher color namesor RGB color combination |
Opacity | Variant | required, percent transparency for this color stop |
Example
This example shows how to set the gradient to custom colors for a rectangle.
'Set up percent stops gradient
Dim Array1(6) As Double
Array1(0) = 0
Array1(1) = 0.10
Array1(2) = 0.25
Array1(3) = 0.50
Array1(4) = 0.75
Array1(5) = 0.90
Array1(6) = 1
'Set up color values array
Dim Array2(6) As Long
Array2(0) = grfColorAvocadoGreen
Array2(1) = RGB(127,205,49)
Array2(2) = RGB(189,199,55)
Array2(3) = grfColorLightYellow
Array2(4) = RGB(241,172,81)
Array2(5) = RGB(230,69,36)
Array2(6) = grfColorRed
'Set up opacity values array
Dim Array3(6) As Long
Array3(0) = 100
Array3(1) = 90
Array3(2) = 75
Array3(3) = 50
Array3(4) = 75
Array3(5) = 90
Array3(6) = 100
'Fill the Rectangle with the custom gradient
Rectangle.Fill.Gradient.SetGradient(Array1,Array2,Array3)
Used by: AutoGradient object