Providing Data
- 3 minutes to read
The Dashboard Designer allows you to bind dashboard items to data in a uniform and similar manner. See the Bind Dashboard Items to Data topic for common information.
The difference is in the data sections that the specific dashboard item has. This topic describes how to bind the Pie Map dashboard item to data in the Designer or in code.
Binding to Data in the Designer
The image below shows a sample Pie Map dashboard item that is bound to data.
Note that the Pie Map provides two data item groups for data binding: DATA ITEMS and TOOLTIP DATA ITEMS. Tables below list the available data sections.
Data Items
Section | Processed as | Description | API |
---|---|---|---|
Latitude | Accepts a dimension used to provide geographic latitude. | ||
Longitude | Accepts a dimension used to provide geographic longitude. | ||
Values |
Note In case of negative measure values, Pie Map uses their absolute values. | Accepts measures used to calculate pie values. If you added a data item to the Argument section and several data items to the Values section, you can use the Values drop-down menu to switch between the provided values. To invoke the Values menu, click the icon in the map’s caption or use the map’s context menu. | |
Argument | Allows you to provide data for pie arguments. |
Tooltip Data Items
Section | Processed as | Description | API |
---|---|---|---|
Dimensions | Dimension | Accepts dimensions allowing you to add supplementary content to the tooltips. | GeoPointMapDashboardItemBase.TooltipDimensions |
Measures | Measure | Accepts measures allowing you to add summaries to the tooltips. | MapDashboardItem.TooltipMeasures |
Example
The following code snippets show how to bind a Pie Map dashboard item to data in code.
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;
}
}
}