RendererChooser class

The RendererChooser class allows you to configure SimpleRenderer, UniqueValueRenderer, and ClassBreaksRenderer. RendererChooser only supports the following symbol types: SimpleMarkerSymbol, PictureMarkerSymbol, SimpleLineSymbol, CartographicLineSymbol, SimpleFillSymbol, and TextSymbol.

AMD Module Require

require(["jimu/dijit/RendererChooser"], function(RendererChooser) { /* code goes here */ });

Constructor

new RendererChooser(params, srcNodeRef)

Creates a new RendererChooser dijit.

Parameters:

<Object> params—Required. Parameters for the RendererChooser dijit.

<DOMNode | String> srcNodeRef—Optional. HTML element where RendererChooser is rendered.

params properties:

<String> type—Optional. This property indicates which renderer the dijits shows. The available type values are marker, line, and fill. If the type is marker, it will show a renderer with marker symbols. If the type is line, it will show a renderer with line symbols. If the type is fill, it will show a renderer with fill symbols.

Note:

Either the type property or the renderer property is required.

<Renderer> renderer—Optional. The renderer to show.

Note:

The renderer property only supports the following types: SimpleRenderer, UniqueValueRenderer, and ClassBreaksRenderer. Either the type property or the renderer property is required.

<String>[] fields—Required. The field names used to configure UniqueValueRenderer and ClassBreaksRenderer.

Example:

require(['jimu/dijit/RendererChooser'], function(RendererChooser){
					var rendererChooser = new RendererChooser({
						type:"marker",
				  		fields:["field1","field2"]
					}, srcNodeRef);
					...
				});

require(['jimu/dijit/RendererChooser','esri/renderers/SimpleRenderer'], function(RendererChooser,SimpleRenderer){
					var renderer = new SimpleRenderer(...);
					var rendererChooser = new RendererChooser({
						renderer:renderer,
				  		fields:["field1","field2"]
					}, srcNodeRef);
					...
				});

Methods

showByType(type)

Determines which renderer shows.

Parameters:

<String> type—Required. The available type values are marker, line, and fill. If the type is marker, it will show a renderer with marker symbols. If the type is line, it will show a renderer with line symbols. If the type is fill, it will show a renderer with fill symbols.

showByRenderer(renderer)

Shows the specified renderer.

Parameters:

<Renderer> renderer—Required. The renderer to show. The renderer only supports the following types: SimpleRenderer, UniqueValueRenderer, and ClassBreaksRenderer.

getRenderer()

Gets the renderer configured by RendererChooser.

Return type: Renderer