예제 #1
0
    public void getChartReport(DataTable dt)
    {
        if (dt == null)
        {
            Page.ClientScript.RegisterStartupScript(this.GetType(), "", string.Format("var strCharts='{0}';", ""), true);
        }
        else
        {
            chart  pieChart  = new chart();
            string strCharts = "[";
            int    n         = 0;

            foreach (DataRow dr in dt.Rows)
            {
                string color = pieChart.getColor(n++);
                strCharts += "{ \"category\" : \"" + dr["TypeName"].ToString() + "\", \"data\" : " + dr["BugNo"].ToString() + ", \"color\" : \"" + color + "\" },";
            }

            strCharts  = strCharts.Substring(0, strCharts.Length - 1);
            strCharts += "]";

            Page.ClientScript.RegisterStartupScript(this.GetType(), "", string.Format("var strCharts='{0}';", strCharts), true);
        }
    }
예제 #2
0
        public void getChartReport(List <Models.Report11> reportData)
        {
            if (reportData.Count == 0)
            {
                Page.ClientScript.RegisterStartupScript(this.GetType(), "", string.Format("var strCharts='{0}';", ""), true);
            }
            else
            {
                chart  pieChart  = new chart();
                string strCharts = "[";
                int    n         = 0;

                foreach (Models.Report11 item in reportData)
                {
                    string color = pieChart.getColor(n++);
                    strCharts += "{ \"category\" : \"" + item.TypeName + "\", \"data\" : " + item.BugNo + ", \"color\" : \"" + color + "\" },";
                }

                strCharts  = strCharts.Substring(0, strCharts.Length - 1);
                strCharts += "]";

                Page.ClientScript.RegisterStartupScript(this.GetType(), "", string.Format("var strCharts='{0}';", strCharts), true);
            }
        }