Esempio n. 1
0
        private void OnRenderGraph(ZedGraphWeb zgw, Graphics g, MasterPane masterPane)
        {
            ErrorMsg.Text = "";
            CY.GFive.DALProviders.SqlServerProvider.ScoreProvider sp = new CY.GFive.DALProviders.SqlServerProvider.ScoreProvider();
            if (string.IsNullOrEmpty(Request.Form.Get("Term")) || string.IsNullOrEmpty(Request.Form.Get("Course")))
            {
                ErrorMsg.Text = "参数错误";
                ZedGraphWeb1.Visible = false;
                return;
            }
            int term = Convert.ToInt32(Request.Form.Get("Term"));
            string course = Request.Form.Get("Course");
            string year = ddlYearNum.SelectedItem.ToString();
            string teacher = ddlTeacher.SelectedValue;
            List<string> classlist = sp.GetClassList(year, term, teacher, course);
            if (classlist.Count < 1)
                return;
            GraphPane myPane = masterPane[0];

            myPane.Title.Text = "分数段统计";       //设计图表的标题
            myPane.XAxis.Title.Text = "分数段";    //X轴标题
            myPane.YAxis.Title.Text = "人数";          //Y轴标题
            string[] labels = new string[6];
            labels[0] = "60以下";
            labels[1] = "60-69";
            labels[2] = "70-79";
            labels[3] = "80-89";
            labels[4] = "90-99";
            labels[5] = "100";

            foreach (string classcode in classlist)
            {
                Random rand = new Random();
                int n = rand.Next(4);
                Color temp = Color.FromArgb(n * 10, n * 60, n * 50);
                DataSet ds = sp.GetScoreUnionByParam(year, term, classcode, course);
                CY.GFive.Core.Business.ClassInfo citemp = CY.GFive.Core.Business.ClassInfo.GetByCode(classcode);
                PointPairList list = new PointPairList();
                for (int i = 0; i < 6; i++)
                    list.Add(0, Convert.ToInt32(ds.Tables[0].Rows[i]["人数"]));
                BarItem myCurve = myPane.AddBar(citemp.ClassName, list, temp);
                myCurve.Bar.Fill = new Fill(temp, Color.White, temp);
            }

            myPane.XAxis.MajorTic.IsBetweenLabels = false; //柱状显示位置,true为在两个下标题值的中间,flase为两边
            myPane.XAxis.Scale.TextLabels = labels;//下标题的内容
            myPane.XAxis.Type = AxisType.Text;
            myPane.Fill = new Fill(Color.White, Color.FromArgb(200, 200, 255), 90.0f);//图表外层背景填充色,由color1到color2渐变,参数3为方向
            myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(200, 200, 255), 270.0f);//图表内层背景填充色,由color1到color2渐变,参数3为方向
            ZedGraphWeb1.Visible = true;
            masterPane.AxisChange(g);
        }
Esempio n. 2
0
 protected void bStatistics_Click(object sender, EventArgs e)
 {
     ErrorMsg.Text = "";
     Msg.InnerHtml = "";
     if (String.IsNullOrEmpty(ddlYearNum.SelectedValue))
     {
         ErrorMsg.Text = "没有学年信息,请添加学年信息";
         return;
     }
     if (String.IsNullOrEmpty(ddlClass.SelectedValue) || ddlClass.SelectedValue.ToString() == "请选择")
     {
         ErrorMsg.Text = "没有选择班级,请选择班级以后再统计";
         return;
     }
     if (string.IsNullOrEmpty(ddlCourse.SelectedValue) || ddlCourse.SelectedValue.ToString() == "请选择")
     {
         ErrorMsg.Text = "没有选择相应的课程";
         return;
     }
     string year = ddlYearNum.SelectedItem.ToString();
     int term = Convert.ToInt32(ddlTerm.SelectedValue);
     string classcode = ddlClass.SelectedValue.ToString();
     string coursecode = ddlCourse.SelectedValue.ToString();
     CY.GFive.DALProviders.SqlServerProvider.ScoreProvider sp = new CY.GFive.DALProviders.SqlServerProvider.ScoreProvider();
     ds = sp.GetScoreUnionByParam(year, term, classcode, coursecode);
     GridView1.DataSource = ds;
     GridView1.DataBind();
     Msg.InnerHtml = "第" + ddlYearNum.SelectedItem.ToString() + "学年," + ddlClass.SelectedItem.ToString() + "成绩统计";
 }
