renderers

AMD: require(["esri/renderers"], (renderers) => { /* code goes here */ });
ESM: import * as renderers from "@arcgis/core/renderers.js";
Object: esri/renderers
Since: ArcGIS Maps SDK 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

Type Definition
ClassBreaksRenderer ClassBreaksRenderer

ClassBreaksRenderer.

DictionaryRenderer

Type Definition
DictionaryRenderer DictionaryRenderer

DictionaryRenderer.

DotDensityRenderer

Type Definition
DotDensityRenderer DotDensityRenderer

DotDensityRenderer.

HeatmapRenderer

Type Definition
HeatmapRenderer HeatmapRenderer

HeatmapRenderer.

PieChartRenderer

Type Definition
PieChartRenderer PieChartRenderer

PieChartRenderer.

Renderer

Type Definition
Renderer HeatmapRenderer |RendererWithVisualVariables

Renderer.

RendererWithVisualVariables

Type Definition
RendererWithVisualVariables SimpleRenderer |ClassBreaksRenderer |UniqueValueRenderer |DotDensityRenderer |DictionaryRenderer |PieChartRenderer

RendererWithVisualVariables.

SimpleRenderer

Type Definition
SimpleRenderer SimpleRenderer

SimpleRenderer.

UniqueValueRenderer

Type Definition
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.