当前位置: 代码迷 >> Web前端 >> funsionCharts.net 施用
  详细解决方案

funsionCharts.net 施用

热度:218   发布时间:2012-09-25 09:55:58.0
funsionCharts.net 应用
<p>
</p>
<pre name="code" class="html">&lt;html&gt;
&lt;head&gt;
    &lt;title&gt;Corporate Quote Dashboard (Beta)&lt;/title&gt;
    &lt;script language="Javascript" type="text/javascript" src="../FusionCharts/FusionCharts.js"&gt;&lt;/script&gt;
    &lt;style type="text/css"&gt;
        &lt;!
        -- .body
        {
            font-family: Arial, Helvetica, sans-serif;
            font-size: 12px;
        }
        .text
        {
            font-family: Arial, Helvetica, sans-serif;
            font-size: 12px;
        }
        -- &gt;&lt;/style&gt;
&lt;/head&gt;
&lt;body style="margin: 0px"&gt;
    &lt;form id='form1' runat="server"&gt;
    &lt;table&gt;
        &lt;tr style="vertical-align: bottom"&gt;
            &lt;td&gt;
                &lt;%=GetProductSalesChartHtml()%&gt;
            &lt;/td&gt;
            &lt;td&gt;
                &lt;%=**()%&gt;
            &lt;/td&gt;
        &lt;/tr&gt;
    &lt;/table&gt;
    &lt;/form&gt;
&lt;/body&gt;
&lt;/html&gt;

    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("&lt;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'&gt;");
        HeadXML.Append("   &lt;categories&gt;");
        HeadXML.Append("      &lt;category label='Jan' /&gt;");
        HeadXML.Append("      &lt;category label='Feb' /&gt;");
        HeadXML.Append("      &lt;category label='Mar' /&gt;");
        HeadXML.Append("      &lt;category label='Apr' /&gt;");
        HeadXML.Append("      &lt;category label='May' /&gt;");
        HeadXML.Append("      &lt;category label='Jun' /&gt;");
        HeadXML.Append("      &lt;category label='Jul' /&gt;");
        HeadXML.Append("      &lt;category label='Aug' /&gt;");
        HeadXML.Append("      &lt;category label='Sep' /&gt;");
        HeadXML.Append("      &lt;category label='Oct' /&gt;");
        HeadXML.Append("      &lt;category label='Nov' /&gt;");
        HeadXML.Append("      &lt;category label='Dec' /&gt;");
        HeadXML.Append("   &lt;/categories&gt;");

        ZString.Append("&lt;dataset seriesName='Favorable'color='8BBA00' showValues='0'&gt;");
        TZString.Append("&lt;dataset color='8BBA00' showValues='0' parentYAxis='S'&gt;");
        while (ZRs.ReadData.Read())
        {
            TZ += Convert.ToDouble(ZRs.ReadData["Z"]);
            ZString.Append("&lt;set value='" + ZRs.ReadData["Z"].ToString() + "' /&gt;");
            TZString.Append("&lt;set value='" + TZ.ToString() + "' /&gt;");

        }
        ZString.Append("&lt;/dataset&gt;");
        TZString.Append("&lt;/dataset&gt;");


        KString.Append("&lt;dataset seriesName='Unfavorable'color='FF0000' showValues='0'&gt;");
        TKString.Append("&lt;dataset showValues='0' color='FF0000' parentYAxis='S'&gt;");
        while (KRs.ReadData.Read())
        {
            TK += Convert.ToDouble(KRs.ReadData["K"]);
            KString.Append("&lt;set value='" + KRs.ReadData["K"].ToString() + "' /&gt;");
            TKString.Append("&lt;set value='" + TK.ToString() + "' /&gt;");
        }
        KString.Append("&lt;/dataset&gt;");
        TKString.Append("&lt;/dataset&gt;");
        DownXML.Append("    &lt;/chart&gt; ");

        //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>
?