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

ItemsLayerLegend.Layer Property

Specifies the layer from which the legend obtains data to display.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v18.2.dll

Declaration

[DefaultValue(null)]
public MapItemsLayerBase Layer { get; set; }

Property Value

Type Default Description
MapItemsLayerBase *null*

A MapItemsLayerBase class descendant.

Example

This example demonstrates how to generate bubble charts for a map control. Do the following:

    // Specify data for the bubble layer.
    BubbleLayer.Data = CreateData();
private IMapDataAdapter CreateData() {
    BubbleChartDataAdapter adapter = new BubbleChartDataAdapter() {
        DataSource = LoadData(),
        MeasureRules = CreateMeasureRules(),
        ItemMaxSize = 60,
        ItemMinSize = 10
    };

    #region #Mappings
    // Map the properties of chart items to the appropriate fields in the data source.
    adapter.Mappings.Latitude = "glat";
    adapter.Mappings.Longitude = "glon";
    adapter.Mappings.Value = "mag";
    #endregion #Mappings

    // Create attribute mappings to provide additional information about map items to the map.
    adapter.AttributeMappings.Add(new MapItemAttributeMapping("Magnitude", "mag"));
    adapter.AttributeMappings.Add(new MapItemAttributeMapping("Year", "yr"));
    adapter.AttributeMappings.Add(new MapItemAttributeMapping("Month", "mon"));
    adapter.AttributeMappings.Add(new MapItemAttributeMapping("Day", "day"));
    adapter.AttributeMappings.Add(new MapItemAttributeMapping("Depth", "dep"));

    return adapter;
}

private DataTable LoadData() {
    DataSet ds = new DataSet();
    ds.ReadXml(dataPath);
    DataTable dt = ds.Tables[0];
    dt.DefaultView.RowFilter = string.Format(CultureInfo.InvariantCulture, "(mag >= {0}) AND (mag <= {1})", minMagnitude, maxMagnitude);

    return ds.Tables[0];
}

private MeasureRules CreateMeasureRules() {
    MeasureRules measureRules = new MeasureRules();

    measureRules.ApproximateValues = true;
    measureRules.RangeDistribution = new LinearRangeDistribution();

    for (int i = minMagnitude; i < maxMagnitude; i++) {
        measureRules.RangeStops.Add(i);
    }

    return measureRules;
}

The following code snippet (auto-collected from DevExpress Examples) contains a reference to the Layer 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