Example 3: Create an
area/bar combo chart
This example is a little
more complicated because two charts are
involved and this time I'm customizing many
aspects of each chart. I demonstrate the
power of Super 2d/3d Graph Library to
combine two instances of the chart library
and produce one fusioned chart (area + bar
types).
1. Create a new Windows
application project (VB.NET)
2. Add Super 2d/3d Graph
Library to the toolbox pallete and 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
arrBarChartValues(0)
As
ArrayList
Dim
strItems(50)
As
String
' Configure main chart (area chart)
arrBarChartValues(0) =
New
ArrayList
With
Super2D3dGraph1
.LicenseeIdentifier =
"STAND" ' Combo requires Premium
License
.AutoRefresh =
False
' Increase speed
.Style = STYLE2D3D.STYLE2D_STACKED_AREA
.Title =
"Area/Bar Combo Chart"
For k
As
Integer
= 0
To 50
arrBarChartValues(0).Add(Rnd()
* 25000 + 25000)
strItems(k) = k
Next
.Series = arrBarChartValues
' Assign values to area chart
.ItemsLegend = strItems
.SeriesLegend =
New
String()
{"Team
1 score"}
.SeriesColor =
New
Color() {Color.LightYellow}
.XAxisDividersCount = 10
' # of items in the X-axis
.ShowDividerX =
False
' Hide vertical lines
.YAxisScaleMode = SCALEMODE.SCALEMODE_FIXED
.YAxisScaleMaximum = 50000
.YAxisScaleMinimum = 0
.YAxisTitle =
"Score"
.XAxisTitle =
"Game"
.ShowValues =
False
' Hide values over chart
.ShowLegend =
True
.LegendAlignment =
STYLEALIGNMENT.STYLEALIGNMENT_BOTTOM_CENTER
.LegendText =
""
' Hide legend's title
.ShowDataTable =
False
End
With
' Now create the second chart (bar or
column chart)
Dim
oBarChart
As
New
Super2d3dGraphLibrary.Super2D3dGraph
Dim
arrSeries(0)
As
ArrayList, arrItems(15)
As
String
arrSeries(0) =
New
ArrayList
Dim p
As
Integer
= Rnd() * 50 + 50
With
oBarChart
.AutoRefresh =
False
For k
As
Integer
= 0
To 15
arrSeries(0).Add(p)
p += Rnd() * 10 - 5
If p <
50
Then
p += 25
ElseIf p
> 99
Then
p -= 25
End
If
arrItems(k) = k
Next
.Series = arrSeries
.Style = STYLE2D3D.STYLE2D_BAR
.YAxisLocation =
STYLEYAXISLOCATION.STYLEYAXISLOCATION_RIGHT
.YAxisDividersCount = 10
.YAxisScaleMode = SCALEMODE.SCALEMODE_FIXED
.YAxisScaleMinimum = 0
.YAxisScaleMaximum = 150
.SeriesLegend =
New
String()
{"Team
2 score"}
.ItemsLegend = arrItems
.ShowValues =
False
.ShowDividerX =
True
.XAxisDividersCount = 10
.XAxisLabelsRotated =
True
.ShowXAxis =
True
End
With
' Add the second chart to current chart
Super2D3dGraph1.ChartAdd(oBarChart)
' Draw the composition
Super2D3dGraph1.AutoRefresh =
True
End
Sub ' Form_Load
End
Class
Result:

|