Example 2: 3D Pie Chart Demo
In previous tutorial, I
used SeriesFactory helper class to assign
values to the chart. This time I will use
the Series property to assign values to the
pie chart. You can use series property or
SeriesFactory class, the result is the same.
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
Private Sub
Form1_Load(ByVal sender As System.Object,
ByVal e As System.EventArgs) Handles
MyBase.Load
' Prepare de values for the chart (1 serie of 7 random values)
Dim series(0) As ArrayList ' Values for each pie sector
Dim items(7) As String ' Labels for pie sectors
Dim explode(7) As String ' Indicate if the sector is exploded
series(0) = New ArrayList
For k As Integer = 0 To 6
series(0).Add(Rnd() * 25) ' Random value for the
sector
items(k) = "Item " & (k + 1) ' Name for this
sector
If k = 0 Then
explode(k) = "Yes" ' Explode
this sector
Else
explode(k) = ""
' Don't explode this sector
End If
Next
With Super2D3dGraph1
.AutoRefresh = False ' This prevents
refreshing after each command
.LicenseeIdentifier = "STAND" ' This is the
demo license
.ItemsHighlight = explode ' Set which sectors
will explode
.ItemsLegend = items ' Set sectors' labels
.Series = series ' Set values for each sector
.ShowItemsLegend = True ' Show item names on
top of datatable
.ShowLegend = False ' Don't show the legend
.Style = Super2d3dGraphLibrary.STYLE2D3D.STYLE3D_PIE
.RefreshChart() ' Finally, draw the pie chart
End With
End Sub
Result:

|