ChartDirector 7.0 (Python Edition)

BaseChart.linearGradientColor2


Usage

linearGradientColor2(startX, startY, endX, endY, colorArray [, periodic ])

Description

Creates a multi-point linear gradient color.

The color stops are defined as an array of offsets and colors in the following format:

offset0, color0, offset1, color1, .... offsetN, colorN

The first offset (offset0) should be 0. It represents the starting point of the gradient. The last offset (offsetN) can be any number not greater than 100000. It represents the ending point of the gradient. The other offsets represent the positions of the color stops in between.

For example, the array (in hex):

000000, FF0000, 000080, FFFF00, 000100, 00FF00

means the starting point (000000) is red (FF0000), the mid-point (000080 in hex) is yellow (FFFF00), and the ending point (000100 in hex) is green (00FF00).

One common usage of multi-point gradient colors is to define colors that have metallic look and feel. ChartDirector comes from several predefined gradient color arrays as follows.

NameValue (in Hex)
goldGradient 000000, FFE743, 000060, FFFFE0, 0000B0, FFF0B0, 000100, FFE743
silverGradient 000000, C8C8C8, 000060, F8F8F8, 0000B0, E0E0E0, 000100, C8C8C8
redMetalGradient 000000, E09898, 000060, FFF0F0, 0000B0, F0D8D8, 000100, E09898
greenMetalGradient 000000, 98E098, 000060, F0FFF0, 0000B0, D8F0D8, 000100, 98E098
blueMetalGradient 000000, 9898E0, 000060, F0F0FF, 0000B0, D8D8F0, 000100, 9898E0

Arguments

ArgumentDefaultDescription
startX(Mandatory)The x coordinate of the starting point of the reference gradient line segment.
startY(Mandatory)The y coordinate of the starting point of the reference gradient line segment.
endX(Mandatory)The x coordinate of the ending point of the reference gradient line segment.
endY(Mandatory)The y coordinate of the ending point of the reference gradient line segment.
colorArray(Mandatory)An array defining the offsets and colors of the color stops along the gradient.
periodicfalseSpecifies whether the gradient will repeat itself periodically. If the gradient does not repeat itself, the points that lie beyond the end points of the gradient line segment will assume the colors of the end points.

Return Value

A 32-bit integer representing the linear gradient color.