• 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