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
ClassBreaksRenderer ClassBreaksRenderer
-
ClassBreaksRenderer.
-
DictionaryRenderer
DictionaryRenderer DictionaryRenderer
-
DictionaryRenderer.
-
DotDensityRenderer
DotDensityRenderer DotDensityRenderer
-
DotDensityRenderer.
-
HeatmapRenderer
HeatmapRenderer HeatmapRenderer
-
HeatmapRenderer.
-
PieChartRenderer
PieChartRenderer PieChartRenderer
-
PieChartRenderer.
-
Renderer
Renderer HeatmapRenderer |RendererWithVisualVariables
-
Renderer.
-
RendererWithVisualVariables
RendererWithVisualVariables SimpleRenderer |ClassBreaksRenderer |UniqueValueRenderer |DotDensityRenderer |DictionaryRenderer |PieChartRenderer
-
RendererWithVisualVariables.
-
SimpleRenderer
SimpleRenderer SimpleRenderer
-
SimpleRenderer.
-
UniqueValueRenderer
UniqueValueRenderer UniqueValueRenderer
-
UniqueValueRenderer.