|
Server : Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 PHP/5.2.17 System : Linux localhost 2.6.18-419.el5 #1 SMP Fri Feb 24 22:47:42 UTC 2017 x86_64 User : nobody ( 99) PHP Version : 5.2.17 Disable Function : NONE Directory : /home/queenjbs/www/FusionChart/Code/VB_NET/DBExample/ |
Upload File : |
Imports InfoSoftGlobal
Imports System.Text
Imports DataConnection
Partial Class DBExample_Detailed
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
'This page is invoked from Default.asp. When the user clicks on a pie
'slice in Default.aspx, the factory Id is passed to this page. We need
'to get that factory id, get information from database and then show
'a detailed chart.
'First, get the factory Id
Dim factoryId As String
'Request the factory Id from Querystring
factoryId = Request("FactoryId")
'xmlData will be used to store the entire XML document generated
Dim xmlData As New StringBuilder()
'Generate the chart element string
xmlData.Append("<chart palette='2' caption='Factory " & factoryId & " Output ' subcaption='(In Units)' xAxisName='Date (dd/MM)' showValues='1' labelStep='2' >")
'Now, we get the data for that factory
Dim query As String = "select DatePro, Quantity from Factory_Output where FactoryId=" & factoryId
Dim oRs As New DbConn(query)
'Iterate through each record
While oRs.ReadData.Read()
'Convert date from database into dd/mm format
'Generate <set name='..' value='..' />
xmlData.Append("<set label='" & Convert.ToDateTime(oRs.ReadData("DatePro")).ToString("dd/MM") & "' value='" & oRs.ReadData("Quantity").ToString() & "'/>")
End While
oRs.ReadData.Close()
'Close <chart> element
xmlData.Append("</chart>")
'Create the chart - Column 2D Chart with data from xmlData
Literal1.Text = FusionCharts.RenderChart("../FusionCharts/Column2D.swf", "", xmlData.ToString(), "FactoryDetailed", "600", "300", False, True)
End Sub
End Class