ChartDirector Ver 5.0 (PHP Edition)

BaseChart.linearGradientColor2

Usage

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

Description

Creates a multi-point linear gradient color.
In this method, the color points are defined as an array of positions and colors along a reference line segment, in the following format:
position0, color0, position1, color1, .... positionN, colorN
The positions are specified as a number from 0 - 256 (0 - 100 in hex), in which 0 represents the starting point of the reference line segment, and 256 (100 in hex) represents the ending point of the reference line segment.
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.

Name | Value (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

Argument | Default | Description
--- | --- | ---
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 positions and colors of the pixels along the reference gradient line segment.
periodic | false | Specifies 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.

© 2009 Advanced Software Engineering Limited. All rights reserved.