-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathForm1.vb
41 lines (38 loc) · 1.8 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
Imports DevExpress.DashboardCommon
Imports DevExpress.DataAccess.Excel
Imports DevExpress.XtraEditors
Imports System.IO
Namespace WindowsFormsMapCustomShape
Public Partial Class Form1
Inherits XtraForm
Public Sub New()
InitializeComponent()
Dim dashboard As Dashboard = New Dashboard()
'Create an Excel data source.
Dim excelDataSource As DashboardExcelDataSource = New DashboardExcelDataSource()
excelDataSource.FileName = "..\..\Data\Sales.xlsx"
Dim worksheetSettings As ExcelWorksheetSettings = New ExcelWorksheetSettings("Sheet1", "A1:I4166")
excelDataSource.SourceOptions = New ExcelSourceOptions(worksheetSettings)
excelDataSource.Fill()
dashboard.DataSources.Add(excelDataSource)
' Create a Choropleth Map dashboard item.
Dim map As ChoroplethMapDashboardItem = New ChoroplethMapDashboardItem()
map.Name = "Choropleth Map"
map.DataSource = excelDataSource
map.Legend.Visible = True
map.ShapeTitleAttributeName = "NAME"
map.AttributeName = "NAME"
map.AttributeDimension = New Dimension("State")
Dim revenueYTDMap As ValueMap = New ValueMap(New Measure("RevenueYTD (Sum)"))
map.Maps.Add(revenueYTDMap)
' Loads a custom shape file to the map.
map.Area = ShapefileArea.Custom
Dim data As CustomShapefileData = New CustomShapefileData()
data.ShapeData = File.ReadAllBytes("..\..\Map\USA.shp")
data.AttributeData = File.ReadAllBytes("..\..\Map\USA.dbf")
map.CustomShapefile.Data = data
dashboard.Items.Add(map)
dashboardViewer.Dashboard = dashboard
End Sub
End Class
End Namespace