DataLab is a compact statistics package aiming at exploratory data analysis. Please visit the DataLab Web site for more information....


InterpolateColPal

Declaration: InterpolateColPal(var ColPal: TColorPalette; NLevels: integer; ColorList: array of TColor): integer;
Fills the color palette ColPal by an interpolated array of colors. The basic idea is to use n pivot colors which are assumed to be regularly spaced across the entire color palette (the first pivot color is always at index 1, the last is always the last color of the array). The colors between the pivot colors are calculated by linear interpolation. The parameter ColorList is an open array of any number of pivot colors which are to be used for the calculation of the color palette.

The parameter NLevels determines how many color shades are generated. Setting NLevels to zero generates continuous colors, any positive value results in the corresponding number of shades. The following image shows the effect of the parameter NLevels.

The function returns the following error codes:

 0 ... everything OK
-1 ... the ColorList parameter must not contain less than 2 colors

Example: The following statement creates the color palette shown below (upper trace):
InterpolateColPal (MyColPal, 0, [clRed, clBlue, $00999900, clYellow]);

Setting the NLevels parameter to 8 results in the color palette showing nine shades (eight borders between nine color ranges)