renderers

AMD: require(["esri/renderers"], (renderers) => { /* code goes here */ });
ESM: import * as renderers from "@arcgis/core/renderers";
Object: esri/renderers
Since: ArcGIS API for JavaScript 4.8

A convenience module for importing Renderer classes when developing with TypeScript. For example, rather than importing renderers one at a time like this:

import ClassBreaksRenderer from "esri/renderers/ClassBreaksRenderer";
import HeatmapRenderer from "esri/renderers/HeatmapRenderer";
import SimpleRenderer from "esri/renderers/SimpleRenderer";
import UniqueValueRenderer from "esri/renderers/UniqueValueRenderer";
import DictionaryRenderer from "esri/renderers/DictionaryRenderer";

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

import { ClassBreaksRenderer, HeatmapRenderer, SimpleRenderer, UniqueValueRenderer } from "esri/renderers";

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

import { Renderer } from "esri/renderers";

function logRenderer(renderer: Renderer): void {
  if (renderer.type === "simple") {
    // new at 4.8, the compiler knows the renderer is a SimpleRenderer
    console.log("renderer symbol: ", renderer.symbol);
  }
  else {
    if (renderer.type !== "heatmap") {
      // the compiler knows the renderer must be a `ClassBreaksRenderer | UniqueValueRenderer`
      console.log("renderer background symbol: ", renderer.backgroundFillSymbol);
    }
  }
}

Type Definitions

ClassBreaksRenderer ClassBreaksRenderer

ClassBreaksRenderer.

DictionaryRenderer DictionaryRenderer

DictionaryRenderer.

DotDensityRenderer DotDensityRenderer

DotDensityRenderer.

HeatmapRenderer HeatmapRenderer

HeatmapRenderer.

Renderer.

RendererWithVisualVariables.

SimpleRenderer SimpleRenderer

SimpleRenderer.

UniqueValueRenderer UniqueValueRenderer

UniqueValueRenderer.

Your browser is no longer supported. Please upgrade your browser for the best experience. See our browser deprecation post for more details.