Skip to main content

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

MapPie Class

The class used to draw a pie chart on a map.

Namespace: DevExpress.Xpf.Map

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

NuGet Package: DevExpress.Wpf.Map

#Declaration

public class MapPie :
    MapChartItemBase,
    IMapChartItem,
    IMapChartDataItem,
    IMapValueDataItem,
    IMapDataItem,
    IMapContainerDataItem,
    IClusterItem,
    IClusterItemCore,
    IClusterable

The following members return MapPie objects:

#Remarks

The following image shows an example of a map pie chart.

MapPie_Example

#Examples

The following markup shows how to draw a sample pie chart on a map:

<Window
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
        xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
        xmlns:local="clr-namespace:DXMapExample"
        xmlns:dxm="http://schemas.devexpress.com/winfx/2008/xaml/map" 
        x:Class="DXMapExample.MainWindow"
        mc:Ignorable="d"
        Title="MainWindow" Height="800" Width="800">
    <Grid>
            <dxm:MapControl>
                <!-- Create a background image layer if necessary. -->
                <dxm:ImageLayer>
                    <dxm:BingMapDataProvider BingKey="Insert your Bing Key." 
                                             Kind="RoadLight"/>
                </dxm:ImageLayer>

                <!-- Add a vector layer that will store map pies. -->
                <dxm:VectorLayer>
                    <dxm:MapItemStorage x:Name="mapItemStorage">
                        <dxm:MapPie Location="48.8566, 2.3522" 
                                    HoleRadiusPercent="50" 
                                    Size="30" 
                                    RotationAngle="90">
                            <dxm:MapPie.Segments>
                                <dxm:PieSegment Value="20" Fill="Red" SegmentId="2"/>
                                <dxm:PieSegment Value="30" Fill="Green" SegmentId="0"/>
                                <dxm:PieSegment Value="50" Fill="Yellow" SegmentId="1"/>
                            </dxm:MapPie.Segments>
                        </dxm:MapPie>
                        <!-- Add other items here. -->
                    </dxm:MapItemStorage>
                </dxm:VectorLayer>
            </dxm:MapControl>
    </Grid>
</Window>

The example below shows how to create a pie chart and add it to a map in code:

using System.Windows;
using System.Windows.Media;
using DevExpress.Xpf.Map;

namespace DXMapExample {

        private void Window_Loaded(object sender, RoutedEventArgs e) {
            MapPie mapPie = new MapPie();

            mapPie.Location = new GeoPoint(48.8566, 2.3522);
            mapPie.HoleRadiusPercent = 50;
            mapPie.Size = 30;
            mapPie.RotationAngle = 90;

            mapPie.Segments.Add(new PieSegment { SegmentId = 2, Value = 20, Fill = Brushes.Red });
            mapPie.Segments.Add(new PieSegment { SegmentId = 0, Value = 30, Fill = Brushes.Green });
            mapPie.Segments.Add(new PieSegment { SegmentId = 1, Value = 50, Fill = Brushes.Yellow });

            mapItemStorage.Items.Add(mapPie);
        }
    }
}

See also the following example on how to generate map pies based on a data source: How to: Automatically Generate Pie Chart Items from a Datasource.

#Implements

See Also