-
Notifications
You must be signed in to change notification settings - Fork 1
/
Form1.vb
46 lines (42 loc) · 1.95 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
Imports System
Imports System.Windows.Forms
Imports DevExpress.XtraCharts
' ...
Namespace Series_StackedBarChart
Public Partial Class Form1
Inherits Form
Public Sub New()
InitializeComponent()
End Sub
Private Sub Form1_Load(ByVal sender As Object, ByVal e As EventArgs)
' Create a new chart.
Dim stackedBarChart As ChartControl = New ChartControl()
' Create two stacked bar series.
Dim series1 As Series = New Series("Series 1", ViewType.StackedBar)
Dim series2 As Series = New Series("Series 2", ViewType.StackedBar)
' Add points to them
series1.Points.Add(New SeriesPoint("A", 10))
series1.Points.Add(New SeriesPoint("B", 12))
series1.Points.Add(New SeriesPoint("C", 14))
series1.Points.Add(New SeriesPoint("D", 17))
series2.Points.Add(New SeriesPoint("A", 15))
series2.Points.Add(New SeriesPoint("B", 18))
series2.Points.Add(New SeriesPoint("C", 25))
series2.Points.Add(New SeriesPoint("D", 33))
' Add both series to the chart.
stackedBarChart.Series.AddRange(New Series() {series1, series2})
' Access the view-type-specific options of the series.
CType(series1.View, StackedBarSeriesView).BarWidth = 0.8
' Access the type-specific options of the diagram.
CType(stackedBarChart.Diagram, XYDiagram).Rotated = True
' Hide the legend (if necessary).
stackedBarChart.Legend.Visibility = DevExpress.Utils.DefaultBoolean.[False]
' Add a title to the chart (if necessary).
stackedBarChart.Titles.Add(New ChartTitle())
stackedBarChart.Titles(0).Text = "A Stacked Bar Chart"
' Add the chart to the form.
stackedBarChart.Dock = DockStyle.Fill
Me.Controls.Add(stackedBarChart)
End Sub
End Class
End Namespace