/
Form1.vb
70 lines (63 loc) · 2.97 KB
/
Form1.vb
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
Imports DevExpress.XtraCharts
Imports System
Imports System.Collections.Generic
Imports System.ComponentModel
Imports System.Data
Imports System.Drawing
Imports System.Linq
Imports System.Text
Imports System.Windows.Forms
Namespace DesignerSample
Partial Public Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
dashboardDesigner1.CreateRibbon()
dashboardDesigner1.LoadDashboard("..\..\Data\T597204.xml")
End Sub
Private Sub dashboardDesigner1_DashboardItemControlCreated(ByVal sender As Object, ByVal e As DevExpress.DashboardWin.DashboardItemControlEventArgs) Handles dashboardDesigner1.DashboardItemControlCreated
Select Case e.DashboardItemName
'1. Chart with the Currency Format (Y Axis)
Case "chartDashboardItem1"
AddHandler e.ChartControl.CustomDrawAxisLabel, AddressOf ChartControl_CustomDrawAxisLabel1
'2. Chart with the Number Format and the Ones Unit (Y Axis)
Case "chartDashboardItem2"
AddHandler e.ChartControl.CustomDrawAxisLabel, AddressOf ChartControl_CustomDrawAxisLabel2
'3. Chart with Whole Number Format (X Axis)
Case "chartDashboardItem3"
AddHandler e.ChartControl.CustomDrawAxisLabel, AddressOf ChartControl_CustomDrawAxisLabel3
End Select
End Sub
'1. Chart with the Currency Format (Y Axis)
Private Sub ChartControl_CustomDrawAxisLabel1(ByVal sender As Object, ByVal e As DevExpress.XtraCharts.CustomDrawAxisLabelEventArgs)
If TypeOf e.Item.Axis Is SecondaryAxisY Then
e.Item.Text = "$" & e.Item.Text
End If
End Sub
'2. Chart with the Number Format and the Ones Unit (Y Axis)
Private Sub ChartControl_CustomDrawAxisLabel2(ByVal sender As Object, ByVal e As DevExpress.XtraCharts.CustomDrawAxisLabelEventArgs)
If TypeOf e.Item.Axis Is SecondaryAxisY Then
e.Item.Text = DirectCast(e.Item.AxisValue, Double).ToString("n0")
End If
End Sub
'3. Chart with Whole Number Format (X Axis)
Private Sub ChartControl_CustomDrawAxisLabel3(ByVal sender As Object, ByVal e As DevExpress.XtraCharts.CustomDrawAxisLabelEventArgs)
If TypeOf e.Item.Axis Is AxisX Then
e.Item.Text = DirectCast(e.Item.AxisValue, Double).ToString("n0")
End If
End Sub
Private Sub dashboardDesigner1_DashboardItemBeforeControlDisposed(ByVal sender As Object, ByVal e As DevExpress.DashboardWin.DashboardItemControlEventArgs) Handles dashboardDesigner1.DashboardItemBeforeControlDisposed
Select Case e.DashboardItemName
'1. Chart with the Currency Format (Y Axis)
Case "chartDashboardItem1"
RemoveHandler e.ChartControl.CustomDrawAxisLabel, AddressOf ChartControl_CustomDrawAxisLabel1
'2. Chart with the Number Format and the Ones Unit (Y Axis)
Case "chartDashboardItem2"
RemoveHandler e.ChartControl.CustomDrawAxisLabel, AddressOf ChartControl_CustomDrawAxisLabel2
'3. Chart with Whole Number Format (X Axis)
Case "chartDashboardItem3"
RemoveHandler e.ChartControl.CustomDrawAxisLabel, AddressOf ChartControl_CustomDrawAxisLabel3
End Select
End Sub
End Class
End Namespace