Example 39: Stacked bars
(VB.NET)
This sampe code will draw
a fancy stacked bars chart.
Steps:
1. Create a new Windows
application project VB.NET)
2. Add Super 2d/3d Graph
Library to the toolbox pallete, drag it
to Form1.
3. Copy and paste de
following code:
Form Code
Imports Super2d3dGraphLibrary
Public Class Form1
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Dim myData(2) As ArrayList
' Some quick random data...
myData(0) = New ArrayList
myData(0).Add(25)
myData(0).Add(17)
myData(0).Add(24)
myData(0).Add(66)
myData(1) = New ArrayList
myData(1).Add(5)
myData(1).Add(23)
myData(1).Add(8)
myData(1).Add(42)
myData(2) = New ArrayList
myData(2).Add(92)
myData(2).Add(18)
myData(2).Add(19)
myData(2).Add(55)
With Super2d3dGraph1
.LicenseeIdentifier = "PROF"
' General appearance
.Title = "Requirements Status"
.Series = myData
.Style =
STYLE2D3D.STYLE2D_BAR
.BackStyle =
STYLEBACKGROUND.STYLEBACKGROUND_SOLID
.BackColor =
Color.White
' Data-table
.ShowDataTable = True
.DataTableText = ""
.ValuesFormat = "0"
' Yaxis look & feel
.YAxisTitle = ""
.YAxisDividersCount = 10
.YAxisNumericFormat = "0" ' <- No decimals
.YAxisScaleMaximum
= 100
.YAxisScaleMinimum
= 0
.YAxisScaleMode =
SCALEMODE.SCALEMODE_FIXED
' Legend look & feel
.ShowValues = False
.LegendFont = New Font("Calibri",
11)
.SeriesLegend = New String()
{"Rel1", "Rel2", "Not assigned"}
.SeriesColor = New Color() {Color.Yellow, Color.Brown,
Color.Cyan}
.LegendAlignment =
STYLEALIGNMENT.STYLEALIGNMENT_MIDDLE_RIGHT
.LegendText = "" ' <- Hide legend title
.ShowLegend = True
' X-Axis look & feel
.ItemsLegend = New String()
{"Raised", "Closed", "Cancelled", "Approved"}
.ShowItemsLegend = True
.XAxisTitle = ""
.ShowXAxis = True
.RefreshChart()
End With
End Sub
End Class
Result:

|