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

PieSegment Class

A segment of a pie chart item.

Namespace: DevExpress.XtraMap

Assembly: DevExpress.XtraMap.v18.1.dll

Declaration

public class PieSegment :
    MapSegmentBase,
    ILocatableRenderItem,
    IMapChartDataItem,
    IMapDataItem,
    IKeyColorizerElement,
    IColorizerElement,
    IInteractiveElementProvider,
    ISupportToolTip,
    IHitTestableElement,
    IMapItemAttributeOwner

The following members accept/return PieSegment objects:

Remarks

Instances of the PieSegment class are stored in the PieSegmentCollection returned by the MapPie.Segments property.

Example

The following example illustrates how to manually add a MapPie object to the Map control.

using System;
using System.Drawing;
using System.Windows.Forms;
using DevExpress.XtraMap;

namespace MapPieItem {
    public partial class Form1 : Form {
        public Form1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e) {
            // Create a layer to show vector items.
            VectorItemsLayer itemsLayer = new VectorItemsLayer() {
                Data = CreateData(),
                Colorizer = CreateColorizer()
            };
            mapControl1.Layers.Add(itemsLayer);

            // Show a color legend.
            mapControl1.Legends.Add(new ColorListLegend() { Layer = itemsLayer });
        }


        // Create a storage to provide data for the vector layer.
        private IMapDataAdapter CreateData() {
            MapItemStorage storage = new MapItemStorage();

            // Create a pie with several segments.
            MapPie pie = new MapPie();
            pie.Size = 200;
            pie.Segments.Add(new PieSegment() { Argument = "A", Value = 100 });
            pie.Segments.Add(new PieSegment() { Argument = "B", Value = 50 });
            pie.Segments.Add(new PieSegment() { Argument = "C", Value = 120 });
            storage.Items.Add(pie);

            return storage;
        }

        // Create a colorizer to provide colors for bubble items.    
        private MapColorizer CreateColorizer() {
            KeyColorColorizer colorizer = new KeyColorColorizer();

            // Add colors to the colorizer.
            colorizer.Colors.Add(Color.Coral);
            colorizer.Colors.Add(Color.Orange);
            colorizer.Colors.Add(Color.LightBlue);

            colorizer.Keys.Add(new ColorizerKeyItem() { Key = "A", Name = "Category A" });
            colorizer.Keys.Add(new ColorizerKeyItem() { Key = "B", Name = "Category B" });
            colorizer.Keys.Add(new ColorizerKeyItem() { Key = "C", Name = "Category C" });

            // Load color indexes from bubbles via the 'Color' attribute
            colorizer.ItemKeyProvider = new ArgumentItemKeyProvider();

            return colorizer;
        }
    }

}

The following code snippets (auto-collected from DevExpress Examples) contain references to the PieSegment class.

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.

Implements

Inheritance

See Also