/Scripts/FusionCharts/Code/ASP/DBExample/Detailed.asp

https://github.com/eriknjenga/ADT · ASP · 78 lines · 56 code · 5 blank · 17 comment · 1 complexity · 1280d42f8bb4e3cfe05b37d0163498b3 MD5 · raw file

  1. <%@ Language=VBScript %>
  2. <HTML>
  3. <HEAD>
  4. <TITLE>
  5. FusionCharts - Database and Drill-Down Example
  6. </TITLE>
  7. <%
  8. 'You need to include the following JS file, if you intend to embed the chart using JavaScript.
  9. 'Embedding using JavaScripts avoids the "Click to Activate..." issue in Internet Explorer
  10. 'When you make your own charts, make sure that the path to this JS file is correct. Else, you would get JavaScript errors.
  11. %>
  12. <SCRIPT LANGUAGE="Javascript" SRC="../../FusionCharts/FusionCharts.js"></SCRIPT>
  13. <style type="text/css">
  14. <!--
  15. body {
  16. font-family: Arial, Helvetica, sans-serif;
  17. font-size: 12px;
  18. }
  19. .text{
  20. font-family: Arial, Helvetica, sans-serif;
  21. font-size: 12px;
  22. }
  23. -->
  24. </style>
  25. </HEAD>
  26. <%
  27. 'We've included ../Includes/FusionCharts.asp, which contains functions
  28. 'to help us easily embed the charts.
  29. %>
  30. <!-- #INCLUDE FILE="../Includes/FusionCharts.asp" -->
  31. <!-- #INCLUDE FILE="../Includes/DBConn.asp" -->
  32. <BODY>
  33. <CENTER>
  34. <h2>FusionCharts Database and Drill-Down Example</h2>
  35. <h4>Detailed report for the factory</h4>
  36. <%
  37. 'This page is invoked from Default.asp. When the user clicks on a pie
  38. 'slice in Default.asp, the factory Id is passed to this page. We need
  39. 'to get that factory id, get information from database and then show
  40. 'a detailed chart.
  41. 'First, get the factory Id
  42. Dim FactoryId
  43. 'Request the factory Id from Querystring
  44. FactoryId = Request.QueryString("FactoryId")
  45. Dim oRs, strQuery
  46. 'strXML will be used to store the entire XML document generated
  47. Dim strXML, intCounter
  48. intCounter = 0
  49. Set oRs = Server.CreateObject("ADODB.Recordset")
  50. 'Generate the chart element string
  51. strXML = "<chart palette='2' caption='Factory " & FactoryId &" Output ' subcaption='(In Units)' xAxisName='Date' showValues='1' labelStep='2' >"
  52. 'Now, we get the data for that factory
  53. strQuery = "select * from Factory_Output where FactoryId=" & FactoryId
  54. Set oRs = oConn.Execute(strQuery)
  55. While Not oRs.Eof
  56. 'Here, we convert date into a more readable form for set label.
  57. strXML = strXML & "<set label='" & datePart("d",ors("DatePro")) & "/" & datePart("m",ors("DatePro")) & "' value='" & ors("Quantity") & "'/>"
  58. Set oRs2 = Nothing
  59. oRs.MoveNext
  60. Wend
  61. 'Close <chart> element
  62. strXML = strXML & "</chart>"
  63. Set oRs = nothing
  64. 'Create the chart - Column 2D Chart with data from strXML
  65. Call renderChart("../../FusionCharts/Column2D.swf", "", strXML, "FactoryDetailed", 600, 300, false, false)
  66. %>
  67. <BR>
  68. <a href='Default.asp?animate=0'>Back to Summary</a>
  69. <BR><BR>
  70. <a href='../NoChart.html' target="_blank">Unable to see the chart above?</a>
  71. </CENTER>
  72. </BODY>
  73. </HTML>