ChartDirector 6.0 (Ruby Edition)

BaseMeter.addColorScale


Usage

addColorScale(colorStops [, startPos [, startWidth [, endPos [, endWidth [, edgeColor ]]]]])

Description

Adds a color scale to the meter.

A color scale is similar to a meter scale. Instead of using labels to denote the values, a color scale uses different colors for different values. The colors can vary continuously or in discrete steps. The width of the color scale can also vary based on the value. There can be multiple more than one color scale in a meter.

A color scale is defined with an array of numbers. For a continuous color scale, each pair of numbers represents a value and its associated color. For example, to define a continuous color scale in which 0 is blue (0000FF), 50 is yellow (FFFF00) and 100 is red (FF0000), the numbers should be:

0.0, 0x0000ff, 50.0, 0xffff00, 100.0, 0xff0000

For a step color scale, the number of colors would be one less than the number of values. For example, to define a step color scale in which 0 to 50 is red (FF0000), and 50 to 100 is green (00FF00), the numbers will be:

0.0, 0xff000, 50.0, 0x00ff00, 100.0

Arguments

ArgumentDefaultDescription
colorStops(Mandatory)An array of numbers alternating between values and colors. If the number count is even, the array will define a continuous color scale, otherwise it will define a step color scale.
startPos-0x7fffffffThe position of the starting point of the color scale. For an angular meter, the position refers to the radius, and the default is the meter scale radius (see AngularMeter.setMeter). For a linear meter, the position refers to the x or y coordinate depending on whether the meter is vertical or horizontal, and the default is the leftX or topY coordinate of the meter scale (see LinearMeter.setMeter).
startWidth-0x7fffffffThe width at the starting point of the color scale. A positive value means the width is in the direction of increasing "position", while a negative value means decreasing "position". Please refer to the description of startPos on the meaning of "position" for various types of meters. The default is the length of the major tick (see BaseMeter.setTickLength).
endPos-0x7fffffffThe position of the ending point of the color scale. Please refer to the description of startPos above on how the position parameter is interpreted. The default is for the ending position to be equal to the starting position.
endWidth-0x7fffffffThe width at the ending point of the color scale. Please refer to the description of startWidth above on how the width parameter is interpreted. The default is for the ending width to be equal to the starting width.
edgeColor-1The edge color of the color scale. The default is to have no edge.

Return Value

None