ESRI.ArcGIS.ADF.IMS
ValueMapLabelRenderer Class
Members  Example  See Also 
ESRI.ArcGIS.ADF.IMS.Display.Renderer Namespace : ValueMapLabelRenderer Class




A LabelRenderer object that can display different symbologies.

Object Model




Syntax

Visual Basic (Declaration) 
<SerializableAttribute()>
Public Class ValueMapLabelRenderer 
   Inherits LabelRenderer
Visual Basic (Usage)Copy Code
Dim instance As ValueMapLabelRenderer
C# 
[SerializableAttribute()]
public class ValueMapLabelRenderer : LabelRenderer 

Example

The following example creates a new ValueMapLabelRenderer for cities, adds three ranges for small, medium and large cities, sets different font size and color for each range, and assigns the new renderer to the cities map layer.

For an example of using unique values for labels, see UniqueLabelValue.

Visual BasicCopy Code
' Set up required properties for ValueMapLabelRenderer

Dim rendererValueField As String = "POPULATION" ' Field used to assign features to ranges

Dim rendererLabelField As String = "NAME" ' Field used as label text

Dim defaultSymbolFont As New FontInfo("Arial", 8, Drawing.Color.DarkGray, FontStyle.Regular)

Dim defaultRendererSymbol As New TextSymbol(defaultSymbolFont, TextCasing.None, Drawing.Color.Empty)



' Create a new ValueMapLabelRenderer and set required label field

Dim valueMapLblRend As New ValueMapLabelRenderer("Other", defaultRendererSymbol, rendererValueField)

valueMapLblRend.LabelField = rendererLabelField



Dim textFont As FontInfo

Dim valueRange As LabelValueRange



' Create three value ranges, for three different city population sizes

valueRange = New LabelValueRange()

valueRange.MinValue = "1"

valueRange.MaxValue = "100000"

textFont = New FontInfo("Arial", 8, Drawing.Color.Blue, FontStyle.Regular)

valueRange.Symbol = New TextSymbol(textFont, TextCasing.None, Drawing.Color.Empty)

valueRange.SymbolLabel = "1 to 100,000"

valueMapLblRend.Values.Add(valueRange)



valueRange = New LabelValueRange()

valueRange.MinValue = "100000"

valueRange.MaxValue = "1000000"

textFont = New FontInfo("Arial", 12, Drawing.Color.Green, FontStyle.Regular)

valueRange.Symbol = New TextSymbol(textFont, TextCasing.None, Drawing.Color.Empty)

valueRange.SymbolLabel = "100,000 to 1,000,000"

valueMapLblRend.Values.Add(valueRange)



valueRange = New LabelValueRange()

valueRange.MinValue = "1000000"

valueRange.MaxValue = "50000000"

textFont = New FontInfo("Arial", 18, Drawing.Color.Red, FontStyle.Regular)

valueRange.Symbol = New TextSymbol(textFont, TextCasing.None, Drawing.Color.Empty)

valueRange.SymbolLabel = "Over 1,000,000"

valueMapLblRend.Values.Add(valueRange)



' Assign the ValueMapLabelRenderer to an existing point layer

Dim layer As FeatureLayer = mapView.Layers.FindByName("Cities")

layer.Renderer = valueMapLblRend

C#Copy Code
// Set up required properties for ValueMapLabelRenderer 

string rendererValueField = "POPULATION";   // Field used to assign features to ranges 

string rendererLabelField = "NAME";   // Field used as label text 

FontInfo defaultSymbolFont = new FontInfo("Arial", 8, Drawing.Color.DarkGray, FontStyle.Regular); 

TextSymbol defaultRendererSymbol = new TextSymbol(defaultSymbolFont, TextCasing.None, Drawing.Color.Empty); 

  

// Create a new ValueMapLabelRenderer and set required label field 

ValueMapLabelRenderer valueMapLblRend = new ValueMapLabelRenderer("Other", defaultRendererSymbol, rendererValueField); 

valueMapLblRend.LabelField = rendererLabelField; 

  

FontInfo textFont; 

LabelValueRange valueRange; 

  

// Create three value ranges, for three different city population sizes 

valueRange = new LabelValueRange(); 

valueRange.MinValue = "1"; 

valueRange.MaxValue = "100000"; 

textFont = new FontInfo("Arial", 8, Drawing.Color.Blue, FontStyle.Regular); 

valueRange.Symbol = new TextSymbol(textFont, TextCasing.None, Drawing.Color.Empty); 

valueRange.SymbolLabel = "1 to 100,000"; 

valueMapLblRend.Values.Add(valueRange); 

  

valueRange = new LabelValueRange(); 

valueRange.MinValue = "100000"; 

valueRange.MaxValue = "1000000"; 

textFont = new FontInfo("Arial", 12, Drawing.Color.Green, FontStyle.Regular); 

valueRange.Symbol = new TextSymbol(textFont, TextCasing.None, Drawing.Color.Empty); 

valueRange.SymbolLabel = "100,000 to 1,000,000"; 

valueMapLblRend.Values.Add(valueRange); 

  

valueRange = new LabelValueRange(); 

valueRange.MinValue = "1000000"; 

valueRange.MaxValue = "50000000"; 

textFont = new FontInfo("Arial", 18, Drawing.Color.Red, FontStyle.Regular); 

valueRange.Symbol = new TextSymbol(textFont, TextCasing.None, Drawing.Color.Empty); 

valueRange.SymbolLabel = "Over 1,000,000"; 

valueMapLblRend.Values.Add(valueRange); 

  

// Assign the ValueMapLabelRenderer to an existing point layer 

FeatureLayer layer = mapView.Layers.FindByName("Cities"); 

layer.Renderer = valueMapLblRend; 

    

Remarks

The ValueMapLabelRenderer displays a layer with multiple symbols, rather than with a single symbol for all features (as with SimpleLabelRenderer). Features are rendered based on their value in a field (defined in ValueField). Rendering can occur based on individual, unique values (using UniqueLabelValue), or based on ranges of values (using LabelValueRange).

For each feature to be rendered, the value in the field given by ValueField is compared to the values specified in the Values collection (either value ranges or unique values). If a match is found, the feature is labeled with the text found in the field specified in LabelField, rendered as defined in the LabelValue's Symbol property. If no match is found, the DefaultSymbol is used to render the label, or if no DefaultSymbol is set, the label is not shown.

Inheritance Hierarchy

System.Object
   ESRI.ArcGIS.ADF.IMS.Display.Renderer.Renderer
      ESRI.ArcGIS.ADF.IMS.Display.Renderer.LabelRenderer
         ESRI.ArcGIS.ADF.IMS.Display.Renderer.ValueMapLabelRenderer

See Also

© 2010 All Rights Reserved.