private void loadChart3() { //chart 3 string sqlQuery3 = (@"SELECT * FROM ( SELECT[pitchno], [pitcher], [pitcherset] FROM[dbo].[pitchData] WHERE pitchtype = 'Fastball' ) AS SourceTable PIVOT(COUNT([pitchno]) FOR [pitcherset] IN ([Stretch], [Windup])) AS PivotTable;"); DataTable ChartData3 = SqlQueryExecute(sqlQuery3); DataView dv = new DataView(ChartData3); Chart3.DataSource = dv; Chart3.DataBind(); foreach (Series cs in Chart3.Series) { Debug.WriteLine(cs.Name); cs.ChartType = SeriesChartType.StackedColumn; } //Setting width of line Chart3.Series[0].BorderWidth = 10; }
protected void Page_Load(object sender, EventArgs e) { try { job1Result = ReadJobResult(url1); job2Result = ReadJobResult(url2); job3Result = ReadJobResult(url3); if (!this.IsPostBack) { DataBindProductDropDown(); DataBindChart2(); } if (job1Result.Count > 0) { Chart1.DataSource = job1Result; Chart1.Series["Series1"].XValueMember = "Key"; Chart1.Series["Series1"].YValueMembers = "Value"; Chart1.DataBind(); } if (job3Result.Count > 0) { Chart3.DataSource = job1Result; Chart3.Series["Series1"].XValueMember = "Key"; Chart3.Series["Series1"].YValueMembers = "Value"; Chart3.DataBind(); } } catch (Exception ex) { } }
protected void DropDownList1_SelectedIndexChanged(object sender, EventArgs e) { //chart 3 string pitchType = DropDownList1.SelectedValue.ToString(); Debug.WriteLine(pitchType); string queryString = (@"SELECT * FROM ( SELECT[pitchno], [pitcher], [pitcherset] FROM[dbo].[pitchData] WHERE pitchtype = @pitchType) AS SourceTable PIVOT(COUNT([pitchno]) FOR [pitcherset] IN ([Stretch], [Windup])) AS PivotTable;"); //DataTable ChartData3 = SqlQueryExecute(sqlQuery3); DataTable ChartData3 = new DataTable(); using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlDataAdapter sqlQueryAdapter = new SqlDataAdapter(queryString, connection)) { sqlQueryAdapter.SelectCommand.Parameters.AddWithValue("@pitchType", pitchType); sqlQueryAdapter.SelectCommand.CommandTimeout = 120; DataSet dataSet = new DataSet(); sqlQueryAdapter.Fill(dataSet); connection.Close(); ChartData3 = dataSet.Tables[0]; } } DataView dv = new DataView(ChartData3); Chart3.DataSource = dv; Chart3.DataBind(); foreach (Series cs in Chart3.Series) { Debug.WriteLine(cs.Name); cs.ChartType = SeriesChartType.StackedColumn; } //Setting width of line Chart3.Series[0].BorderWidth = 10; }
private void LoadChartData1() { Chart3.ChartAreas[0].AxisX.MajorGrid.Enabled = false; Chart3.ChartAreas[0].AxisY.MajorGrid.Enabled = false; string query = "SELECT Category,catcount from tbl_city_wise_graph "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable table = new DataTable(); da.Fill(table); DataView dv = table.DefaultView; Chart3.DataBind(); Chart3.Series["Series1"].Points.DataBindXY(dv, "Category", dv, "catcount"); getdata(); }
protected void Page_Load(object sender, EventArgs e) { //userID = Convert.ToInt32(Request.Cookies.Get(0).Value); //userID = 1012;//kc testing userID = Convert.ToInt32(Request.QueryString["userID"]); int count = Request.Cookies.Count; fifthInjury.Text = "test" + userID + "-" + count; Chart.Series["Series1"].YValueMembers = "# of Activities"; Chart.Series["Series1"].XValueMember = "# of Weeks"; Chart1.Series["Series1"].YValueMembers = "# of Activities"; Chart1.Series["Series1"].XValueMember = "# of Weeks"; Chart2.Series["Series1"].YValueMembers = "# of Activities"; Chart2.Series["Series1"].XValueMember = "# of Weeks"; Chart3.Series["Series1"].YValueMembers = "# of Activities"; Chart3.Series["Series1"].XValueMember = "# of Weeks"; try { Chart.DataSource = dbObject.GetActivityData(userID, 1, "strength"); Chart1.DataSource = dbObject.GetActivityData(userID, 1, "cardio"); Chart2.DataSource = dbObject.GetActivityData(userID, 1, "health"); Chart3.DataSource = dbObject.GetActivityData(userID, 1, "sleep"); } catch (NullReferenceException ex) { System.Diagnostics.Debug.WriteLine(ex.Message); Response.Redirect("Login.aspx"); } Chart.DataBind(); Chart1.DataBind(); Chart2.DataBind(); Chart3.DataBind(); showInjuries(); showWorkout(); foreach (string name in HealthInputSessionVariables.Activity.Keys) { foreach (float value in HealthInputSessionVariables.Activity.Values) { Label myLabel = new Label(); myLabel.ID = "lbl" + name; myLabel.Text = value.ToString(); } } }
void initpie() { SqlDataReader rdr = c.MaleFemaleReport(DropDownList3.SelectedItem.Text); if (rdr != null) { Chart3.DataSource = rdr; Chart3.Visible = true; Label3.Text = ""; Chart3.DataBind(); } else { Label3.Text = "There is No Enough Data "; Chart3.Visible = false; } }
private void LoadChartData1() { Chart3.ChartAreas[0].AxisX.MajorGrid.Enabled = false; Chart3.ChartAreas[0].AxisY.MajorGrid.Enabled = false; string query = "SELECT City_nm,Count from tbl_stat_datewise_cnt"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable table = new DataTable(); da.Fill(table); DataView dv = table.DefaultView; Chart3.DataBind(); Chart3.Series["Series1"].Points.DataBindXY(dv, "City_nm", dv, "Count"); gv_data.DataMember = "tbl_stat_datewise_cnt"; gv_data.DataSource = table; gv_data.DataBind(); }
private void LoadChartData1() { Chart3.ChartAreas[0].AxisX.MajorGrid.Enabled = false; Chart3.ChartAreas[0].AxisY.MajorGrid.Enabled = false; string query = "SELECT * from tbl_cat_comp_graph "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable table = new DataTable(); da.Fill(table); DataView dv = table.DefaultView; Chart3.DataBind(); Chart3.Series["Sony"].Points.DataBindXY(dv, "Ddate", dv, "cat1"); Chart3.Series["Canon"].Points.DataBindXY(dv, "Ddate", dv, "cat2"); Chart3.Series["Nikon"].Points.DataBindXY(dv, "Ddate", dv, "cat3"); getdata(); }
private void getUsersChart() { using (SqlConnection conn = new SqlConnection(connStr)) { // Query to retrieve database data for the chart control SqlCommand cmd = new SqlCommand ("SELECT COUNT(UserId) AS Users, MONTH(RegDate) AS Monthly FROM Users WHERE UserType = 2 Group BY MONTH(RegDate)", conn); conn.Open(); SqlDataReader rdr = cmd.ExecuteReader(); // Specify the column name that contains values for X-Axis Chart3.Series["Series3"].XValueMember = "Monthly"; // Specify the column name that contains values for Y-Axis Chart3.Series["Series3"].YValueMembers = "Users"; // Set the datasource Chart3.DataSource = rdr; // Finally call DataBind() Chart3.DataBind(); } }
private void LoadChartData1() { string from = ddl_frommonth.Text + "/" + ddl_fromdate.Text + "/" + ddl_fromyear.Text; string to = ddl_tomonth.Text + "/" + ddl_todate.Text + "/" + ddl_toyear.Text; Chart3.ChartAreas[0].AxisX.MajorGrid.Enabled = false; Chart3.ChartAreas[0].AxisY.MajorGrid.Enabled = false; string query = "SELECT Ddate,Vcount from tbl_show_all_graph where Ddate between '" + from + "' AND '" + to + "' order by Ddate ASC"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable table = new DataTable(); da.Fill(table); DataView dv = table.DefaultView; Chart3.DataBind(); Chart3.Series["Series1"].Points.DataBindXY(dv, "Ddate", dv, "VCount"); getdata2(); }
private void LoadChartData1() { string from = ddl_frommonth.Text + "/" + ddl_fromdate.Text + "/" + ddl_fromyear.Text; string to = ddl_tomonth.Text + "/" + ddl_todate.Text + "/" + ddl_toyear.Text; Chart3.ChartAreas[0].AxisX.MajorGrid.Enabled = false; Chart3.ChartAreas[0].AxisY.MajorGrid.Enabled = false; string query = "SELECT State,Vcount from tbl_state_wise_graph "; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable table = new DataTable(); da.Fill(table); DataView dv = table.DefaultView; Chart3.DataBind(); Chart3.Series["Series1"].Points.DataBindXY(dv, "State", dv, "Vcount"); getdata(); }
public void View1_bind() { if (!DropDownList6.SelectedValue.Equals("-1")) { Label10.Text = string.Format(DropDownList6.SelectedItem.Text.ToString() + ": " + DropDownList6.SelectedValue.ToString()); DataTable dt = StudentLogic.getUserVSBatch(Session["userID"].ToString(), Session["courseID"].ToString(), DropDownList6.SelectedValue); if (dt != null) { GridView3.DataSource = dt; GridView3.DataBind(); Chart3.DataSource = dt; Chart3.Series["Series1"].XValueMember = "Result Group"; Chart3.Series["Series1"].YValueMembers = "GPA"; Chart3.DataBind(); } else { Label10.Text = "No results available!"; } } }
protected void cmdAceptar_Click1(object sender, EventArgs e) { if (ddlBuscar.SelectedValue == "1") { gvBusquedaP0.DataSourceID = "DSBUSQUEDA"; gvBusquedaP0.DataBind(); Chart3.DataSourceID = "DSBUSQUEDA"; Chart3.DataBind(); gvBusquedaP.Visible = false; } if (ddlBuscar.SelectedValue == "2") { gvBusquedaP0.DataSourceID = "DSBUSQUEDA1"; gvBusquedaP0.DataBind(); Chart3.DataSourceID = "DSBUSQUEDA1"; Chart3.DataBind(); gvBusquedaP.Visible = false; } }
protected void Page_Load(object sender, EventArgs e) { // istatikler için çartların sonuçlarının toplanması. Chart1.DataSource = getdata1(); Chart1.DataBind(); Repeater1.DataSource = getdata(); Repeater1.DataBind(); Chart1.ChartAreas[0].AxisX.Title = "gender"; Chart1.ChartAreas[0].AxisY.Title = "picture2"; Chart2.DataSource = getdata2(); Chart2.DataBind(); Chart2.ChartAreas[0].AxisX.Title = "gender"; Chart2.ChartAreas[0].AxisY.Title = "picture1"; basligiAl(); Chart3.DataSource = getdata3(); Chart3.DataBind(); Chart3.ChartAreas[0].AxisX.Title = "age_group"; Chart3.ChartAreas[0].AxisY.Title = "picture1"; Chart4.DataSource = getdata4(); Chart3.DataBind(); Chart4.ChartAreas[0].AxisX.Title = "age_group"; Chart4.ChartAreas[0].AxisY.Title = "picture2"; }
protected void FillCharts() { DataTable dt = GetData("select * from dbo.top10_Origin"); Chart1.Series[0].ChartType = SeriesChartType.Pie; Chart1.DataSource = dt; Chart1.Series.First().XValueMember = "Origin"; Chart1.Series.First().YValueMembers = "Count"; Chart1.DataBind(); Chart1.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.Transparent; dt.Clear(); dt = GetData("select * from dbo.flightCount"); Chart2.Series[0].ChartType = SeriesChartType.Pie; Chart2.DataSource = dt; Chart2.Series.First().XValueMember = "Code"; Chart2.Series.First().YValueMembers = "Flight Count"; Chart2.DataBind(); Chart2.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.Transparent; dt.Clear(); dt = GetData("select * from dbo.avgDelay"); Chart3.Series[0].ChartType = SeriesChartType.Column; Chart3.DataSource = dt; Chart3.Series.First().XValueMember = "Code"; Chart3.Series.First().YValueMembers = "Average Delay"; Chart3.DataBind(); Chart3.ChartAreas["ChartArea1"].BackColor = System.Drawing.Color.Transparent; }
protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { cd = new SqlCommand("select image_url,ename from employee where eemail=@email", con); cd.Parameters.AddWithValue("@email", Session["email"].ToString()); da = new SqlDataAdapter(cd); dt = new DataTable(); da.Fill(dt); foreach (DataRow item in dt.Rows) { userimage.ImageUrl = item[0].ToString(); username.Text = item[1].ToString(); } //da = new SqlDataAdapter("select * from Project_Master", con); //ds = new DataSet(); //da.Fill(ds); ////Chart1.DataSource = ds; ////Chart1.DataBind(); cd1 = new SqlCommand("getprojectnames", con); cd1.CommandType = CommandType.StoredProcedure; da1 = new SqlDataAdapter(cd1); dt1 = new DataTable(); da1.Fill(dt1); DropDownList1.DataSource = dt1; DropDownList1.DataTextField = "pname"; DropDownList1.DataValueField = "pid"; DropDownList1.DataBind(); DropDownList3.DataSource = dt1; DropDownList3.DataTextField = "pname"; DropDownList3.DataValueField = "pid"; DropDownList3.DataBind(); DataTable custom1 = new DataTable(); custom1.Columns.Add("projectname", typeof(System.String)); custom1.Columns.Add("projectprg", typeof(System.Double)); foreach (DataRow item in dt1.Rows) { DataTable custom = new DataTable(); custom.Columns.Add("mid", typeof(System.Int16)); custom.Columns.Add("prg", typeof(System.Int16)); cd = new SqlCommand("select ModuleID from ProjectModule where ProjectID=@pid", con); cd.Parameters.AddWithValue("@pid", Convert.ToInt16(item[0])); da = new SqlDataAdapter(cd); DataTable mydt = new DataTable(); da.Fill(mydt); foreach (DataRow item1 in mydt.Rows) { cd = new SqlCommand("getmoduleprogress", con); cd.Parameters.AddWithValue("@mid", Convert.ToInt16(item1[0])); cd.CommandType = CommandType.StoredProcedure; da = new SqlDataAdapter(cd); DataTable mydt1 = new DataTable(); da.Fill(mydt1); DataRow dr = custom.NewRow(); dr[0] = item1[0].ToString(); foreach (DataRow item2 in mydt1.Rows) { dr[1] = Convert.ToInt16(item2[0]); } custom.Rows.Add(dr); } double sum = 0; foreach (DataRow item3 in custom.Rows) { int newsum = Convert.ToInt16(item3[1]); sum = sum + newsum; } DataRow dr1 = custom1.NewRow(); dr1[0] = item[1].ToString(); dr1[1] = (sum / custom.Rows.Count); custom1.Rows.Add(dr1); } Chart3.DataSource = custom1; Chart3.DataBind(); ListItem li = new ListItem(); li.Text = "Select Project"; li.Value = 0.ToString(); DropDownList1.Items.Insert(0, li); ListItem li1 = new ListItem(); li1.Text = "Select Modul"; li1.Value = 0.ToString(); DropDownList2.Items.Insert(0, li1); ListItem li2 = new ListItem(); li2.Text = "Select Project"; li2.Value = 0.ToString(); DropDownList3.Items.Insert(0, li2); } }
public void bindchart() { cd1 = new SqlCommand("getprojectnames", con); cd1.CommandType = CommandType.StoredProcedure; da1 = new SqlDataAdapter(cd1); dt1 = new DataTable(); da1.Fill(dt1); DataTable custom1 = new DataTable(); custom1.Columns.Add("projectname", typeof(System.String)); custom1.Columns.Add("projectprg", typeof(System.Double)); foreach (DataRow item in dt1.Rows) { DataTable custom = new DataTable(); custom.Columns.Add("mid", typeof(System.Int16)); custom.Columns.Add("prg", typeof(System.Int16)); cd = new SqlCommand("select ModuleID from ProjectModule where ProjectID=@pid", con); cd.Parameters.AddWithValue("@pid", Convert.ToInt16(item[0])); da = new SqlDataAdapter(cd); DataTable mydt = new DataTable(); da.Fill(mydt); foreach (DataRow item1 in mydt.Rows) { cd = new SqlCommand("getmoduleprogress", con); cd.Parameters.AddWithValue("@mid", Convert.ToInt16(item1[0])); cd.CommandType = CommandType.StoredProcedure; da = new SqlDataAdapter(cd); DataTable mydt1 = new DataTable(); da.Fill(mydt1); DataRow dr = custom.NewRow(); dr[0] = item1[0].ToString(); foreach (DataRow item2 in mydt1.Rows) { dr[1] = Convert.ToInt16(item2[0]); } custom.Rows.Add(dr); } double sum = 0; foreach (DataRow item3 in custom.Rows) { int newsum = Convert.ToInt16(item3[1]); sum = sum + newsum; } DataRow dr1 = custom1.NewRow(); dr1[0] = item[1].ToString(); dr1[1] = (sum / custom.Rows.Count); custom1.Rows.Add(dr1); } Chart3.DataSource = custom1; Chart3.DataBind(); }
protected void btnSetChoice_Click(object sender, EventArgs e) { Chart1.DataBind(); Chart2.DataBind(); Chart3.DataBind(); }
protected void ddlChart_SelectedIndexChanged(object sender, EventArgs e) { try { if (ddlChart.SelectedValue == "Chart1") { Chart1.Visible = true; DataTable _dt = _objChartMasterManager.LeaveChart().Tables[0]; Chart1.DataSource = _dt; Chart1.Series[0].YValueMembers = "LeaveAllowed"; Chart1.Series[0].IsValueShownAsLabel = true; Chart1.Series[1].YValueMembers = "LeaveTypeId"; Chart1.Series[0].XValueMember = "LeaveTypeId"; Chart1.ChartAreas["ChartArea1"].AxisY.Interval = 2; Chart1.DataBind(); } else if (ddlChart.SelectedValue == "Chart2") { Chart2.Visible = true; DataTable _dt2 = _objChartMasterManager.DesignationChart().Tables[0]; Chart2.DataSource = _dt2; Chart2.Series[0].YValueMembers = "EmployeeId"; Chart2.Series[0].XValueMember = "Designation"; Chart2.ChartAreas["ChartArea2"].AxisY.Interval = 1; Chart2.DataBind(); } else if (ddlChart.SelectedValue == "Chart3") { Chart3.Visible = true; DataTable _dt3 = _objChartMasterManager.DepartmentChart().Tables[0]; Chart3.DataSource = _dt3; Chart3.Series[0].YValueMembers = "EmployeeId"; Chart3.Series[0].XValueMember = "Department"; Chart3.ChartAreas["ChartArea3"].AxisY.Interval = 1; Chart3.DataBind(); } else if (ddlChart.SelectedValue == "Chart4") { //Chart4.Visible = true; //DataTable _dt4 = _objChartMasterManager.YearlyJoinChart().Tables[0]; //Chart4.DataSource = _dt4; //Chart4.Series[0].YValueMembers = "EmployeeId"; //Chart4.Series[0].IsValueShownAsLabel = true; //Chart4.Series[0].XValueMember = "JoiningDate"; //Chart4.ChartAreas["ChartArea4"].AxisY.Interval = 1; //Chart4.DataBind(); Chart4.Visible = true; DataTable _dt4 = _objChartMasterManager.YearlyJoinChart().Tables[0]; Chart4.DataSource = _dt4; Chart4.Series[0].YValueMembers = "EmployeeId"; // Chart4.Series[0].IsValueShownAsLabel = true; Chart4.Legends.IsUniqueName("ABC..............."); Chart4.Series[0].XValueMember = "JoiningDate"; Chart4.ChartAreas["ChartArea4"].AxisY.Interval = 2; Chart4.DataBind(); } } catch (Exception ex) { lblMsg.Text = "" + ex.Message.ToString(); } }
protected void Button3_Click(object sender, EventArgs e) { Label1.Visible = false; Label2.Visible = false; Label3.Visible = false; CrystalReportViewer1.SelectionFormula = ""; CrystalReportViewer1.RefreshReport(); int num = allretdata1(); int num1 = allretdata2(); int num2 = allnadiret(); int num3 = allaerotechret(); int num4 = allconfigret(); double[] yValues = { num, num1, num2, num3, num4 }; string[] xValues = { "AIROD", "AIROD AEROSPACE", "NADI", "TECHPOWER", "INAYAH" }; Chart1.Series["Default"].Points.DataBindXY(xValues, yValues); Chart1.Series["Default"].Points[0].Color = Color.Blue; Chart1.Series["Default"].Points[1].Color = Color.Red; Chart1.Series["Default"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; Chart1.Legends.Add("AIROD"); Chart1.Legends.Add("AIROD AEROSPACE" + num1); Chart1.Series["Default"].IsVisibleInLegend = true; Chart1.Series["Default"].Points[0].Label = "#PERCENT" + " AIROD"; Chart1.Series["Default"].Points[1].Label = "#PERCENT" + " AIROD AEROSPACE"; Chart1.Series["Default"].Points[2].Label = "#PERCENT" + " NADI"; Chart1.Series["Default"].Points[3].Label = "#PERCENT" + " TECHPOWER"; Chart1.Series["Default"].Points[4].Label = "#PERCENT" + " INAYAH"; Chart1.Series["Default"]["PieLabelStyle"] = "Disabled"; Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; Chart1.Visible = true; Chart1.Enabled = true; int meet = allretmeet1(); int meet1 = allretmeet2(); Chart3.Legends.Clear(); Chart3.DataBind(); double[] yyValues = { meet, meet1 }; string[] xxValues = { "MEET HOURS", "NOT MEET HOURS" }; Chart3.Series["Default1"].Points.DataBindXY(xxValues, yyValues); Chart3.Series["Default1"].Points[0].Color = Color.Green; Chart3.Series["Default1"].Points[1].Color = Color.Yellow; Chart3.Series["Default1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; Chart3.Legends.Add("MEET HOURS" + meet); Chart3.Legends.Add("NOT MEET HOURS" + meet1); Chart3.Series["Default1"].Points[0].Label = "#PERCENT" + " MEET HOURS"; Chart3.Series["Default1"].Points[1].Label = "#PERCENT" + " NOT MEET HOURS"; Chart3.Series["Default1"]["PieLabelStyle"] = "Disabled"; Chart3.Series["Default1"].IsVisibleInLegend = true; Chart3.ChartAreas["ChartArea2"].Area3DStyle.Enable3D = true; Chart3.Visible = true; Chart3.Enabled = true; int Type1 = allTyperet(); int Type2 = allTyperet1(); int Type3 = allTyperet2(); Chart4.Legends.Clear(); Chart4.Series["Default3"]["PieLabelStyle"] = "Disabled"; double[] tValues = { Type1, Type2, Type3 }; string[] pValues = { "Priority", "Normal", "Urgent" }; Chart4.Series["Default3"].Points.DataBindXY(pValues, tValues); Chart4.Series["Default3"].Points[0].Color = Color.Green; Chart4.Series["Default3"].Points[1].Color = Color.Yellow; Chart4.Series["Default3"].Points[2].Color = Color.Black; Chart4.Series["Default3"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; Chart4.Legends.Add("Priority"); Chart4.Legends.Add("Normal"); Chart4.Legends.Add("Urgent"); Chart4.Series["Default3"].Points[0].Label = "#PERCENT" + " PRIORITY"; Chart4.Series["Default3"].Points[1].Label = "#PERCENT" + " NORMAL"; Chart4.Series["Default3"].Points[2].Label = "#PERCENT" + " URGENT"; Chart4.Series["Default3"]["PieLabelStyle"] = "Disabled"; Chart4.Series["Default3"].IsVisibleInLegend = true; Chart4.ChartAreas["ChartArea3"].Area3DStyle.Enable3D = true; Chart4.Visible = true; Chart4.Enabled = true; }
protected void Page_Load(object sender, EventArgs e) { Chart.Series["Series1"].YValueMembers = "# of Activities"; Chart.Series["Series1"].XValueMember = "# of Weeks"; Chart1.Series["Series1"].YValueMembers = "# of Activities"; Chart1.Series["Series1"].XValueMember = "# of Weeks"; Chart2.Series["Series1"].YValueMembers = "# of Activities"; Chart2.Series["Series1"].XValueMember = "# of Weeks"; Chart3.Series["Series1"].YValueMembers = "# of Activities"; Chart3.Series["Series1"].XValueMember = "# of Weeks"; try { Chart.DataSource = dbObject.GetActivityData(((SessionData)Session["User_Data"])._loginID, 1, "strength"); Chart1.DataSource = dbObject.GetActivityData(((SessionData)Session["User_Data"])._loginID, 1, "cardio"); Chart2.DataSource = dbObject.GetActivityData(((SessionData)Session["User_Data"])._loginID, 1, "health"); Chart3.DataSource = dbObject.GetActivityData(((SessionData)Session["User_Data"])._loginID, 1, "sleep"); } catch (NullReferenceException ex) { System.Diagnostics.Debug.WriteLine(ex.Message); Response.Redirect("Login.aspx"); } Chart.DataBind(); Chart1.DataBind(); Chart2.DataBind(); Chart3.DataBind(); showInjuries(); showWorkout(); if (!IsPostBack) { dictInjury.Add("Head", 0); dictInjury.Add("Right Shoulder", 0); dictInjury.Add("Right Elbow", 0); dictInjury.Add("Right Hand", 0); dictInjury.Add("Right Knee", 0); dictInjury.Add("Right Foot", 0); dictInjury.Add("Abdomen", 0); dictInjury.Add("Left Shoulder", 0); dictInjury.Add("Left Elbow", 0); dictInjury.Add("Left Knee", 0); dictInjury.Add("Left Foot", 0); dictInjury.Add("Neck", 0); dictInjury.Add("Left Shoulder Blade", 0); dictInjury.Add("Left Forearm", 0); dictInjury.Add("Lumbar", 0); dictInjury.Add("Thoracic", 0); dictInjury.Add("Left Heel", 0); dictInjury.Add("Right Heel", 0); dictInjury.Add("Right Shoulder Blade", 0); dictInjury.Add("Right Forearm", 0); dictInjury.Add("Left Hand", 0); } foreach (string name in HealthInputSessionVariables.Activity.Keys) { foreach (float value in HealthInputSessionVariables.Activity.Values) { Label myLabel = new Label(); myLabel.ID = "lbl" + name; myLabel.Text = value.ToString(); } } }
private void buildLineChart(string Diploma, string StudentYear) { String myConnect = ConfigurationManager.ConnectionStrings["EADPConnectionString2"].ToString(); SqlConnection myConn = new SqlConnection(myConnect); DataSet ds = new DataSet(); SqlDataAdapter da; DateTime now = DateTime.Now; String strSQL = "SELECT COUNT(i.adminno) NoOfStudents, DATENAME(month, TripEnd) AS [Month] FROM [interview] i "; strSQL += "INNER JOIN trip t on i.tripid = t.tripid "; strSQL += "INNER JOIN register r on i.AdminNo = r.AdminNo "; strSQL += "INNER JOIN Student s on r.adminNo = s.adminno "; if (!Diploma.Equals("All")) { strSQL += "WHERE Diploma = @paraDiploma and studentchoice = 'accepted' and (GETDATE() > TripEnd) "; da = new SqlDataAdapter(strSQL.ToString(), myConn); if (!StudentYear.Equals("All")) { if (now.Month > 4) { int studentyr = int.Parse(StudentYear); studentyr--; strSQL += "AND ((year(getdate()) - 2000) - convert(int, SUBSTRING(i.AdminNo, 1, 2))) = @paraStudentYear Group By [TripEnd] "; //check da = new SqlDataAdapter(strSQL.ToString(), myConn); da.SelectCommand.Parameters.AddWithValue("@paraStudentYear", studentyr); } else { strSQL += "AND ((year(getdate()) - 2000) - convert(int, SUBSTRING(i.AdminNo, 1, 2))) = @paraStudentYear Group By [TripEnd] "; //check da = new SqlDataAdapter(strSQL.ToString(), myConn); da.SelectCommand.Parameters.AddWithValue("@paraStudentYear", StudentYear); } } else { strSQL += "where studentchoice = 'accepted' and (GETDATE() > TripEnd) "; strSQL += "Group By DATENAME(month, TripEnd) "; da = new SqlDataAdapter(strSQL.ToString(), myConn); } da.SelectCommand.Parameters.AddWithValue("@paraDiploma", Diploma); } else if (!StudentYear.Equals("All")) { if (now.Month > 4) { int studentyr = int.Parse(StudentYear); studentyr--; strSQL += "WHERE ((year(getdate()) - 2000) - convert(int, SUBSTRING(i.AdminNo, 1, 2))) = @paraStudentYear Group By [TripEnd] "; //check da = new SqlDataAdapter(strSQL.ToString(), myConn); da.SelectCommand.Parameters.AddWithValue("@paraStudentYear", studentyr); } else { strSQL += "WHERE ((year(getdate()) - 2000) - convert(int, SUBSTRING(i.AdminNo, 1, 2))) = @paraStudentYear Group By [TripEnd] "; //check da = new SqlDataAdapter(strSQL.ToString(), myConn); da.SelectCommand.Parameters.AddWithValue("@paraStudentYear", StudentYear); } } else { strSQL += "Group By DATENAME(month, TripEnd) "; da = new SqlDataAdapter(strSQL.ToString(), myConn); } da.Fill(ds, "tripTable"); Chart3.DataSource = ds; Chart3.DataBind(); string imgPathing2 = HttpContext.Current.Request.PhysicalApplicationPath + tmpChartName3; Chart3.SaveImage(imgPathing2); }
private void BindGrid(string table) { DataTable dt = new DataTable(); using (SqlConnection con = new SqlConnection(constr)) { using (SqlCommand cmd = new SqlCommand("SELECT top 5 * FROM " + table)) { using (SqlDataAdapter sda = new SqlDataAdapter()) { DataTable dtCloned = new DataTable(); cmd.Connection = con; sda.SelectCommand = cmd; sda.Fill(dt); ViewState["dt"] = dt; } } if (table == "Hosts") { Hosts.DataSource = dt; Hosts.DataBind(); string[] x = new string[dt.Rows.Count]; int[] y = new int[dt.Rows.Count]; for (int i = 0; i < dt.Rows.Count; i++) { x[i] = dt.Rows[i][0].ToString(); y[i] = i; } Chart2.Series[0].Points.DataBindXY(x, y); Chart2.Series[0].ChartType = SeriesChartType.Pie; Chart2.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Chart2.Legends[0].Enabled = true; Chart2.DataSource = dt; Chart2.DataBind(); Chart1.Series[0].Points.DataBindXY(x, y); Chart1.Series[0].ChartType = SeriesChartType.Pyramid; Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Chart1.Legends[0].Enabled = true; Chart1.DataSource = dt; Chart1.DataBind(); Chart3.Series[0].Points.DataBindXY(x, y); Chart3.Series[0].ChartType = SeriesChartType.Column; Chart3.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Chart3.Legends[0].Enabled = true; Chart3.DataSource = dt; Chart3.DataBind(); Chart4.Series[0].Points.DataBindXY(x, y); Chart4.Series[0].ChartType = SeriesChartType.Doughnut; Chart4.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; //Chart4.Legends[0].Enabled = true; Chart4.DataSource = dt; Chart4.DataBind(); } else if (table == "Applications") { Applications.DataSource = dt; Applications.DataBind(); } else if (table == "Storage") { Storage.DataSource = dt; Storage.DataBind(); } else if (table == "Databases") { Databases.DataSource = dt; Databases.DataBind(); } } }
private void LOAD_DASHBOARD() { DataTable DT = new DataTable(); DT = DASH.Select_Asset_By_Location(); Chart1.DataSource = DT; Chart1.Series["Series1"].XValueMember = "DashDesc"; Chart1.Series["Series1"].YValueMembers = "cnt"; Chart1.Series["Series1"]["PieLabelStyle"] = "outside"; Chart1.DataBind(); Chart1.Style.Add("width", "100%"); lblC1Total.Text = "Total Assets: " + String.Format("{0:#,##0}", DT.Compute("Sum(cnt)", "")); DataTable DT2 = new DataTable(); DT2 = DASH.Select_Asset_By_Area(); Chart2.DataSource = DT2; Chart2.Series["Series1"].XValueMember = "DashDesc"; Chart2.Series["Series1"].YValueMembers = "cnt"; Chart2.Series["Series1"]["PieLabelStyle"] = "outside"; Chart2.DataBind(); Chart2.Style.Add("width", "100%"); lblC2Total.Text = "Total Assets: " + String.Format("{0:#,##0}", DT2.Compute("Sum(cnt)", "")); DataTable DT3 = new DataTable(); DT3 = DASH.Select_Stock_Level(); Chart3.DataSource = DT3; Chart3.Series["Series1"].XValueMember = "CATEGORY"; Chart3.Series["Series1"].YValueMembers = "CNT"; Chart3.Series["Series1"]["PieLabelStyle"] = "outside"; Chart3.DataBind(); Chart3.Style.Add("width", "100%"); //lblC3Total.Text = "Total Assets: " + String.Format("{0:#,##0}", DT3.Compute("Sum(CNT)", "")); DataTable DT4 = new DataTable(); DT4 = DASH.Select_Budget_Actual(); ViewState["xBudget"] = DT4; Chart4.DataSource = DT4; Chart4.Series["Budget"].XValueMember = "NAME"; Chart4.Series["Budget"].YValueMembers = "BUDGET"; Chart4.Series["Actual"].XValueMember = "NAME"; Chart4.Series["Actual"].YValueMembers = "ACTUAL"; Chart4.DataBind(); Chart4.Style.Add("width", "100%"); grdView.DataSource = DT4; grdView.DataBind(); DataTable DT5 = new DataTable(); DT5 = DASH.Get_Critical(); ViewState["xCritical"] = DT5; grdCritical.DataSource = DT5; grdCritical.DataBind(); lblCritical.Text = DT5.Rows.Count.ToString(); DataTable DT6 = new DataTable(); DT6 = DASH.Get_Overstocked(); ViewState["xOverstocked"] = DT6; grdOverstocked.DataSource = DT6; grdOverstocked.DataBind(); lblOverstocked.Text = DT6.Rows.Count.ToString(); DataTable DT7 = new DataTable(); DT7 = DASH.Get_Asset_By_Location(); ViewState["xByLocation"] = DT7; grdByLocation.DataSource = DT7; grdByLocation.DataBind(); lblByLocation.Text = DT7.Rows.Count.ToString(); lblStockSummary.Text = DT7.Compute("Sum(CNT)", "").ToString(); //COUNTS DataTable DT10 = new DataTable(); DT10 = DASH.Get_OpenPO_Count(); lblOpenPo.Text = DT10.Rows[0][0].ToString(); DataTable DT11 = new DataTable(); DT11 = DASH.Get_POReceiving_Count(); lblPOReceiving.Text = DT11.Rows[0][0].ToString(); DataTable DT12 = new DataTable(); DT12 = DASH.Get_FATMApproval_Count(); lblFATMApproval.Text = DT12.Rows[0][0].ToString(); DataTable DT13 = new DataTable(); DT13 = DASH.Get_InTransit_Count(); lblInTransit.Text = DT13.Rows[0][0].ToString(); }
protected void Button8_Click(object sender, EventArgs e) { Label1.Visible = false; Label2.Visible = false; Label3.Visible = false; int num = retdata1(); int num1 = retdata2(); int num2 = nadiret(); int num3 = aerotechret(); int num4 = configret(); double[] yValues = { num, num1, num2, num3, num4 }; string[] xValues = { "AIROD", "AIROD AEROSPACE", "NADI", "TECHPOWER", "INAYAH" }; Chart1.Series["Default"].Points.DataBindXY(xValues, yValues); Chart1.Series["Default"].Points[0].Color = Color.Blue; Chart1.Series["Default"].Points[1].Color = Color.Red; Chart1.Series["Default"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; Chart1.Legends.Add("AIROD"); Chart1.Legends.Add("AIROD AEROSPACE" + num1); Chart1.Series["Default"].IsVisibleInLegend = true; Chart1.Series["Default"].Points[0].Label = "#PERCENT" + " AIROD"; Chart1.Series["Default"].Points[1].Label = "#PERCENT" + " AIROD AEROSPACE"; Chart1.Series["Default"].Points[2].Label = "#PERCENT" + " NADI"; Chart1.Series["Default"].Points[3].Label = "#PERCENT" + " TECHPOWER"; Chart1.Series["Default"].Points[4].Label = "#PERCENT" + " INAYAH"; Chart1.Series["Default"]["PieLabelStyle"] = "Disabled"; Chart1.ChartAreas["ChartArea1"].Area3DStyle.Enable3D = true; Chart1.Visible = true; Chart1.Enabled = true; int meet = retmeet1(); int meet1 = retmeet2(); Chart3.Legends.Clear(); Chart3.DataBind(); double[] yyValues = { meet, meet1 }; string[] xxValues = { "MEET HOURS", "NOT MEET HOURS" }; Chart3.Series["Default1"].Points.DataBindXY(xxValues, yyValues); Chart3.Series["Default1"].Points[0].Color = Color.Green; Chart3.Series["Default1"].Points[1].Color = Color.Yellow; Chart3.Series["Default1"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; Chart3.Legends.Add("MEET HOURS" + meet); Chart3.Legends.Add("NOT MEET HOURS" + meet1); Chart3.Series["Default1"].Points[0].Label = "#PERCENT" + " MEET HOURS"; Chart3.Series["Default1"].Points[1].Label = "#PERCENT" + " NOT MEET HOURS"; Chart3.Series["Default1"]["PieLabelStyle"] = "Disabled"; Chart3.Series["Default1"].IsVisibleInLegend = true; Chart3.ChartAreas["ChartArea2"].Area3DStyle.Enable3D = true; Chart3.Visible = true; Chart3.Enabled = true; int Type1 = Typeret(); int Type2 = Typeret1(); int Type3 = Typeret2(); Chart4.Legends.Clear(); Chart4.Series["Default3"]["PieLabelStyle"] = "Disabled"; double[] tValues = { Type1, Type2, Type3 }; string[] pValues = { "Priority", "Normal", "Urgent" }; Chart4.Series["Default3"].Points.DataBindXY(pValues, tValues); Chart4.Series["Default3"].Points[0].Color = Color.Green; Chart4.Series["Default3"].Points[1].Color = Color.Yellow; Chart4.Series["Default3"].Points[2].Color = Color.Black; Chart4.Series["Default3"].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Pie; Chart4.Legends.Add("Priority"); Chart4.Legends.Add("Normal"); Chart4.Legends.Add("Urgent"); Chart4.Series["Default3"].Points[0].Label = "#PERCENT" + " PRIORITY"; Chart4.Series["Default3"].Points[1].Label = "#PERCENT" + " NORMAL"; Chart4.Series["Default3"].Points[2].Label = "#PERCENT" + " URGENT"; Chart4.Series["Default3"]["PieLabelStyle"] = "Disabled"; Chart4.Series["Default3"].IsVisibleInLegend = true; Chart4.ChartAreas["ChartArea3"].Area3DStyle.Enable3D = true; Chart4.Visible = true; Chart4.Enabled = true; if (((TextBox1.Text != "") && (TextBox2.Text != ""))) { CrystalReportViewer1.SelectionFormula = "{tbl_srvmast1.Com_Type}='" + DropDownList1.SelectedItem.Text + "'" + "AND{tbl_srvmast1.Rec_Date}>=CDate('" + TextBox1.Text + "')" + "AND {tbl_srvmast1.Rec_Date}<=CDate('" + TextBox2.Text + "')" + "AND {tbl_srvmast1.Act_Email}='" + DropDownList5.SelectedItem.Text + "'" + "AND{tbl_srvmast1.Req_Status}='" + DropDownList2.SelectedItem.Text + "'"; CrystalReportViewer1.RefreshReport(); } else if (((TextBox3.Text != "") && (TextBox4.Text != ""))) { CrystalReportViewer1.SelectionFormula = "{tbl_srvmast1.Com_Type}='" + DropDownList1.SelectedItem.Text + "'" + "AND{tbl_srvmast1.Rec_Date}>=CDate('" + TextBox3.Text + "')" + "AND {tbl_srvmast1.Rec_Date}<=CDate('" + TextBox4.Text + "')" + "AND {tbl_srvmast1.Act_Email}='" + DropDownList5.SelectedItem.Text + "'" + "AND{tbl_srvmast1.Req_Status}='" + DropDownList2.SelectedItem.Text + "'"; CrystalReportViewer1.RefreshReport(); } }
protected void btest_Click(object sender, EventArgs e) { MySqlConnection conexion = new MySqlConnection(con); conexion.Open(); Boolean band = false; MySqlCommand query = conexion.CreateCommand(); query.CommandText = "SELECT * FROM bitacoraencabezado"; MySqlDataReader red = query.ExecuteReader(); Boolean band2 = false; Boolean band3 = false; Boolean band4 = false; while (red.Read()) { if (ddllista.SelectedIndex == 1) { if (string.Compare(txfecha1.Text, red["fecha"].ToString()) != 0 && string.Compare(txfecha2.Text, red["fecha"].ToString()) != 0) { band = true; } } else { if (ddllista.SelectedIndex == 2) { if (string.Compare(txfecha1.Text, red["fecha"].ToString()) != 0 && string.Compare(txfecha2.Text, red["fecha"].ToString()) != 0) { band2 = true; } } else { if (ddllista.SelectedIndex == 3) { if (string.Compare(txfecha1.Text, red["fecha"].ToString()) != 0 && string.Compare(txfecha2.Text, red["fecha"].ToString()) != 0) { band3 = true; } } else { if (ddllista.SelectedIndex == 4) { if (string.Compare(txfecha1.Text, red["fecha"].ToString()) != 0 && string.Compare(txfecha2.Text, red["fecha"].ToString()) != 0) { band4 = true; } } else { if (ddllista.SelectedIndex == 0) { Response.Write("<script language=javascript>alert('No has seleccionado ninguna opción de consulta')</script>"); break; } } } } } } if (band) { MySqlConnection conex = new MySqlConnection(con); conex.Open(); MySqlCommand quer = conex.CreateCommand(); quer.CommandText = "SELECT hs,hr,tiemporuta, fecha FROM bitacoraencabezado where fecha BETWEEN '" + txfecha1.Text + "' and '" + txfecha2.Text + "'"; MySqlDataReader re = quer.ExecuteReader(); Chart1.Visible = true; string aux1, aux2; int sum = 0, cont = 0; double totalh; while (re.Read()) { aux1 = re["hs"].ToString(); aux2 = re["hr"].ToString(); String[] shs = aux1.Split(':'); String[] shr = aux2.Split(':'); int dmin = (Convert.ToInt32(shr[1]) - Convert.ToInt32(shs[1])); if (dmin < 0) { dmin = dmin + 60; } int dhor = ((Convert.ToInt32(shr[0]) - Convert.ToInt32(shs[0])) * 60); int dh = dmin + dhor; sum = sum + dh; cont = cont + 1; Chart1.DataSource = re; Chart1.Series["X"].XValueMember = ""; Chart1.Series["Y"].YValueMembers = "tiemporuta"; Chart1.DataBind(); } conex.Close(); totalh = sum / cont; } if (band2) { MySqlConnection conex = new MySqlConnection(con); conex.Open(); MySqlCommand quer = conex.CreateCommand(); quer.CommandText = "SELECT kmInic,KmFin,kmrec FROM bitacoraencabezado where fecha BETWEEN '" + txfecha1.Text + "' and '" + txfecha2.Text + "'"; MySqlDataReader re = quer.ExecuteReader(); Chart2.Visible = true; List <int> por = new List <int>(); while (re.Read()) { Double kmi = Convert.ToDouble(re["kmInic"].ToString()); Double kmf = Convert.ToDouble(re["kmFin"].ToString()); //double kmin = double.Parse(kmi); //double kmfin = double.Parse(kmf); por.Add((Convert.ToInt32(re["kmrec"].ToString()))); Double tot = kmf - kmi; String total = Convert.ToString(tot); Chart2.DataSource = re; Chart2.Series["X"].XValueMember = ""; Chart2.Series["Y"].YValueMembers = "kmrec"; Chart2.DataBind(); } conex.Close(); int x = por.Count; int sum = 0, totalp; foreach (int li in por) { sum = sum + li; } totalp = sum / x; } else { } if (band3) { MySqlConnection conex = new MySqlConnection(con); conex.Open(); MySqlCommand quer = conex.CreateCommand(); quer.CommandText = "SELECT noRem from bitacoraencabezado where fecha BETWEEN '" + txfecha1.Text + "' and '" + txfecha2.Text + "'"; MySqlDataReader re = quer.ExecuteReader(); Chart3.Visible = true; while (re.Read()) { Chart3.DataSource = re; Chart3.Series["X"].XValueMember = ""; Chart3.Series["Y"].YValueMembers = "noRem"; Chart3.DataBind(); } quer.CommandText = "SELECT count(noRem) from bitacoraencabezado "; } else { } if (band4) { } else { } conexion.Close(); }