Skip to main content
A newer version of this page is available. .

ChoroplethColorizer.RangeDistribution Property

Gets or sets the distribution type of range colors in a colorizer.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v19.1.dll

Declaration

public IRangeDistribution RangeDistribution { get; set; }

Property Value

Type Description
DevExpress.Map.IRangeDistribution

An object implementing the DevExpress.Map.IRangeDistribution interface.

Example

Set the LinearRangeDistribution, LogarithmicRangeDistribution or ExponentialRangeDistribution object to the ChoroplethColorizer.RangeDistribution property. Note that if the ChoroplethColorizer.ApproximateColors property value equals false, shapes with values inside one range interval have the same color.

using System;
using System.Collections.Generic;
using System.Windows.Forms;
using DevExpress.Map;
using DevExpress.XtraMap;

namespace RangeDistributions {
    public partial class Form1 : Form {
        const string filepath = "../../Data/Countries.shp";

        List<RangeDistributionBase> distributions = new List<RangeDistributionBase>{ 
            new LinearRangeDistribution(),
            new LogarithmicRangeDistribution(),
            new ExponentialRangeDistribution()
        };

        VectorItemsLayer MapLayer { get { return (VectorItemsLayer)mapControl1.Layers["MapLayer"]; } }
        ChoroplethColorizer Colorizer { get { return (ChoroplethColorizer)MapLayer.Colorizer; } }
        ShapefileDataAdapter Adapter { get { return (ShapefileDataAdapter)MapLayer.Data; } }

        public Form1() {
            InitializeComponent();

            cbRangeDistribution.DataSource = distributions;

            Uri baseUri = new Uri(System.Reflection.Assembly.GetEntryAssembly().Location);
            Adapter.FileUri = new Uri(baseUri, filepath);
        }

        private void cbRangeDistribution_SelectedIndexChanged(object sender, EventArgs e) {
            RangeDistributionBase selectedDistribution = cbRangeDistribution.SelectedItem as RangeDistributionBase;
            if (selectedDistribution == null) return;

            if (selectedDistribution.Equals(distributions[0])) seFactor.Enabled = false;
            else {
                seFactor.Enabled = true;
                EquationRangeDistribution eqDistribution = selectedDistribution as EquationRangeDistribution;
                eqDistribution.Factor = (double)seFactor.Value;
            }

            Colorizer.RangeDistribution = selectedDistribution;
        }

        private void seFactor_EditValueChanged(object sender, EventArgs e) {
            EquationRangeDistribution distribution = Colorizer.RangeDistribution as EquationRangeDistribution;
            if (distribution == null) return;

            distribution.Factor = (double)seFactor.Value;
        }

        #region #ApproximateColors
        private void cbApproximateColors_CheckedChanged(object sender, EventArgs e) {
            Colorizer.ApproximateColors = cbApproximateColors.Checked;
        }
        #endregion #ApproximateColors
    }
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the RangeDistribution property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also