dojox/color/NeutralColorModel (version 1.10)

dojox/color/SimpleColorModel

Summary

Base class for color models that return a color from a data value using an interpolation between two extremum colors around a neutral value.

Usage

var foo = new NeutralColorModel(startColor,endColor);
dojox/color/NeutralColorModel
Parameter Type Description
startColor dojo/_base/Color

The start color.

endColor dojo/_base/Color
Optional

The end color.

See the dojox/color/NeutralColorModel reference documentation for more information.

Property Summary

Method Summary

  • _getInterpoledValue(from,to,value)
  • computeNeutral(min,max,sum,values) Return the neutral value.
  • getColor(value) return the color for a given data value.
  • getNormalizedValue(value) Return the normalized (between 0 and 1) value for a given data value.
  • initialize(items,colorFunc) Initialize the color model from a list of data items and using a function that returns the value used to compute the color for a given item.

Properties

_endColor
_max
_min
_startColor

Methods

_getInterpoledValue(from,to,value)
Parameter Type Description
from undefined
to undefined
value undefined
Returns:number
computeNeutral(min,max,sum,values)

Return the neutral value. This can be for example the mean or average value. This function must be implemented by implementations.

Parameter Type Description
min Number

The minimal value.

max Number

The maximum value.

sum Number

The sum of all values.

values Number[]

The sorted array of values used to compute colors.

getColor(value)

return the color for a given data value.

Parameter Type Description
value Number

The data value.

Returns:undefined
getNormalizedValue(value)

Return the normalized (between 0 and 1) value for a given data value. This implementation uses an power function to map neutral value to 0.5 and distribute other values around it.

Parameter Type Description
value Number

The data value

Returns:number | undefined
initialize(items,colorFunc)

Initialize the color model from a list of data items and using a function that returns the value used to compute the color for a given item.

Parameter Type Description
items Object[]

The data items.

colorFunc Function

The function that returns the value used to compute the color for particular data item.

Error in the documentation? Can’t find what you are looking for? Let us know!