symbolPreview
require(["esri/symbols/support/symbolPreview"], function(symbolPreview) { /* code goes here */ });
esri/symbols/support/symbolPreview
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
Name | Return Type | Summary | Object | |
---|---|---|---|---|
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 details | symbolPreview |
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 SymbolThe symbol for which to generate a preview image.
options ObjectoptionalFormatting options for the symbol preview image.
Specification:node HTMLElementoptionalThe parent node to append to the symbol.
size NumberoptionalThe size of the symbol preview in points.
maxSize NumberoptionalThe maximum size of the symbol preview in points.
opacity NumberoptionalThe opacity of the layer represented by the
symbol
.scale BooleanoptionalIndicates whether to scale the symbol preview.
disableUpsampling BooleanoptionalIndicates whether to disable upsampling for raster images.
symbolConfig StringoptionalFor "tall" symbols in portrait view, then the
tall
value should be used here.Returns:Type Description 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 });