关于webchart的使用

关于webchart这个图标控件的使用,近期稍微研究了下,也使用率一些功能,做个记录分享下,前端加个控件


                       
                       
                       
                       

                       

                       

                       

                       

                   

后台的代码可以自己写:
                ChartControl1.Visible = true;
                ChartControl1.HasChartLegend = false;
                LineChart lc = new LineChart();
                lc.Line.Color = Color.Red;
                lc.ShowLegend = false;
                ChartPointCollection lcdata = lc.Data;
                lc.Legend = "需求进度记录";
                lc.DataLabels.Visible = true;

                string username = DropDownListUsers.SelectedItem.Text;
                string reqname = DropDownListUserReqs.SelectedItem.Text;
                ChartText ct = new ChartText();
                ct.Text = reqname;
                ChartControl1.XTitle = ct;
                string userid = GetUseridByUserName(username).ToString();
                string getReqsbyuseridsql = "  select a.Req_Id from [RequirementsStatus] a left join Reqirements b on a.Req_Id=b.Req_Id where a.Req_User_id='" + userid + "'";
                string reqid = GetReqidbyReqname(reqname);
                string title = DropDownListUserReqs.SelectedItem.Text + "_需要要求完成时间:" + DBHelper.ExecuteScalar("select Req_Workload from Reqirements where Req_Id='"+reqid+"'").ToString();
                ChartControl1.ChartTitle.Text = title;
                string reqprosql = "select a.Req_Progress,a.Req_UpdateTime from RequirementsProgressRecord a where a.Req_Id='" + reqid + "' order by a.Req_UpdateTime asc";
                DataTable reqpro = DBHelper.GetDataTable(reqprosql);
                foreach (DataRow reqrow in reqpro.Rows)
                {
                    string pro = reqrow.ItemArray[0].ToString();
                    string rowdate = reqrow.ItemArray[1].ToString();
                    DateTime time = DateTime.Parse(rowdate);
                    string day = time.Month.ToString() + "月" + time.Day.ToString() + "日";
                    string strsigntime = time.Hour.ToString() + "." + time.Minute.ToString();
                    float signtime = float.Parse(strsigntime);
                    float rqp = float.Parse(pro);
                    lcdata.Add(new ChartPoint(day, rqp));
                }
                ChartControl1.Charts.Add(lc);
                ChartControl1.BottomChartPadding = 30;
                ChartControl1.XAxisFont.Font = new Font("Tahoma", 9);
                ChartControl1.RedrawChart();

 

你可能感兴趣的:(.net,myself)