private void View3_DataBind() { GridView3.DataBind(); GridView4.DataBind(); Chart4.DataBind(); MultiView1.ActiveViewIndex = 2; }
private void buildHorizontalChart(string StudentYear) { String myConnect = ConfigurationManager.ConnectionStrings["EADPConnectionString2"].ToString(); SqlConnection myConn = new SqlConnection(myConnect); DataSet ds = new DataSet(); String strSQL = "SELECT Count(i.AdminNo) NoOfStudents, Location 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 "; SqlDataAdapter da; DateTime now = DateTime.Now; 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 [Location] "; //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 [Location] "; //check da = new SqlDataAdapter(strSQL.ToString(), myConn); da.SelectCommand.Parameters.AddWithValue("@paraStudentYear", StudentYear); } } else { strSQL += "Group By [Location] "; da = new SqlDataAdapter(strSQL.ToString(), myConn); } da.Fill(ds, "tripTable"); Chart4.DataSource = ds; Chart4.DataBind(); string imgPath4 = HttpContext.Current.Request.PhysicalApplicationPath + tmpChartName4; Chart4.SaveImage(imgPath4); }
private void View4_databind() { if (!DropDownList7.SelectedValue.Equals("-1")) { GridView4.DataBind(); Chart4.DataBind(); GridView5.DataSource = SqlDataSource11; GridView5.DataBind(); Label14.Text = DropDownList7.SelectedItem.Text + " results"; Label16.Visible = true; Label17.Visible = true; } }
private void loadChart4() { string queryString = (@"SELECT * FROM ( SELECT[pitchno], [pitcher], [pitchtype] FROM[dbo].[pitchData] WHERE playresult = 'HomeRun' ) AS SourceTable PIVOT(COUNT([pitchno]) FOR [pitchtype] IN([Splitter], [Fastball], [Sinker], [ChangeUp], [Cutter], [Other], [Curveball], [Slider])) AS PivotTable;" ); DataTable ChartData4 = new DataTable(); using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlDataAdapter sqlQueryAdapter = new SqlDataAdapter(queryString, connection)) { sqlQueryAdapter.SelectCommand.CommandTimeout = 120; DataSet dataSet = new DataSet(); sqlQueryAdapter.Fill(dataSet); connection.Close(); ChartData4 = dataSet.Tables[0]; } } DataView dv = new DataView(ChartData4); Chart4.DataSource = dv; Chart4.DataBind(); foreach (Series cs in Chart4.Series) { Debug.WriteLine(cs.Name); cs.ChartType = SeriesChartType.StackedColumn; } //Setting width of line Chart4.Series[0].BorderWidth = 10; }
private void LoadChartData3() { Chart4.ChartAreas[0].AxisX.MajorGrid.Enabled = false; Chart4.ChartAreas[0].AxisY.MajorGrid.Enabled = false; string query = "SELECT Category,catcount from tbl_city_wise_graph order by catcount DESC"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable table = new DataTable(); da.Fill(table); DataView dv = table.DefaultView; Chart4.DataBind(); Chart4.Series["Series1"].Points.DataBindXY(dv, "Category", dv, "catcount"); getdata(); }
private void View4_databind() { GridView4.DataBind(); Chart4.DataBind(); GridView5.DataSource = SqlDataSource11; GridView5.DataBind(); if (!DropDownList7.SelectedValue.Equals("-1")) { Label14.Text = DropDownList7.SelectedItem.Text + " My SGPA: " + ((Label)GridView5.Rows[0].Cells[0].FindControl("Label18")).Text; } else { Label14.Text = "No semester selected!"; } }
private void LoadChartData3() { Chart4.ChartAreas[0].AxisX.MajorGrid.Enabled = false; Chart4.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; Chart4.DataBind(); Chart4.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 LoadChartData3() { string from = ddl_frommonth.Text + "/" + ddl_fromdate.Text + "/" + ddl_fromyear.Text; string to = ddl_tomonth.Text + "/" + ddl_todate.Text + "/" + ddl_toyear.Text; Chart4.ChartAreas[0].AxisX.MajorGrid.Enabled = false; Chart4.ChartAreas[0].AxisY.MajorGrid.Enabled = false; string query = "SELECT Ddate,Vcount from tbl_show_all_graph where Ddate between '" + from + "' AND '" + to + "' order by Vcount DESC"; SqlDataAdapter da = new SqlDataAdapter(query, con); DataTable table = new DataTable(); da.Fill(table); DataView dv = table.DefaultView; Chart4.DataBind(); Chart4.Series["Series1"].Points.DataBindXY(dv, "Ddate", dv, "VCount"); getdata(); }
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(); } }
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(); }
//drop down 2 protected void DropDownList2_SelectedIndexChanged(object sender, EventArgs e) { //chart 4 string playresult = DropDownList2.SelectedValue.ToString(); Debug.WriteLine(playresult); string queryString = (@"SELECT * FROM ( SELECT[pitchno], [pitcher], [pitchtype] FROM[dbo].[pitchData] WHERE playresult = @playresult) AS SourceTable PIVOT(COUNT([pitchno]) FOR [pitchtype] IN([Splitter], [Fastball], [Sinker], [ChangeUp], [Cutter], [Other], [Curveball], [Slider])) AS PivotTable;" ); DataTable ChartData4 = new DataTable(); using (SqlConnection connection = new SqlConnection(connectionString)) { connection.Open(); using (SqlDataAdapter sqlQueryAdapter = new SqlDataAdapter(queryString, connection)) { sqlQueryAdapter.SelectCommand.Parameters.AddWithValue("@playresult", playresult); sqlQueryAdapter.SelectCommand.CommandTimeout = 120; DataSet dataSet = new DataSet(); sqlQueryAdapter.Fill(dataSet); connection.Close(); ChartData4 = dataSet.Tables[0]; } } DataView dv = new DataView(ChartData4); Chart4.DataSource = dv; Chart4.DataBind(); foreach (Series cs in Chart4.Series) { cs.Enabled = false; Debug.WriteLine(cs.Name); cs.ChartType = SeriesChartType.StackedColumn; foreach (DataPoint point in cs.Points) { Debug.WriteLine("pitcher: " + (double)point.YValues.GetValue(0)); if ((double)point.YValues.GetValue(0) != 0) { Debug.WriteLine("not empty"); cs.Enabled = true; } } } //Setting width of line Chart4.Series[0].BorderWidth = 10; }