SetColor Method
The SetColor 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.SetColor(colorNodes, colors)
Parameter | Type | Description |
colorNodes | Variant | required, percent locations in the color gradient for each custom color |
colors | Variant | required, Grapher color names or RGB color combination |
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
'Fill the Rectangle with the custom gradient
Rectangle.Fill.Gradient.SetColor(Array1,Array2)
Used by: AutoGradient object