home *** CD-ROM | disk | FTP | other *** search
- <html>
- <head>
- <title>3D Pie Chart</title>
- </head>
- <body>
-
- <!-- ---------------------------------------------------------------- -->
- <!-- The following script is a sample script designed to demonstrate -->
- <!-- a method for creating real-time dynamic pie charts from data -->
- <!-- held within databases. -->
- <!-- -->
- <!-- This sample connects to a database (via DSN) and reads data from -->
- <!-- a table "SalesBar". It then constructs the html page dynamically -->
- <!-- inserting the values from the result set into the parameters of -->
- <!-- the Pie Chart Applet. -->
- <!-- -->
- <!-- You may freely copy and modify this script to suite your own -->
- <!-- requirements. -->
- <!-- -->
- <!-- ---------------------------------------------------------------- -->
-
- <%
- ' -- Make Database Connection
- DIM objConn
- Set objConn = Server.CreateObject("ADODB.Connection")
- objConn.ConnectionString = "DSN=myCONNECTION.dsn"
- objConn.Open
- %>
-
-
- <%
- ' -- Perform SQL query for Product X
- DIM mySQL1, objRS1
- mySQL1 = "Select Value from SalesBar where Year=2004 and Product='X' ORDER BY Month"
- Set objRS1 = Server.CreateObject("ADODB.Recordset")
- objRS1.Open mySQL1, objConn
-
-
- ' -- Perform SQL query for Product Y
- DIM mySQL2, objRS2
- mySQL2 = "Select Value from SalesBar where Year=2004 and Product='Y' ORDER BY Month"
- Set objRS2 = Server.CreateObject("ADODB.Recordset")
- objRS2.Open mySQL2, objConn
- %>
-
-
-
- <applet code='PiechartApplet.class' archive='Piechart.jar' width='500' height='420'>
-
- <!-- Start Up Parameters -->
- <PARAM name='LOADINGMESSAGE' value='Pie Chart Loading - Please Wait.'> <!-- Message to be displayed on Startup -->
- <PARAM name='STEXTCOLOR' value='0,0,100'> <!-- Message Text Color-->
- <PARAM name='STARTUPCOLOR' value='255,255,255'> <!-- Applet Background color -->
-
- <!-- Property file -->
- <PARAM name='chartproperties' value='piepropsdb.txt'>
-
- <!-- Chart Data -->
-
- <%
- DIM iDataCount
-
- ' Construct data Param tags for series 1
- iDataCount = 0
- DO WHILE NOT objRS1.EOF
- iDataCount = iDataCount + 1
- %>
-
- <param name='data<%=iDataCount%>series1' value='<%=objRS1("Value")%>'>
-
- <%
- objRS1.MoveNext
- Loop
- objRS1.Close
- %>
-
-
- <%
- ' Construct data Param tags for series 2
- iDataCount = 0
- DO WHILE NOT objRS2.EOF
- iDataCount = iDataCount + 1
- %>
-
- <param name='data<%=iDataCount%>series2' value='<%=objRS2("Value")%>'>
-
- <%
- objRS2.MoveNext
- Loop
- objRS2.Close
- %>
-
- </applet>
-
-
- <%
- ' Close Database Connection
- objConn.Close()
- Set objConn = Nothing
- %>
-
- </body>
- </html>
-