Grafik Pertumbuhan Order di Classic ASP

Grafik Pertumbuhan Order

<%

Const IMAGES_PATH = “images/”
Const WIDTH_YGRAF_IMAGE = 36
Const HEIGHT_YGRAF_IMAGE = 111
Const adStateOpen = &H00000001
Const adCmdTableDirect = &H0200

Dim oChart1, oChart2, oChart3, oChart4, oChart5, oChart6
Dim i, bSuccess

Dim m_oRs
Dim m_sConnectionString
Dim SQLTh2004, SQLTh2005, SQLTh2006
Dim m_arrTh2004, m_arrTh2005, m_arrTh2006
Dim m_arrData()
Dim m_arrLabels(), m_arrLabels2, m_arrLabels3

‘Buat label bulan u/. diletakkan pada bagian bawah grafik

m_arrLabels2 = Array(“Jan”, “Peb”, “Mar”, “Apr”, “Mei”, “Jun”, “Jul”, “Agu”, “Sep”, “Okt”, “Nop”, “Des”)
m_arrLabels3 = Array(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12)

‘Buat koneksi kedalam database
m_sConnectionString = “Provider=Microsoft.Jet.OLEDB.4.0; Data Source=” & Server.MapPath(“Dtbs/Mdb09/tumbuhkembangOrder.mdb”)

‘Inisialisasi SQL
SQLTh2004 = “SELECT Th2004 FROM Table_Grafik_Pertumbuhan_Order”
SQLTh2005 = “SELECT Th2005 FROM Table_Grafik_Pertumbuhan_Order”
SQLTh2006 = “SELECT Th2006 FROM Table_Grafik_Pertumbuhan_Order”

‘Buat RecordSet
Set m_oRs = Server.CreateObject(“ADODB.Recordset”)

‘ Ambil 3 field dari database dengan metode GetRows
‘ Penambahan field bisa dilakukan dengan merubah juga file : grafiknya.asp & cMultipleVerticalChart.asp

m_arrTh2004 = GetRows(SQLTh2004)
m_arrTh2005 = GetRows(SQLTh2005)
m_arrTh2006 = GetRows(SQLTh2006)

‘Tutup koneksi kedatabase
m_oRs.Close
Set m_oRs = Nothing

‘Panggil data
Call LoadFakeData

‘Inisialisasi data untuk label
For i = 0 To UBound(m_arrData)
Redim Preserve m_arrLabels(i)
m_arrLabels(i) = i + 1
Next

‘— Mulai pembentukan grafik

Set oChart2 = New cMultipleVerticalChart

With oChart2
.ChartTitle = ” Pertumbuhan Order 2004 – 2006″
.FooterText = ” Catatan : Klik Update Grafik u/. menampilkan grafik terbaru”
.TableCaption = “Tabel Pertumbuhan Order”
.BarWidth = 12

.TotalsMode = 2

.DisplayYGrafImage = IMAGES_PATH & “y100.gif”

.AddBarImages = Array(IMAGES_PATH & “1x1_B0C4DD.gif”, IMAGES_PATH & “1x1_FFC19F.gif”, IMAGES_PATH & “1x1_CC9A7F.gif”)

.AddLegendText = Array(“2004”, “2005”, “2006”)

If Not .AddData(m_arrTh2004) Then Response.Write “Pesan Kesalahan : ” & .ErrorMessage
If Not .AddData(m_arrTh2005) Then Response.Write “Pesan Kesalahan : ” & .ErrorMessage
If Not .AddData(m_arrTh2006) Then Response.Write “Pesan Kesalahan : ” & .ErrorMessage

If Not .AddLabels(m_arrLabels2) Then Response.Write “Pesan Kesalahan : ” & .ErrorMessage

If Not .CreateChart Then Response.Write “Pesan Kesalahan : ” & .ErrorMessage
End With

Set oChart2 = Nothing

If Err Then Response.Write ”
Kode Kesalahan = ” & Err.Number & ”
” & Err.Description

%>

Categories: Classic ASP | Tinggalkan komentar

Navigasi pos

Tinggalkan Balasan

Please log in using one of these methods to post your comment:

Logo WordPress.com

You are commenting using your WordPress.com account. Logout / Ubah )

Gambar Twitter

You are commenting using your Twitter account. Logout / Ubah )

Foto Facebook

You are commenting using your Facebook account. Logout / Ubah )

Foto Google+

You are commenting using your Google+ account. Logout / Ubah )

Connecting to %s

Blog di WordPress.com.

%d blogger menyukai ini: