首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 网站开发 > Web前端 >

funsionCharts.net 施用

2012-09-25 
funsionCharts.net 应用p/ppre namecode typetext/javascript src../FusionCharts/FusionCha

funsionCharts.net 应用
<p>
</p>
<pre name="code" 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>
?

热点排行