Back to Devexpress

PieMapDashboardItem Class

dashboard-devexpress-dot-dashboardcommon-50d0c037.md

latest6.0 KB
Original Source

PieMapDashboardItem Class

A Pie Map dashboard item that allows you to place pies on the map using geographical coordinates.

Namespace : DevExpress.DashboardCommon

Assembly : DevExpress.Dashboard.v25.2.Core.dll

NuGet Package : DevExpress.Dashboard.Core

Declaration

csharp
public class PieMapDashboardItem :
    GeoPointMapDashboardItemBase,
    IPieContext,
    IElementContainer
vb
Public Class PieMapDashboardItem
    Inherits GeoPointMapDashboardItemBase
    Implements IPieContext,
               IElementContainer

Remarks

The Pie Map dashboard item allows you to place pies on the map using geographical coordinates. Each pie visualizes the contribution of each value to the total.

The following documentation is available.

Example

The following code snippets show how to bind a Pie Map dashboard item to data in code.

csharp
using System;
using DevExpress.DashboardCommon;
using DevExpress.DataAccess.ConnectionParameters;
using DevExpress.DataAccess.Sql;
using DevExpress.XtraEditors;

namespace Dashboard_CreatePieMap {
    public partial class Form1 : XtraForm {
        public Form1() {
            InitializeComponent();
        }

        private void Form1_Load(object sender, EventArgs e)
        {
            Dashboard dashboard = new Dashboard();

            DashboardSqlDataSource xmlDataSource = new DashboardSqlDataSource();
            xmlDataSource.ConnectionParameters =
                new XmlFileConnectionParameters(@"..\..\Data\DashboardEnergyStatictics.xml");
            SelectQuery sqlQuery = SelectQueryFluentBuilder
                .AddTable("Countries")
                .SelectColumns("Latitude", "Longitude", "Production", "EnergyType", "Country")
                .Build("Query 1");
            xmlDataSource.Queries.Add(sqlQuery);
            dashboard.DataSources.Add(xmlDataSource);

            PieMapDashboardItem pieMap = CreatePieMap(xmlDataSource);

            dashboard.Items.Add(pieMap);
            dashboardViewer1.Dashboard = dashboard;
        }

        private static PieMapDashboardItem CreatePieMap(DashboardSqlDataSource xmlDataSource)
        {
            PieMapDashboardItem pieMap = new PieMapDashboardItem();
            pieMap.DataSource = xmlDataSource;
            pieMap.DataMember = "Query 1";

            pieMap.Area = ShapefileArea.Europe;

            pieMap.Latitude = new Dimension("Latitude");
            pieMap.Longitude = new Dimension("Longitude");

            pieMap.Values.Add(new Measure("Production"));
            pieMap.Argument = new Dimension("EnergyType");

            pieMap.TooltipDimensions.Add(new Dimension("Country"));
            pieMap.Legend.Visible = true;
            return pieMap;
        }
    }
}
vb
Imports System
Imports DevExpress.DashboardCommon
Imports DevExpress.DataAccess.ConnectionParameters
Imports DevExpress.DataAccess.Sql
Imports DevExpress.XtraEditors

Namespace Dashboard_CreatePieMap
    Partial Public Class Form1
        Inherits XtraForm

        Public Sub New()
            InitializeComponent()
        End Sub

        Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles Me.Load
            Dim dashboard As New Dashboard()

            Dim xmlDataSource As New DashboardSqlDataSource()
            xmlDataSource.ConnectionParameters = New XmlFileConnectionParameters("..\..\Data\DashboardEnergyStatictics.xml")
            Dim sqlQuery As SelectQuery = SelectQueryFluentBuilder.AddTable("Countries").SelectColumns("Latitude", "Longitude", "Production", "EnergyType", "Country").Build("Query 1")
            xmlDataSource.Queries.Add(sqlQuery)
            dashboard.DataSources.Add(xmlDataSource)

            Dim pieMap As PieMapDashboardItem = CreatePieMap(xmlDataSource)

            dashboard.Items.Add(pieMap)
            dashboardViewer1.Dashboard = dashboard
        End Sub

        Private Shared Function CreatePieMap(ByVal xmlDataSource As DashboardSqlDataSource) As PieMapDashboardItem
            Dim pieMap As New PieMapDashboardItem()
            pieMap.DataSource = xmlDataSource
            pieMap.DataMember = "Query 1"

            pieMap.Area = ShapefileArea.Europe

            pieMap.Latitude = New Dimension("Latitude")
            pieMap.Longitude = New Dimension("Longitude")

            pieMap.Values.Add(New Measure("Production"))
            pieMap.Argument = New Dimension("EnergyType")

            pieMap.TooltipDimensions.Add(New Dimension("Country"))
            pieMap.Legend.Visible = True
            Return pieMap
        End Function
    End Class
End Namespace

Implements

ICustomPropertyProvider

Inheritance

Object DashboardItem DataDashboardItem MapDashboardItem GeoPointMapDashboardItemBase PieMapDashboardItem

See Also

PieMapDashboardItem Members

DevExpress.DashboardCommon Namespace