Class: ColorManager

Oracle.BDD.Portlets.Visualization.Util. ColorManager

new ColorManager()

Typically, only a single ColorManager is required by the visualization and that is best acquired via Oracle.BDD.Portlets.Visualization.Renderers.BaseRenderer#getColorManager. However, multiple instances of a ColorManager may be created.
var dayOfWeekColorMgr = new Oracle.BDD.Portlets.Visualization.Util.ColorManager({
   library: ["#6B486B", "#718BAE", "#ABBE23"],
   scaleDomain: ["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"]
});
Source:

Methods

getColor(domainKey) → {string}

Returns the hex value from the color library corresponding to the domain key. See D3 Ordinal Scales for more information on color scales and scale domains.
Parameters:
Name Type Description
domainKey string | Numeric The domain key
Source:
Returns:
Hex value of color
Type
string

getScaleDomain() → {Array.<string>}

Returns the scale's input domain values. See D3 Ordinal Scales for more information on color scales and scale domains.
Source:
Returns:
The array of domain values
Type
Array.<string>

setLibrary(colors)

Sets the color library for the color scale of the visualization. Value passed may be an array of hex strings or a string value of '10', '20' or '20b' to set the color library to that of the D3 category10, category20 or category20b libraries respectively.

See {@link https://github.com/mbostock/d3/wiki/Ordinal-Scales#categorical-colors|Categorical Colors} for information on D3 categorical color libraries.

See D3 Ordinal Scales for more information on color scales and scale domains.

Parameters:
Name Type Description
colors Array.<Object> | string An array of hex values to serve as the color library for the color scale. The string values of '10', '20' or '20b' may be passed to set the color library to those of the D3 category10, category20 or category20b libraries
Source:

setScaleDomain(domain)

Sets the color scale's input domain values. This is the means to ensure that any instance of the ColorManager configured with the same library will return the same color for the given key value (getColor(domainKey)). Setting a scale domain is optional; one instance of the ColorManager will always return the same value for the same input key. Setting a scale domain ensures consistency across multiple instances of the ColorManager (i.e. from page request to page request).

See D3 Ordinal Scales for more information on color scales and scale domains.

Parameters:
Name Type Description
domain Array.<Object> An array of values to serve as the color scale's domain input values
Source: