-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathForm1.cs
74 lines (69 loc) · 3.22 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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
using DevExpress.DashboardCommon;
using DevExpress.DashboardCommon.ViewerData;
using DevExpress.DashboardWin;
using System;
using System.Collections.Generic;
using System.IO;
namespace CustomInteractivityExample
{
public partial class Form1 : DevExpress.XtraEditors.XtraForm
{
List<AxisPointTuple> selectionCache;
public Form1()
{
InitializeComponent();
dashboardDesigner1.DashboardItemVisualInteractivity += DashboardDesigner1_DashboardItemVisualInteractivity;
dashboardDesigner1.DashboardItemSelectionChanged += DashboardDesigner1_DashboardItemSelectionChanged;
dashboardDesigner1.CustomizeDashboardItemCaption += DashboardDesigner1_CustomizeDashboardItemCaption;
dashboardDesigner1.ConfigureDataConnection += DashboardDesigner1_ConfigureDataConnection;
dashboardDesigner1.CreateRibbon();
dashboardDesigner1.LoadDashboard("topbottom5.xml");
}
private void DashboardDesigner1_DashboardItemVisualInteractivity(object sender, DashboardItemVisualInteractivityEventArgs e)
{
if (e.DashboardItemName == "gridDashboardItem1")
{
e.SelectionMode = DashboardSelectionMode.Single;
e.EnableHighlighting = true;
e.SetDefaultSelection(selectionCache);
};
if (e.DashboardItemName == "gridDashboardItem2")
{
e.SelectionMode = DashboardSelectionMode.Single;
e.EnableHighlighting = true;
e.SetDefaultSelection(selectionCache);
};
}
private void DashboardDesigner1_DashboardItemSelectionChanged(object sender, DashboardItemSelectionChangedEventArgs e)
{
DashboardDesigner dDesigner = sender as DashboardDesigner;
if (e.DashboardItemName == "gridDashboardItem1" || e.DashboardItemName == "gridDashboardItem2")
{
if (e.CurrentSelection.Count == 0)
{
dDesigner.Parameters[0].SelectedValue = null;
}
else
{
selectionCache = e.CurrentSelection;
string companyName = e.CurrentSelection[0].GetAxisPoint().DimensionValue.Value.ToString();
dDesigner.Parameters[0].SelectedValue = companyName;
}
}
}
private void DashboardDesigner1_CustomizeDashboardItemCaption(object sender, CustomizeDashboardItemCaptionEventArgs e)
{
DashboardDesigner dDesigner = sender as DashboardDesigner;
if (e.DashboardItemName == "chartDashboardItem1" && dDesigner.Parameters.Count > 0)
{
e.FilterText = string.Format(" {0}", dDesigner.Parameters[0].SelectedValue);
}
}
private void DashboardDesigner1_ConfigureDataConnection(object sender, DevExpress.DashboardCommon.DashboardConfigureDataConnectionEventArgs e)
{
ExtractDataSourceConnectionParameters parameters = e.ConnectionParameters as ExtractDataSourceConnectionParameters;
if (parameters != null)
parameters.FileName = Path.GetFileName(parameters.FileName);
}
}
}