cfchart数据单独显示驱动器详细信息

时间:2010-11-02 13:27:51

标签: coldfusion

<html>
<head>

</head>
<body>
<cfhttp method="Get"
 url="http://localhost:90/myweb/xmlwork/xmlfile.cfm">

<cfoutput>
  #cfhttp.filecontent#
</cfoutput>
<br>
<br><br><br>
<!---<cffile action="read" file="http://localhost:90/myweb/xmlfile.cfm" variable="myxml">--->
<cfset mydoc = XmlParse(cfhttp.filecontent)>
<cfset dd = mydoc.StorageList.XmlChildren>
<cfset size = ArrayLen(dd)>
<cfoutput>
Number of Drive = #size#
<br>
</cfoutput>
<br>

<cfset myquery = QueryNew("DriveName,TotalSpace,FreeSpace") >

<cfset temp = QueryAddRow(myquery, #size#)>
<cfloop index="i" from = "1" to = #size#>
  <cfset temp = QuerySetCell(myquery, "DriveName", 
    #mydoc.StorageList.DriveDetails[i].DriveName.XmlText#, #i#)>
  <cfset temp = QuerySetCell(myquery, "TotalSpace", 
    #mydoc.StorageList.DriveDetails[i].TotalSpace.XmlText#, #i#)>
<cfset temp = QuerySetCell(myquery, "FreeSpace", 
    #mydoc.StorageList.DriveDetails[i].FreeSpace.XmlText#, #i#)>
</cfloop>

Contents of the: <br>
<cfdump var=#myquery#>
<br><cfloop index="i" from = "1" to = #size#>
<cfchart format="flash"  show3d="true" chartwidth="300" chartheight="300" >
            <cfchartseries type="pie">
             <cfloop query="myquery">
  <cfchartdata item="#TotalSpace#" value="#FreeSpace#"> 
                </cfloop>
            </cfchartseries>
        </cfchart>
</cfloop>


<!---<cfloop index="i" from = "1" to = #size#>
  <cfchart>
<cfchartseries 
    type="pie" 

    query="myquery" 
    valueColumn="TotalSpace" 
    itemColumn="FreePace"/>
</cfchart>
</cfloop>--->
</body>
</html>

我有这个代码用于图表显示,但它在一个图表中显示我想在单独的图表中显示这个

1 个答案:

答案 0 :(得分:0)

不使用构建查询并使用它在图表系列中显示,而是使用带有cfchartdata的图表系列将相应的数据添加到图表中。