|The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....|
|Home ChartPack ColorScale Using TColorScale|
The TColorScale component is intended to display color coded scales as they are used, for example, in geographic maps for the indication of the altitude. The basic idea of TColorScale is to use an array of colors and map it on a range of numbers. Thus each number gets a color assigned and vice versa. The color array contains, by default, 1024 colors and can be accessed via the ColorArray property and its associated properties and methods.
Please note that the color array may be mapped to a range which is larger than the range defined by ScaleRangeHigh and ScaleRangeLow. In this case only the colors within the scale range are displayed. On the other hand, if the color range is smaller than the scale range (as shown above), the unmapped regions of the scale may either show the background color of the scale or may be extended by the lowest and highest color if the property ExtendColors is set to TRUE.
The color scale may be either horizontal or vertical, depending on the property Orientation.
When the mouse is over the color scale the OnMouseMoveInScale event is triggered. Further, there are two functions which allow to translate a numeric value into the corresponding color and vice versa: ValueToColor and ColorToValue. The back transformation of a color into a numeric value may not be unique. In this case, the lowest possible value is returned by the function ColorToValue.