Skip To ContentArcGIS for DevelopersSign In Dashboard

rasterRenderers

require(["esri/rasterRenderers"], function(rasterRenderers) { /* code goes here */ });
Object: esri/rasterRenderers
Since: ArcGIS API for JavaScript 4.13

A convenience module for importing renderer classes that can be used to render ImageryLayer when developing with TypeScript. For example, rather than importing renderers one at a time like this:

import ClassBreaksRenderer = require("esri/renderers/ClassBreaksRenderer");
import UniqueValueRenderer = require("esri/renderers/UniqueValueRenderer");
import RasterStretchRenderer = require("esri/renderers/RasterStretchRenderer");

You can use this module to import them on a single line:

import { ClassBreaksRenderer, UniqueValueRenderer, RasterStretchRenderer } from "esri/rasterRenderers";

This module also allows you to implement type guards on renderers, making your code smarter.

import { Renderer } from "esri/rasterRenderers";

function logRenderer(renderer: RasterStretchRenderer): void {
 if (renderer.type == "raster-stretch") {
   // the compiler knows the renderer must be a RasterStretchRenderer
   console.log("renderer color ramp: ", renderer.colorRamp);
 }
}

API Reference search results

NameTypeModule
Loading...