-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathForm1.cs
42 lines (39 loc) · 1.49 KB
/
Form1.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
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();
}
}
}