Packagecom.esri.bacore.thematicmapping
Classpublic class ColorRamp
InheritanceColorRamp Inheritance flash.events.EventDispatcher
Subclasses TMColorRamp

The ColorRamp class defines and handles color ramp for thematic mapping.

This class is abstract. Derived classes should implement the rampColorsCount property and getColorByIndex method.



Public Properties
 PropertyDefined By
  isUpdatable : Boolean
[read-only] Specifies an ability to update discrete ramp colors.
ColorRamp
  rampColorsCount : uint
The current number of discrete colors specified in this color ramp.
ColorRamp
Public Methods
 MethodDefined By
  
Creates a new instance of the ColorRamp class.
ColorRamp
  
getColorByIndex(index:int):uint
Gets a discrete color by index.
ColorRamp
  
getColorByValue(value:Number):uint
Gets a gradient color by value in the range of [0, 1].
ColorRamp
  
mixColors(color1:uint, color2:uint, value:Number):uint
[static] Mixes color1 with color2 using linear interpolation.
ColorRamp
  
updateRampColor(index:int, value:uint):Boolean
Updates an individual color of this color ramp with a user-defined value.
ColorRamp
  
updateRampColors(values:Array):Boolean
Updates all colors of this color ramp with user-defined values.
ColorRamp
Events
 Event Summary Defined By
  The rampColorsChanged event is dispatched when the discrete colors of this color ramp are changed.ColorRamp
Public Constants
 ConstantDefined By
  RAMP_COLORS_CHANGED : String = rampColorsChanged
[static] The ColorRamp.RAMP_COLORS_CHANGED constant defines the value of the type property of the flash.events.Event object for a rampColorsChanged event.
ColorRamp
Property Detail
isUpdatableproperty
isUpdatable:Boolean  [read-only]

Specifies an ability to update discrete ramp colors. True value means that individual colors can be updated using updateRampColor and updateRampColors methods.

This property is "virtual". Its base implementation return false.


Implementation
    public function get isUpdatable():Boolean
rampColorsCountproperty 
rampColorsCount:uint

The current number of discrete colors specified in this color ramp.

This property is "abstract". Its base implementation throws an error.


Implementation
    public function get rampColorsCount():uint
    public function set rampColorsCount(value:uint):void
Constructor Detail
ColorRamp()Constructor
public function ColorRamp()

Creates a new instance of the ColorRamp class.

Method Detail
getColorByIndex()method
public function getColorByIndex(index:int):uint

Gets a discrete color by index.

This method is "abstract". Its base implementation throws an error.

The index parameter value should be in the range from 0 to rampColorsCount-1. The behavior of this method in the out-of-range case is implementation dependent.

Parameters

index:int — Zero-based index of color in the discrete color ramp.

Returns
uint — Required ARGB-color.
getColorByValue()method 
public function getColorByValue(value:Number):uint

Gets a gradient color by value in the range of [0, 1].

The linear gradient color for the given value is calculated. The discrete colors of the color ramp are posed at the nodes x=i/(rampColorsCount-1) of the gradient function.

The input value should belong to [0, 1]. If the value is negative, the first discrete color is returned. If the value is greater that 1, the last discrete color is returned.

Parameters

value:Number — A value between 0 and 1 specifying a position of color in the color ramp gradient.

Returns
uint — Required RGB-color.
mixColors()method 
public static function mixColors(color1:uint, color2:uint, value:Number):uint

Mixes color1 with color2 using linear interpolation. Color components are mixed by the formula:

mixedColor.X = rgbColor1.X*(1-value) + rgbColor2.X*value.

Parameters

color1:uint — The first ARGB-color.
 
color2:uint — The second ARGB-color.
 
value:Number — A value in the range from 0 to 1 specifying a proportion to mix colors with.

Returns
uint — Mixed ARGB-color.
updateRampColor()method 
public function updateRampColor(index:int, value:uint):Boolean

Updates an individual color of this color ramp with a user-defined value.

The updated color will be reset when the number of colors is changed. If the color ramp doesn't updatable, this operation is ignored. Base implementation does nothing.

Parameters

index:int — Zero-based index of color to be updated.
 
value:uint — New value of color.

Returns
Boolean
updateRampColors()method 
public function updateRampColors(values:Array):Boolean

Updates all colors of this color ramp with user-defined values.

The number of input colors can differ from the current number of ramp colors. In this case, the current number of colors is changed to match with the number of input colors.

The updated colors will be reset when the number of colors is changed. If the color ramp doesn't updatable, this operation is ignored. Base implementation does nothing.

Parameters

values:Array — Values of colors.

Returns
Boolean
Event Detail
rampColorsChanged Event
Event Object Type: flash.events.Event
Event.type property = com.esri.bacore.thematicmapping.ColorRamp.RAMP_COLORS_CHANGED

The rampColorsChanged event is dispatched when the discrete colors of this color ramp are changed.

The ColorRamp.RAMP_COLORS_CHANGED constant defines the value of the type property of the flash.events.Event object for a rampColorsChanged event.
Constant Detail
RAMP_COLORS_CHANGEDConstant
public static const RAMP_COLORS_CHANGED:String = rampColorsChanged

The ColorRamp.RAMP_COLORS_CHANGED constant defines the value of the type property of the flash.events.Event object for a rampColorsChanged event.