Options
All
  • Public
  • Public/Protected
  • All
Menu

Module ria/util/ColorMap

Overview

Functions

createGradientColorMap

  • (levelsToColorsMapping: { color: string; level: number }[]): ColorMap
  • Create a gradient color map. Colors corresponding to levels in the level range of the color map are linearly interpolated (including alpha) between entries.

    The example shows a ColorMap with 3 levels and 3 colors. The levels are mapped to colors as follows (level -> color):

    • ]-inf, 100] -> Black
    • ]100,200[ -> Something between Black and Green (linearly interpolated)
    • 200 -> Green
    • ]200,300[ -> Something between Green and Blue (linearly interpolated)
    • [300, +inf[ -> Blue

    Parameters

    • levelsToColorsMapping: { color: string; level: number }[]

      An array containing {level, color} entries (object literals). Levels are treated as Numbers. Colors are RIA Colors. The first element is a level. Entries are expected to be sorted in ascending level order. var gradientColorMap = ColorMap.createGradientColorMap([ {level: 100, color: "rgba(0, 0, 0, 1.0)"}, //100 -> Black {level: 200, color: "rgba(0, 255, 0, 1.0)"}, //200 -> Green {level: 300, color: "rgba(0, 0, 255, 1.0)"} //300 -> Blue ]);

    Returns ColorMap

createPiecewiseConstantColorMap

  • (levelsToColorsMapping: (string | number)[]): ColorMap
  • Create a piecewise constant color map. Unlike a gradient color map, no colors are interpolated in a piecewise constant map.

    The example shows a ColorMap with 3 levels and 2 colors. The levels are mapped to colors as follows (level -> color):

    • ]-inf, 100[ -> Black
    • [100, 200[ -> Black
    • [200, 300[ -> Green
    • [300, +inf[ -> Green

    Parameters

    • levelsToColorsMapping: (string | number)[]

      An array with alternating level, color values in it. Levels should be Numbers. Colors are represented as RIA Colors. The first element is a level. Elements are expected to be sorted in ascending level order.

      var piecewiseConstantColorMap = ColorMap.createPiecewiseConstantColorMap(
         [100, "rgba(0, 0, 0, 1.0)", 200, "rgba(0, 255, 0, 1.0)", 300]);

    Returns ColorMap

Legend

  • Module
  • Object literal
  • Variable
  • Function
  • Function with type parameter
  • Index signature
  • Type alias
  • Type alias with type parameter
  • Enumeration
  • Enumeration member
  • Property
  • Method
  • Interface
  • Interface with type parameter
  • Constructor
  • Property
  • Method
  • Index signature
  • Class
  • Class with type parameter
  • Constructor
  • Property
  • Method
  • Accessor
  • Index signature
  • Inherited constructor
  • Inherited property
  • Inherited method
  • Inherited accessor
  • Protected property
  • Protected method
  • Protected accessor
  • Private property
  • Private method
  • Private accessor
  • Static property
  • Static method