Class: ColorScale

ColorScale

ColorScale

new ColorScale()

modules/tools/colorScale/model.js, line 13
Listens to Events:
  • Tools.ColorScale#event:RadioRequestGetColorScaleByValues

Extends

Methods

createLegendValues(scale, values){Array.<string>}

modules/tools/colorScale/model.js, line 109
gets the rgbs for the corresponding values
Name Type Description
scale object d3 scale
values Array.<number> legend values
Returns:
of rgbs

generateColorScale(values, colorspace, type){function|object}

modules/tools/colorScale/model.js, line 31
generates a function to use for color generation from values
Name Type Description
values Array.<number> Array of all values to build the scale from. Default: [0, 1]
colorspace d3.interpolator | Array.<color> colorspace of the scale, either 2 values for linearScale or string selector for d3.interpolator from d3-scale-chromatic. Default: "interpolateBlues"
type string type of the scale. Possbile values: "sequential", "linear".
Returns:
returns both the scale function and a legend with value/color-pairs for visualization.

interpolateValues(min, max, steps){Array.<number>}

modules/tools/colorScale/model.js, line 92
calculates the values for the legend using the min and max values and the number of steps
Name Type Description
min number min value
max number max value
steps number number of steps
Returns:
values