symbolPreview

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

Generates small preview images of symbols. This utility can be useful when creating custom widgets that require displaying small previews of symbols used to represent features in a layer.

Method Overview

NameReturn TypeSummaryObject
Promise<HTMLElement>

Generates a preview image of a given symbol that can be displayed in a custom widget or other DOM element.

more details
more detailssymbolPreview

Method Details

renderPreviewHTML(symbol, options){Promise<HTMLElement>}

Generates a preview image of a given symbol that can be displayed in a custom widget or other DOM element.

Parameters:
symbol Symbol

The symbol for which to generate a preview image.

options Object
optional

Formatting options for the symbol preview image.

Specification:
optional

The parent node to append to the symbol.

size Number
optional

The size of the symbol preview in points.

maxSize Number
optional

The maximum size of the symbol preview in points.

opacity Number
optional

The opacity of the layer represented by the symbol.

scale Boolean
optional

Indicates whether to scale the symbol preview.

disableUpsampling Boolean
optional

Indicates whether to disable upsampling for raster images.

symbolConfig String
optional

For "tall" symbols in portrait view, then the tall value should be used here.

Returns:
TypeDescription
Promise<HTMLElement>Returns a preview of the given symbol to display to the DOM.
Example:
// symbol from SimpleRenderer;
var symbol = layer.renderer.symbol.clone();

symbolPreview.renderPreviewHTML(symbol, {
  node: document.getElementById("preview"),
  size: 8
});
Searching...

API Reference search results

NameTypeModule

There were no match results from your search criteria.