This repository has been archived by the owner on Oct 2, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Form1.vb
86 lines (69 loc) · 3.48 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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
Imports System
Imports System.Collections.Generic
Imports DevExpress.DashboardCommon
Imports DevExpress.DataAccess.ConnectionParameters
Imports DevExpress.DataAccess.Sql
Imports DevExpress.XtraEditors
Namespace Dashboard_CreateBubbleMap
Partial Public Class Form1
Inherits XtraForm
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load
' Creates a new dashboard and a data source for this dashboard.
Dim dashboard As New Dashboard()
Dim dataSource As New DashboardSqlDataSource()
dataSource.ConnectionParameters =
New XmlFileConnectionParameters("..\..\Data\DashboardEnergyStatictics.xml")
Dim sqlQuery As SelectQuery = SelectQueryFluentBuilder.AddTable("Countries") _
.SelectColumns("Latitude", "Longitude", "Production", "Import", "Country") _
.Build("Countries")
dataSource.Queries.Add(sqlQuery)
dashboard.DataSources.Add(dataSource)
' Creates a Bubble Map dashboard item and specifies its data source.
Dim bubbleMap As New BubbleMapDashboardItem()
bubbleMap.DataSource = dashboard.DataSources(0)
bubbleMap.DataMember = "Countries"
' Loads the map of the world.
bubbleMap.Area = ShapefileArea.Europe
' Provides cities' coordinates.
bubbleMap.Latitude = New Dimension("Latitude")
bubbleMap.Longitude = New Dimension("Longitude")
' Specifies measures used to evaluate bubble weights and colors.
bubbleMap.Weight = New Measure("Production", SummaryType.Sum)
bubbleMap.Color = New Measure("Import", SummaryType.Sum)
bubbleMap.Color.NumericFormat.FormatType = DataItemNumericFormatType.General
' Provides additional values displayed within bubble tooltips.
bubbleMap.TooltipDimensions.Add(New Dimension("Country"))
' Specifies a custom scale and shows map legends.
CustomizeScale(bubbleMap)
ShowLegends(bubbleMap)
' Adds the Bubble Map dashboard item to the dashboard and opens this
' dashboard in the Dashboard Viewer.
dashboard.Items.Add(bubbleMap)
dashboardViewer1.Dashboard = dashboard
End Sub
Private Sub CustomizeScale(ByVal map As BubbleMapDashboardItem)
Dim customScale As New CustomScale()
Dim rangeStops As New List(Of Double)()
' Specifies that the absolute scale is used to define a set of range stops.
customScale.IsPercent = False
' Specifies custom range stops.
rangeStops.Add(20)
rangeStops.Add(200)
rangeStops.Add(500)
rangeStops.Add(2000)
' Adds custom range stops to a custom scale.
customScale.RangeStops.AddRange(rangeStops)
map.ColorScale = customScale
End Sub
Private Sub ShowLegends(ByVal map As BubbleMapDashboardItem)
' Enables map legends and specifies its position and orientation.
map.Legend.Visible = True
map.Legend.Orientation = MapLegendOrientation.Horizontal
map.WeightedLegend.Visible = True
map.WeightedLegend.Position = MapLegendPosition.BottomLeft
End Sub
End Class
End Namespace