windowsforms-devexpress-dot-xtramap-dot-maplegendbase-cceb179b.md
Gets or set the description of the map legend.
Namespace : DevExpress.XtraMap
Assembly : DevExpress.XtraMap.v25.2.dll
NuGet Package : DevExpress.Win.Map
[DefaultValue("")]
public string Description { get; set; }
<DefaultValue("")>
Public Property Description As String
| Type | Default | Description |
|---|---|---|
| String | String.Empty |
A String value.
|
The style of the legend description is specified by the MapLegendBase.DescriptionStyle property.
This example demonstrates how to paint each map contour in a specific color. To accomplish this, it is necessary to create a colorizer (choropleth or graph) and assign it to the VectorItemsLayer.Colorizer property.
For this colorizer, it is necessary to create a ShapeAttributeValueProvider object, specify the name of the shape attribute that contains a value to be colorized to its ShapeAttributeValueProvider.AttributeName property, and assign this value provider to the ChoroplethColorizer.ValueProvider property.
Then, split the entire data into ranges and add the required range stops to the DoubleCollection returned by the ChoroplethColorizer.RangeStops property.
Finally, add the desired set of colors to the GenericColorizerItemCollection<T> that is accessed from the ChoroplethColorizer.ColorItems property. The colorizer automatically associates each color with the specified data ranges.
Note
// Create colorizer for the MapLayer.
MapLayer.Colorizer = CreateColorizer();
private MapColorizer CreateColorizer() {
// Create a Choropleth colorizer
ChoroplethColorizer colorizer = new ChoroplethColorizer();
// Specify colors for the colorizer.
colorizer.ColorItems.AddRange(new ColorizerColorItem[] {
new ColorizerColorItem(Color.FromArgb(0x5F, 0x8B, 0x95)),
new ColorizerColorItem(Color.FromArgb(0x79, 0x96, 0x89)),
new ColorizerColorItem(Color.FromArgb(0xA2, 0xA8, 0x75)),
new ColorizerColorItem(Color.FromArgb(0xCE, 0xBB, 0x5F)),
new ColorizerColorItem(Color.FromArgb(0xF2, 0xCB, 0x4E)),
new ColorizerColorItem(Color.FromArgb(0xF1, 0xC1, 0x49)),
new ColorizerColorItem(Color.FromArgb(0xE5, 0xA8, 0x4D)),
new ColorizerColorItem(Color.FromArgb(0xD6, 0x86, 0x4E)),
new ColorizerColorItem(Color.FromArgb(0xC5, 0x64, 0x50)),
new ColorizerColorItem(Color.FromArgb(0xBA, 0x4D, 0x51))
});
// Specify range stops for the colorizer.
colorizer.RangeStops.AddRange(new double[] { 0, 3000, 10000, 18000, 28000,
44000, 82000, 185000, 1000000, 2500000, 15000000 });
// Specify the attribute that provides data values for the colorizer.
colorizer.ValueProvider = new ShapeAttributeValueProvider() { AttributeName = "GDP_MD_EST" };
return colorizer;
}
' Create colorizer for the MapLayer.
MapLayer.Colorizer = CreateColorizer()
Private Function CreateColorizer() As MapColorizer
' Create a Choropleth colorizer
Dim colorizer As New ChoroplethColorizer()
' Specify colors for the colorizer.
colorizer.ColorItems.AddRange(New ColorizerColorItem() { _
New ColorizerColorItem(Color.FromArgb(&H5F, &H8B, &H95)), _
New ColorizerColorItem(Color.FromArgb(&H79, &H96, &H89)), _
New ColorizerColorItem(Color.FromArgb(&HA2, &HA8, &H75)), _
New ColorizerColorItem(Color.FromArgb(&HCE, &HBB, &H5F)), _
New ColorizerColorItem(Color.FromArgb(&HF2, &HCB, &H4E)), _
New ColorizerColorItem(Color.FromArgb(&HF1, &HC1, &H49)), _
New ColorizerColorItem(Color.FromArgb(&HE5, &HA8, &H4D)), _
New ColorizerColorItem(Color.FromArgb(&HD6, &H86, &H4E)), _
New ColorizerColorItem(Color.FromArgb(&HC5, &H64, &H50)), _
New ColorizerColorItem(Color.FromArgb(&HBA, &H4D, &H51)) _
})
' Specify range stops for the colorizer.
colorizer.RangeStops.AddRange(New Double() { 0, 3000, 10000, 18000, 28000, 44000, 82000, 185000, 1000000, 2500000, 15000000 })
' Specify the attribute that provides data values for the colorizer.
colorizer.ValueProvider = New ShapeAttributeValueProvider() With {.AttributeName = "GDP_MD_EST"}
Return colorizer
End Function
See Also