Back to Devexpress

ChoroplethColorizer Class

wpf-devexpress-dot-xpf-dot-map-fb2f5e18.md

latest3.8 KB
Original Source

ChoroplethColorizer Class

Represents the Choropleth-like colorizer.

Namespace : DevExpress.Xpf.Map

Assembly : DevExpress.Xpf.Map.v25.2.dll

NuGet Package : DevExpress.Wpf.Map

Declaration

csharp
public class ChoroplethColorizer :
    MapColorizer,
    IWeakEventListener,
    ILegendDataProvider
vb
Public Class ChoroplethColorizer
    Inherits MapColorizer
    Implements IWeakEventListener,
               ILegendDataProvider

The following members return ChoroplethColorizer objects:

Example

This example demonstrates how to paint each map contour in a specific color, based on population data from the Shapefile.

To do this, create a colorizer and assign it to the VectorLayer.Colorizer property.

To access GDP information from Shapefiles, assign a ShapeAttributeValueProvider object with the specified attribute name (NamedAttributeProviderBase.AttributeName) to the ChoroplethColorizer.ValueProvider property.

Then, specify range stops (data splits in ranges) for the colorizer using the ChoroplethColorizer.RangeStops property.

Finally, add the desired set of colors to the ColorCollection object that is accessed using the MapColorizer.Colors property. The colorizer automatically associates each color with the specified data range to colorize map shapes.

xaml
<dxm:VectorLayer.Colorizer>
    <dxm:ChoroplethColorizer RangeStops="0 3000 10000 18000 28000 44000 82000 185000 1000000 2500000 15000000">
        <dxm:ChoroplethColorizer.ValueProvider>
            <dxm:ShapeAttributeValueProvider AttributeName="GDP_MD_EST"/>
        </dxm:ChoroplethColorizer.ValueProvider>
        <dxm:ChoroplethColorizer.Colors>
            <Color>#5F8B95</Color>
            <Color>#799689</Color>
            <Color>#A2A875</Color>
            <Color>#CEBB5F</Color>
            <Color>#F2CB4E</Color>
            <Color>#F1C149</Color>
            <Color>#E5A84D</Color>
            <Color>#D6864E</Color>
            <Color>#C56450</Color>
            <Color>#BA4D51</Color>
        </dxm:ChoroplethColorizer.Colors>
    </dxm:ChoroplethColorizer>
</dxm:VectorLayer.Colorizer>
<dxm:MapControl.Legends>
    <dxm:ColorScaleLegend Layer="{Binding ElementName=mapLayer}" Header="GDP By Countries"
                            Description="In US dollars." RangeStopsFormat="0,B" MinWidth="550"/>
</dxm:MapControl.Legends>

Inheritance

Object DispatcherObject DependencyObject Freezable MapDependencyObject MapColorizer ChoroplethColorizer

See Also

ChoroplethColorizer Members

DevExpress.Xpf.Map Namespace