/Scripts/FusionCharts/Code/ASPClass/DB_DrillDown/Detailed.asp

https://github.com/eriknjenga/ADT · ASP · 99 lines · 62 code · 12 blank · 25 comment · 2 complexity · aeb690287bcf7890c7e00b398c0c1eee MD5 · raw file

  1. <%@LANGUAGE="VBSCRIPT"%>
  2. <% option explicit %>
  3. <%
  4. 'We've included ../Includes/FusionCharts_Gen.asp, which contains
  5. 'FusionCharts ASP Class to help us easily embed charts
  6. 'We've also used ../Includes/DBConn.asp to easily connect to a database
  7. %>
  8. <!--#include file="../Includes/DBConn.asp"-->
  9. <!--#include file="../Includes/FusionCharts_Gen.asp"-->
  10. <HTML>
  11. <HEAD>
  12. <TITLE>
  13. FusionCharts V3 - Database and Drill-Down Example
  14. </TITLE>
  15. <%
  16. 'You need to include the following JS file, if you intend to embed the chart using JavaScript.
  17. 'Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer
  18. 'When you make your own charts, make sure that the path to this JS file is correct. Else, you would get JavaScript errors.
  19. %>
  20. <SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
  21. <style type="text/css">
  22. <!--
  23. body {
  24. font-family: Arial, Helvetica, sans-serif;
  25. font-size: 12px;
  26. }
  27. .text{
  28. font-family: Arial, Helvetica, sans-serif;
  29. font-size: 12px;
  30. }
  31. -->
  32. </style>
  33. </HEAD>
  34. <BODY>
  35. <CENTER>
  36. <h2><a href="http://www.fusioncharts.com" target="_blank">FusionCharts V3</a> - Database and Drill-Down Example</h2>
  37. <h4>Detailed report for the factory</h4>
  38. <%
  39. 'This page is invoked from Default.asp. When the user clicks on a pie
  40. 'slice in Default.asp, the factory Id is passed to this page. We need
  41. 'to get that factory id, get information from database and then show
  42. 'a detailed chart.
  43. 'Request the factory Id from Querystring
  44. dim FactoryId
  45. FactoryId = Request("FactoryId")
  46. dim FC
  47. ' Create FusionCharts ASP class object
  48. set FC = new FusionCharts
  49. ' Set chart type to Column 2D
  50. Call FC.setChartType("Column2D")
  51. ' Set chart size
  52. Call FC.setSize("600","300")
  53. ' Set Relative Path of swf file.
  54. Call FC.setSWFPath("../../FusionCharts/")
  55. dim strParam
  56. ' Define chart attributes
  57. strParam="caption=Factory " & FactoryId & " Output;subcaption=(In Units);xAxisName=Date;rotateLabels=1;slantLabels=1"
  58. ' Set chart attributes
  59. Call FC.setChartParams(strParam)
  60. 'Now, we get the data for that factory
  61. 'storing chart values in 'Quantity' column and category names in 'DDate'
  62. dim strQuery
  63. strQuery = "select Quantity, format(DatePro,'dd/MM/yyyy') as DDate from Factory_Output where FactoryId=" & FactoryId
  64. 'For SQL Server 2000 Query
  65. 'strQuery = "select Quantity, convert(varchar,DatePro,103) as DDate from Factory_Output where FactoryId=" & FactoryId
  66. Dim oRs
  67. 'Create the recordset to retrieve data
  68. Set oRs = Server.CreateObject("ADODB.Recordset")
  69. Set oRs = oConn.Execute(strQuery)
  70. 'Pass the SQL query result to the FusionCharts ASP Class' function
  71. 'that will extract data from database and add to the chart.
  72. if not oRs.bof then
  73. Call FC.addDataFromDatabase(oRs, "Quantity", "DDate","","")
  74. end if
  75. oRs.Close
  76. set oRs=Nothing
  77. 'Create the chart
  78. Call FC.renderChart(false)
  79. %>
  80. <BR>
  81. <a href='Default.asp'>Back to Summary</a>
  82. <BR><BR>
  83. <a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
  84. <H5 ><a href='../default.htm'>&laquo; Back to list of examples</a></h5>
  85. </CENTER>
  86. </BODY>
  87. </HTML>