-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathForm1.vb
57 lines (51 loc) · 2.21 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
Imports System
Imports System.Data
Imports System.Windows.Forms
Imports DevExpress.XtraCharts
' ...
Namespace BindIndividualSeriesRuntimeCS
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Function CreateChartData(ByVal rowCount As Integer) As DataTable
' Create an empty table.
Dim table As DataTable = New DataTable("Table1")
' Add two columns to the table.
table.Columns.Add("Argument", GetType(Integer))
table.Columns.Add("Value", GetType(Integer))
' Add data rows to the table.
Dim rnd As Random = New Random()
Dim row As DataRow = Nothing
For i As Integer = 0 To rowCount - 1
row = table.NewRow()
row("Argument") = i
row("Value") = rnd.Next(100)
table.Rows.Add(row)
Next
Return table
End Function
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
' Create a chart.
Dim chart As ChartControl = New ChartControl()
' Create an empty Bar series and add it to the chart.
Dim series As Series = New Series("Series1", ViewType.Bar)
chart.Series.Add(series)
' Generate a data table and bind the series to it.
series.DataSource = CreateChartData(50)
' Specify data members to bind the series.
series.ArgumentScaleType = ScaleType.Numerical
series.ArgumentDataMember = "Argument"
series.ValueScaleType = ScaleType.Numerical
series.ValueDataMembers.AddRange(New String() {"Value"})
' Set some properties to get a nice-looking chart.
CType(series.View, SideBySideBarSeriesView).ColorEach = True
CType(chart.Diagram, XYDiagram).AxisY.Visibility = DevExpress.Utils.DefaultBoolean.False
chart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.False
' Dock the chart into its parent and add it to the current form.
chart.Dock = DockStyle.Fill
Me.Controls.Add(chart)
End Sub
End Class
End Namespace