Esempio n. 3
0
 private void OnRenderGraph(ZedGraphWeb zgw, Graphics g, MasterPane masterPane)
 {
     ErrorMsg.Text = "";
     CY.GFive.DALProviders.SqlServerProvider.ScoreProvider sp = new CY.GFive.DALProviders.SqlServerProvider.ScoreProvider();
     string coursecode = Request.Form.Get("ddlCourse");
     string term = Request.Form.Get("ddlTerm");
     if (coursecode == null || coursecode == "请选择" || term == null || term == "请选择")
     {
         ErrorMsg.Text = "有参数不正确";
         ZedGraphWeb1.Visible = false;
         return;
     }
     if (string.IsNullOrEmpty(ddlYearNum.SelectedValue) || ddlYearNum.SelectedValue == "请选择")
     {
         ErrorMsg.Text = "有参数不正确";
         ZedGraphWeb1.Visible = false;
         return;
     }
     string year = ddlYearNum.SelectedItem.ToString();//year term course class teacher
     GraphPane myPane = masterPane[0];
     myPane.Title.Text = "同课程分数段统计";       //设计图表的标题
     myPane.XAxis.Title.Text = "分数段";    //X轴标题
     myPane.YAxis.Title.Text = "人数";          //Y轴标题
     string[] labels = new string[6];
     labels[0] = "60以下";
     labels[1] = "60-69";
     labels[2] = "70-79";
     labels[3] = "80-89";
     labels[4] = "90-99";
     labels[5] = "100";
     List<string> dic = sp.PrapareTeacherAndClassByCourse(year, Convert.ToInt32(term), coursecode);
     foreach (string s in dic)
     {
         string[] value = s.Split(','); //teachercode,classcode
         Random rand = new Random();
         int r = rand.Next(8);
         int gg = rand.Next(10);
         int b = rand.Next(5);
         Color temp = Color.FromArgb(r * 30, gg * 25, b * 50);
         DataSet ds = sp.GetScoreUnionByParam(year, Convert.ToInt32(term), value[1], coursecode);
         PointPairList list = new PointPairList();
         for (int i = 0; i < 6; i++)
             list.Add(0, Convert.ToInt32(ds.Tables[0].Rows[i]["人数"]));
         CY.GFive.Core.Business.StaffInfo si = CY.GFive.Core.Business.StaffInfo.GetInstance(value[0]);
         CY.GFive.Core.Business.ClassInfo ci = CY.GFive.Core.Business.ClassInfo.GetByCode(value[1]);
         BarItem myCurve = myPane.AddBar(si.Name + "-" + ci.ClassName, list, temp);
         myCurve.Bar.Fill = new Fill(temp, Color.White, temp);
     }
     myPane.XAxis.MajorTic.IsBetweenLabels = false; //柱状显示位置,true为在两个下标题值的中间,flase为两边
     myPane.XAxis.Scale.TextLabels = labels;//下标题的内容
     myPane.XAxis.Type = AxisType.Text;
     myPane.Fill = new Fill(Color.White, Color.FromArgb(200, 200, 255), 90.0f);//图表外层背景填充色,由color1到color2渐变,参数3为方向
     myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(200, 200, 255), 270.0f);//图表内层背景填充色,由color1到color2渐变,参数3为方向
     ZedGraphWeb1.Visible = true;
     masterPane.AxisChange(g);
 }
Esempio n. 4
0
        private void OnRenderGraph(ZedGraphWeb zgw, Graphics g, MasterPane masterPane)
        {
            ErrorMsg.Text = "";
            CY.GFive.DALProviders.SqlServerProvider.ScoreProvider sp = new CY.GFive.DALProviders.SqlServerProvider.ScoreProvider();
            string classcode = Request.Form.Get("ddlClass");
            string[] year = Request.Form.GetValues("cyear");
            string[] term = Request.Form.GetValues("cterm");
            if (classcode == null || string.IsNullOrEmpty(classcode) || year == null || year.Length == 0 || term == null || term.Length == 0)
            {
                ErrorMsg.Text = "有参数不正确";
                ZedGraphWeb1.Visible = false;
                return;
            }
            List<YearTerm> ytlist = new List<YearTerm>();
            List<YearTermCourse> ytclist = new List<YearTermCourse>();
            for (int i = 0; i < year.Length; i++)
            {
                bool isIn = false;
                foreach (YearTerm yt in ytlist)
                {
                    if (yt.Year == year[i] && yt.Term == term[i])
                        isIn = true;
                }
                if (!isIn)
                    ytlist.Add(new YearTerm { Year = year[i], Term = term[i] });
            }
            foreach (YearTerm yt in ytlist)
            {
                List<string> courselist = sp.GetCourseList(yt.Year, Convert.ToInt32(yt.Term), classcode);
                if (courselist.Count > 0)
                    foreach (string s in courselist)
                    {
                        ytclist.Add(new YearTermCourse { Year = yt.Year, Term = yt.Term, Course = s });
                    }
            }
            GraphPane myPane = masterPane[0];

            myPane.Title.Text = "分数段统计";       //设计图表的标题
            myPane.XAxis.Title.Text = "分数段";    //X轴标题
            myPane.YAxis.Title.Text = "人数";          //Y轴标题
            string[] labels = new string[6];
            labels[0] = "60以下";
            labels[1] = "60-69";
            labels[2] = "70-79";
            labels[3] = "80-89";
            labels[4] = "90-99";
            labels[5] = "100";
            foreach (YearTermCourse ytc in ytclist)
            {
                Random rand = new Random();
                int r = rand.Next(8);
                int gg = rand.Next(10);
                int b = rand.Next(5);
                Color temp = Color.FromArgb(r * 30, gg * 25, b * 50);
                DataSet ds = sp.GetScoreUnionByParam(ytc.Year, Convert.ToInt32(ytc.Term), classcode, ytc.Course);
                CY.GFive.Core.Business.Course ctemp = CY.GFive.Core.Business.Course.GetByCode(ytc.Course);
                PointPairList list = new PointPairList();
                for (int i = 0; i < 6; i++)
                    list.Add(0, Convert.ToInt32(ds.Tables[0].Rows[i]["人数"]));
                BarItem myCurve = myPane.AddBar(ytc.Year + "年" + ctemp.Name, list, temp);
                myCurve.Bar.Fill = new Fill(temp, Color.White, temp);
            }
            myPane.XAxis.MajorTic.IsBetweenLabels = false; //柱状显示位置,true为在两个下标题值的中间,flase为两边
            myPane.XAxis.Scale.TextLabels = labels;//下标题的内容
            myPane.XAxis.Type = AxisType.Text;
            myPane.Fill = new Fill(Color.White, Color.FromArgb(200, 200, 255), 90.0f);//图表外层背景填充色,由color1到color2渐变,参数3为方向
            myPane.Chart.Fill = new Fill(Color.White, Color.FromArgb(200, 200, 255), 270.0f);//图表内层背景填充色,由color1到color2渐变,参数3为方向
            ZedGraphWeb1.Visible = true;
            masterPane.AxisChange(g);
        }