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 dashboard item to data in the Designer or in code.
Binding to Data in the Designer
The image below shows a sample Pie dashboard item that is bound to data.
To bind the Pie dashboard item to data, drag and drop a data source field to a placeholder contained in one of the available data sections. A table below lists and describes Pie’s data sections.
Section | Processed as | Description |
---|---|---|
Values |
Note In case of negative measure values, Pie uses their absolute values. | Contains data items that define the share of pie segments. |
Arguments | Contains data items that provide values used to label pie segments. | |
Series | Contains data items whose values are used to label pie charts. |
Transposing Arguments and Series
The Pie dashboard item provides the capability to transpose pie arguments and series. In this case, data items contained in the Arguments section are moved to the Series section, and vice versa.
To transpose the selected Pie dashboard item, use the Transpose button in the Home ribbon tab.
Binding to Data in Code
To provide data for the Pie dashboard item, use the following properties.
Arguments | |
Series | |
Values |
Example
The following example demonstrates how to bind a Pie dashboard item to data in code.
using DevExpress.DashboardCommon;
using System;
using System.Windows.Forms;
namespace Dashboard_CreatePies
{
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
private PieDashboardItem CreatePies(IDashboardDataSource dataSource) {
PieDashboardItem pies = new PieDashboardItem();
pies.DataSource = dataSource;
pies.Values.Add(new Measure("Extended Price"));
pies.Arguments.Add(new Dimension("Country"));
pies.SeriesDimensions.Add(new Dimension("OrderDate"));
return pies;
}
private void Form1_Load(object sender, EventArgs e) {
DashboardExcelDataSource excelDataSource = new DashboardExcelDataSource()
{
FileName = "SalesPerson.xlsx",
SourceOptions = new DevExpress.DataAccess.Excel.ExcelSourceOptions(
new DevExpress.DataAccess.Excel.ExcelWorksheetSettings()
{
WorksheetName = "Data",
CellRange = "A1:L100"
}
)
};
excelDataSource.Fill();
Dashboard dashBoard = new Dashboard();
dashBoard.DataSources.Add(excelDataSource);
PieDashboardItem pies = CreatePies(excelDataSource);
dashBoard.Items.Add(pies);
dashboardViewer1.Dashboard = dashBoard;
dashboardViewer1.ReloadData();
}
}
}