You are on page 1of 8

2012

YOGI RIZAL SINATRYA 7410040045 2D4 ITB

[STATISTIK DAN PROBABILITAS]


[Type the abstract of the document here. The abstract is typically a short summary of the contents of the document. Type the abstract of the document here. The abstract is typically a short summary of the contents of the document.]

CAPTURER CHART BAR BUILT FROM VISUAL BASIC 6.0

SETELAH DIRUNNING -

Visual basic 6.0 YOGI RIZAL SINATRYA 7410040045 2 D4 IT - B

CHART

Visual basic 6.0 YOGI RIZAL SINATRYA 7410040045 2 D4 IT - B

SOURCE CODE FORM : Dim max, min, median As Integer Dim rata, total As Single Dim freq() As Single Dim hitung As Single Dim nilai() As Integer Dim X As Integer Private Sub Label3_Click() End Sub Private Sub Text1_KeyPress(KeyAscii As Integer) If KeyAscii = 13 Then If Not IsNumeric(Text1.Text) Then MsgBox "masukan angka bukan huruf" Else List1.AddItem (Text1.Text) total = total + Val(Text1.Text) rata = total / List1.ListCount X = List1.ListCount / 2 If List1.ListCount = 1 Then max = Text1.Text min = Text1.Text End If If max < Val(Text1.Text) Then max = Text1.Text End If If min > Val(Text1.Text) Then min = Text1.Text End If If List1.ListCount = X Then

Visual basic 6.0 YOGI RIZAL SINATRYA 7410040045 2 D4 IT - B

median = List1.ListCount End If Text2.Text = min Text3.Text = max Text4.Text = total Text5.Text = rata Text7.Text = median

If List1.ListCount = 1 Then ReDim Preserve nilai(0) ReDim Preserve freq(0) nilai(0) = Text1.Text freq(0) = 1 Else Dim ada As Boolean For i = 0 To UBound(nilai) If Text1.Text = nilai(i) Then freq(i) = freq(i) + 1 ada = True Exit For End If Next If Not ada Then ReDim Preserve nilai(i) ReDim Preserve freq(i) nilai(i) = Text1.Text freq(i) = 1 End If Dim tmp1 As Single, tmp2 As Single For k = 0 To UBound(nilai) If k = 0 Then

Visual basic 6.0 YOGI RIZAL SINATRYA 7410040045 2 D4 IT - B

tmp1 = nilai(k) tmp2 = freq(k) ElseIf freq(k) > tmp2 Then tmp1 = nilai(k) tmp2 = freq(k) End If Text6.Text = tmp1 Next End If Text1.Text = "" Text1.SetFocus End If End If End Sub

CHART BAR Private Sub Form_Load() 'Mengisi combo box dengan beberapa jenis chart types. With Combo1 .AddItem "3D Bar" .AddItem "2D Bar" .AddItem "3D Line" .AddItem "2D LIne" .AddItem "3D Area" .AddItem "2D Area" .AddItem "3D Step" .AddItem "2D Step" .AddItem "3D Combination" .AddItem "2D Combination" End With

Visual basic 6.0 YOGI RIZAL SINATRYA 7410040045 2 D4 IT - B

'Mendeklarasikan variabel 2D array untuk menyimpan nilai dari chart Dim X(1 To 2, 1 To 9) As Variant

X(1, 2) = "data - 1" X(1, 3) = "data - 2" X(1, 4) = "data - 3" X(1, 5) = "data - 4" X(1, 6) = "data - 5" X(1, 7) = "data - 6" X(1, 8) = "data - 7" X(1, 9) = "data - 8"

X(2, 1) = "DATA" X(2, 2) = 1 X(2, 3) = 3 X(2, 4) = 2 X(2, 5) = 2 X(2, 6) = 1 X(2, 7) = 2 X(2, 8) = 4 X(2, 9) = 1 '2D array merupakan data untuk chart control. MSChart1.ChartData = X 'Default chart type adalah 2D bar chart. MSChart1.chartType = 1

End Sub

Private Sub Check1_Click() If Check1.Value = 1 Then

Visual basic 6.0 YOGI RIZAL SINATRYA 7410040045 2 D4 IT - B

'Show Legends MSChart1.ShowLegend = True Check1.Caption = "&Hide Legends" Else 'Hide Legends MSChart1.ShowLegend = False Check1.Caption = "&Show Legends" End If End Sub

Private Sub Combo1_Click() 'untuk mengubah type chart saat run time. MSChart1.chartType = Combo1.ListIndex End Sub

Visual basic 6.0 YOGI RIZAL SINATRYA 7410040045 2 D4 IT - B

You might also like