Langkah 1 :
Download
terlebih dahulu component MSCHART.OCX (Microsoft Chart Control, versi 6.0).
Dapat di download pada : http://www.ocxme.com/ocx/files/mschart_ocx.html
Langkah 2 :
Klik kanan pada salah satu bagian pada
Toolbox, misalnya Common Controls dan pilih Choose Items.
Langkah 3 :
Kemudian
pilih tab COM dan klik tombol Browse, carilah component MSCHART.OCX
yang telah di download.
Langkah 4 :
Setelah
itu contreng checkbox pada Microsoft Chart Control, versi 6.0. Kemudian klik
tombol Ok, maka terlihat pada toolbox di bagian Common Controls.
Langkah 5 :
Kemudian
buatlah dengan menggunakan toolbox Microsoft Chart Control dan Combo Box,
tampilan seperti berikut ini :
Toolbox
|
Propertie
|
Ketrangan
|
Form1
|
Text
|
GRAPHIC
|
AxMSChart1
|
Name
|
AxMSChart1
|
ComboBox1
|
Name
|
CmbPilih
|
Code :
Public Class FormGraphics
Private Sub
CmbPilih_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) _
Handles CmbPilih.SelectedIndexChanged
With AxMSChart1
If
CmbPilih.SelectedItem = "Pie" Then
.chartType = MSChartLib.VtChChartType.VtChChartType2dPie
Else
.chartType = MSChartLib.VtChChartType.VtChChartType3dBar
End
If
.ColumnCount = 5
.RowCount = 4
.ShowLegend = True
.TitleText = "LAPORAN NEM SMU 5 BESAR (2002 – 2005)"
.Row = 1
.RowLabel = "2002"
.Column = 1
.ColumnLabel = "IBUNDA"
.Data = 85
.Column = 2
.ColumnLabel = "77"
.Data = 87.5
.Column = 3
.ColumnLabel = "83"
.Data = 82.75
.Column = 4
.ColumnLabel = "MULIA"
.Data = 90
.Column = 5
.ColumnLabel = "67"
.Data = 82
.Row = 2
.RowLabel = "2003"
.Column = 1
.Data = 88.5
.Column = 2
.Data = 88
.Column = 3
.Data = 92
.Column = 4
.Data = 85.5
.Column = 5
.Data = 81.75
.Row = 3
.RowLabel = 2004
.Column = 1
.Data = 79.5
.Column = 2
.Data = 80.75
.Column = 3
.Data = 89
.Column = 4
.Data = 86.75
.Column = 5
.Data = 85.75
.Row = 4
.RowLabel = 2005
.Column = 1
.Data = 78
.Column = 2
.Data = 87
.Column = 3
.Data = 90
.Column = 4
.Data = 88
.Column = 5
.Data = 93
End With
End Sub
Private Sub
FormGraphics_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
CmbPilih.Items.Add("Bar 3D")
CmbPilih.Items.Add("Pie")
End Sub
End Class
Program saat di running :
Bar 3D
Pie