funsionCharts.net 应用
<p>
</p>
<pre name="code" type="text/javascript" src="../FusionCharts/FusionCharts.js"></script>
<style type="text/css">
<!
-- .body
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
.text
{
font-family: Arial, Helvetica, sans-serif;
font-size: 12px;
}
-- ></style>
</head>
<body style="margin: 0px">
<form id='form1' runat="server">
<table>
<tr style="vertical-align: bottom">
<td>
<%=GetProductSalesChartHtml()%>
</td>
<td>
<%=**()%>
</td>
</tr>
</table>
</form>
</body>
</html>
using InfoSoftGlobal;
public string GetProductSalesChartHtml()
{
StringBuilder strXML = new StringBuilder();
StringBuilder HeadXML = new StringBuilder();
StringBuilder ZString = new StringBuilder(); //Z 赚钱
StringBuilder KString = new StringBuilder(); //K 亏损
StringBuilder TZString = new StringBuilder(); //TZ 赚钱累加
StringBuilder TKString = new StringBuilder(); //TK 亏损累加
StringBuilder DownXML = new StringBuilder();
string Z = "select Z from Net_Chart_Z";
DbConn ZRs = new DbConn(Z);
string K = "select K from Net_Chart_K";
DbConn KRs = new DbConn(K);
double TZ=0; double TK=0;
HeadXML.Append("<chart clickurl='n-http://0.0.0.0:8110/' caption='Approved Quote of CCL in " + DateTime.Now.Year + "' PYAxisName='No.of Quote' SYAxisName='Cumulative Quote' labelDisplay='Rotate' slantLabels='1'>");
HeadXML.Append(" <categories>");
HeadXML.Append(" <category label='Jan' />");
HeadXML.Append(" <category label='Feb' />");
HeadXML.Append(" <category label='Mar' />");
HeadXML.Append(" <category label='Apr' />");
HeadXML.Append(" <category label='May' />");
HeadXML.Append(" <category label='Jun' />");
HeadXML.Append(" <category label='Jul' />");
HeadXML.Append(" <category label='Aug' />");
HeadXML.Append(" <category label='Sep' />");
HeadXML.Append(" <category label='Oct' />");
HeadXML.Append(" <category label='Nov' />");
HeadXML.Append(" <category label='Dec' />");
HeadXML.Append(" </categories>");
ZString.Append("<dataset seriesName='Favorable'color='8BBA00' showValues='0'>");
TZString.Append("<dataset color='8BBA00' showValues='0' parentYAxis='S'>");
while (ZRs.ReadData.Read())
{
TZ += Convert.ToDouble(ZRs.ReadData["Z"]);
ZString.Append("<set value='" + ZRs.ReadData["Z"].ToString() + "' />");
TZString.Append("<set value='" + TZ.ToString() + "' />");
}
ZString.Append("</dataset>");
TZString.Append("</dataset>");
KString.Append("<dataset seriesName='Unfavorable'color='FF0000' showValues='0'>");
TKString.Append("<dataset showValues='0' color='FF0000' parentYAxis='S'>");
while (KRs.ReadData.Read())
{
TK += Convert.ToDouble(KRs.ReadData["K"]);
KString.Append("<set value='" + KRs.ReadData["K"].ToString() + "' />");
TKString.Append("<set value='" + TK.ToString() + "' />");
}
KString.Append("</dataset>");
TKString.Append("</dataset>");
DownXML.Append(" </chart> ");
//Assemble the entire XML now
strXML.Append(HeadXML.ToString());
strXML.Append(ZString.ToString());
strXML.Append(KString.ToString());
strXML.Append(TZString.ToString());
strXML.Append(TKString.ToString());
strXML.Append(DownXML.ToString());
//Create the chart - MS Column 3D Line Combination Chart with data contained in strXML
return FusionCharts.RenderChart("../FusionCharts/MSColumn3DLineDY.swf", "", strXML.ToString(),"productSales", "456", "286", false, false);
}</pre>
?