Constructs a ValueMapLabelRenderer.
Syntax
Visual Basic (Declaration) | |
---|
Public Function New() |
C# | |
---|
public ValueMapLabelRenderer() |
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.
Visual Basic | Copy Code |
---|
Dim valueMapLblRend As New ValueMapLabelRenderer()
valueMapLblRend.ValueField = "POPULATION"
valueMapLblRend.LabelField = "NAME"
Dim textFont As FontInfo
Dim valueRange As LabelValueRange
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)
Dim layer As FeatureLayer = mapView.Layers.FindByName("Cities")
layer.Renderer = valueMapLblRend
|
C# | Copy Code |
---|
// Create a new ValueMapLabelRenderer and set value and label fields ValueMapLabelRenderer valueMapLblRend = new ValueMapLabelRenderer(); valueMapLblRend.ValueField = "POPULATION"; valueMapLblRend.LabelField = "NAME"; 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
See Also