The article contains two parts, generates file names and file contents, and invokes drawing diagrams;
A good example can be found in the download bar:
http://download.csdn.net/source/2831164
Here is how to generate the code of the file, a good example of the path of a small change has been in line with the actual situation.
<!--#include file= "conn.asp"-->
<!--#include file= "mycss.asp"-->
<%
Set Fs=server. CreateObject ("Scripting.FileSystemObject")
Mainkey=request ("Mainkey")
Modkey=request ("Modkey")
Srs=request ("SRS")
Filerorw=request ("Rorw")
Select Case Modkey
Case "Year"
mytitle= "Machine breakdown Type Reason Frequency" &srs& "of" &year (Mainkey) & "Y"
Filename= "Breakdowntypereason" &year (mainkey) & "Y.xml"
wherestr=wherestr& "and year (breakdowntime) =" &year (CDate (Mainkey))
Case "Month"
mytitle= "Machine breakdown Type Reason Frequency" &srs& "of" &year (Mainkey) & "Y" &month (Mainkey) & "M"
Filename= "Breakdowntypereason" &year (Mainkey) & "-" &month (Mainkey) & "M.xml"
wherestr=wherestr& "and year (breakdowntime) =" &year (CDate (Mainkey)) & "and month (breakdowntime) =" & Month (CDate (Mainkey))
Case "Week"
Se=cdate (Date & "-01-01")
Weeks=datediff ("ww", Se,mainkey)
mytitle= "Machine breakdown Type Reason Frequency" &srs& "of" &year (Mainkey) & "Y" &weeks& "Week"
Filename= "Breakdowntypereason" &year (Mainkey) & "-" &weeks& "W.xml"
Tempdate1=dateadd ("D", 1-weekday (CDate (Mainkey)), Mainkey)
Tempdate2=dateadd ("D", 7-weekday (CDate (Mainkey)), Mainkey)
wherestr=wherestr& "and breakdowntime>= '" &tempdate1& "' and breakdowntime<= '" &tempdate2& " '"
Case Else
Se=cdate (Date & "-01-01")
Weeks=datediff ("ww", Se,mainkey)
mytitle= "Machine breakdown Type Reason Frequency" &srs& "of" &year (Mainkey) & "Y" &weeks& "Week"
Filename= "Breakdowntypereason" &year (Mainkey) & "-" &weeks& "W.xml"
Tempdate1=dateadd ("D", 1-weekday (CDate (Mainkey)), Mainkey)
Tempdate2=dateadd ("D", 7-weekday (CDate (Mainkey)), Mainkey)
wherestr=wherestr& "and breakdowntime>= '" &tempdate1& "' and breakdowntime<= '" &tempdate2& " '"
End Select
Filepath= "xml/" &filename
Fileallname=server.mappath (filepath)
wherestr=wherestr& "and breakdowncode= '" &srs& ""
Sqlstr= "Select Breakdowncodedescription,count (Codeid) as Countcode from Breakdownview where breakdownid>0" & wherestr& "GROUP by Breakdowncodedescription,codeid ORDER by Countcode Desc"
If not FS. FileExists (fileallname) or filerorw= "write" Then
' sqlstr= ' select Codeid as Breakdowncodedescription,count (Codeid) as Countcode from Breakdownview where breakdownid>0 "&wherestr&" GROUP by Codeid ORDER by Countcode Desc "
Dim childnode,createcdatasection
Set Xmldoc=server.createobject ("msxml2.domdocument.4.0")
Set Version = xmldoc.createprocessinginstruction ("xml", "version= ' 1.0 ' encoding= ' utf-8 '")
Xmldoc.appendchild (Version)
Set root = xmldoc. CreateNode (1, "Pie", "")
Xmldoc.appendchild (Root)
Set Rs=conn.execute (sqlstr,0,1)
I=0
Do as not rs.eof
If I=0 Then
Set Childnode=xmldoc. CreateNode (1, "Slice", "")
Childnode.setattribute "title", RS ("Breakdowncodedescription")
Childnode.setattribute "Pull_out", "true"
Childnode.text=rs ("Countcode")
' Set createcdatasection = xmldoc.createcdatasection (rs ("Countcode"))
' Childnode.appendchild (createcdatasection)
Else
Set Childnode=xmldoc. CreateNode (1, "Slice", "")
Childnode.setattribute "title", RS ("Breakdowncodedescription")
Childnode.text=rs ("Countcode")
' Set createcdatasection = xmldoc.createcdatasection (rs ("Countcode"))
' Childnode.appendchild (createcdatasection)
End If
Rs.movenext
I=i+1
Root.appendchild Childnode
Response.Write Err.Description
Loop
Xmldoc.save (Server.MapPath (filepath))
Set rs=nothing
End If
Set fs=nothing
Xmldoc.close
Set xmldoc=nothing
%>
The following is the call to the XML file drawing table.
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
<title>machine breakdown Type Reason Frequency of <%=filename%></title>
<body>
<% Response.Write "<strong>" &mytitle& "</strong>"%>
<!--saved from Url= (0013) about:internet-->
<!--Ampie script-->
<script type= "Text/javascript" src= ". /chart/dup/ampie/swfobject.js "></script>
<div id= "Flashcontent" >
<strong>you need to upgrade your Flash player</strong>
</div>
<script type= "Text/javascript" >
<! [cdata[
var so = new SWFObject (".. /chart/dup/ampie/ampie.swf "," Ampie "," a "," 680 "," 8 "," #FFFFFF ");
So.addvariable ("Path", ". /chart/dup/ampie/");
So.addvariable ("Settings_file", encodeURIComponent) (". /chart/dup/ampie/ampie_settings.xml ")); can set two or more different settings files here (separated by commas)
<% Response.Write "var filename=" "&filename&" ""; "%>
So.addvariable ("Data_file", encodeURIComponent) (". /tpm/xml/"+filename));
The file name and path are on the server, please modify it yourself.
So.addvariable ("Chart_data", encodeURIComponent ("<settings>...</settings>")); Can pass chart data as a string directly from this file
So.addvariable ("Chart_settings", encodeURIComponent ("Data in CSV or XML format")); Can pass chart settings as a string directly from this file
So.addvariable ("Additional_chart_settings", encodeURIComponent ("<settings>...</settings>")); Can append some chart settings to the loaded ones
So.addvariable ("Loading_settings", "Loading settings"); can set custom "Loading settings" text here
So.addvariable ("Loading_data", "Loading Data"); can set custom "loading data" text here
So.addvariable ("Preloader_color", "#999999");
So.addvariable ("Error_loading_file", "Error loading file"); can set custom "error loading file" text here
So.write ("Flashcontent");
]]>
</script>
<!--end of Ampie script-->
<%
Response.Write "<div id= ' scrolldiv ' style= ' width:100%; Overflow:auto;position:absolute; left:850px; top:25px;height:80%; ' > "
Response.Write "<table id= ' accounttable ' border= ' 0 ' cellpadding= ' 0 ' cellspacing= ' 0 ' width= '" ><thead class = ' Fixedheader ' > '
Response.Write "<tr class= ' Fixedtitlerow ' ><th>BreakdownType</th><th>Count</th>< /tr></thead> "
Set Rs=conn.execute (sqlstr,0,1)
Do as not rs.eof
Response.Write "<tr>"
Response.Write "<td>" &rs.fields (0) .value& "</td>"
Response.Write "<td>" &rs.fields (1) .value& "</td>"
Response.Write "</tr>"
Rs.movenext
Loop
Set rs=nothing
Response.Write "</tbody></table></div>"
%>
</body>