private void PopulateReport() { Chart1.DataSource = cn.fill("select b.Bok_Name,count(a.Book_ID) as count from Book_Data b,Add_Cart a where a.Book_ID=b.Book_ID group by b.Bok_Name order by count(a.Book_ID) DESC"); Chart1.DataBind(); }
private void _setGraph(DataSet dsGrph) { DundasCharts.DundasChartBase(Chart1, ChartImageType.Flash, 800, 280 , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE), Color.FromArgb(0x20, 0x80, 0xD0), ChartDashStyle.Solid , -1 , ChartHatchStyle.None, GradientType.TopBottom, AntiAliasing.None); if (rdoGbn.SelectedValue == "HS") // 시간대별 누적공급량현황 { DataTable dtSply = dsGrph.Tables[0].Clone(); DataRow drSply; string strMM = ""; double dblCQtn = 0.00; double dblPQtn = 0.00; for (int i = 0; i < dsGrph.Tables[0].Rows.Count; i++) { drSply = dtSply.NewRow(); strMM = dsGrph.Tables[0].Rows[i][0].ToString(); dblCQtn += Convert.ToDouble(dsGrph.Tables[0].Rows[i]["CD_QTN"].ToString()); dblPQtn += Convert.ToDouble(dsGrph.Tables[0].Rows[i]["PD_QTN"].ToString()); drSply[0] = strMM; drSply[1] = dblCQtn; drSply[2] = dblPQtn; dtSply.Rows.Add(drSply); } Chart1.DataSource = dtSply.DefaultView; Series series1 = DundasCharts.CreateSeries(Chart1, "Series1", "Default", "금일", null, SeriesChartType.Column, 1, Color.FromArgb(0x5A, 0x7D, 0xDE), Color.FromArgb(0x4A, 0x58, 0x7E), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); Series series2 = DundasCharts.CreateSeries(Chart1, "Series2", "Default", "전일", null, SeriesChartType.Column, 1, Color.FromArgb(0xFF, 0x8A, 0x00), Color.FromArgb(0xD7, 0x41, 0x01), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); series1.ValueMembersY = "CD_QTN"; series2.ValueMembersY = "PD_QTN"; series1.ValueMemberX = "HH"; Chart1.ChartAreas[Chart1.Series[series1.Name].ChartArea].AxisX.Interval = 2; Chart1.ChartAreas[0].AxisY.LabelStyle.Format = "#,###"; Chart1.ChartAreas[0].AxisY2.Enabled = AxisEnabled.False; DundasAnimations.DundasChartBase(Chart1, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(Chart1, series1, 0.0, 3.0, true); DundasAnimations.GrowingAnimation(Chart1, series2, 3.0, 4.0, true); Chart1.DataBind(); } else // 일자별 공급량 { Chart1.DataSource = dsGrph.Tables[0].DefaultView; Series series1 = DundasCharts.CreateSeries(Chart1, "Series1", "Default", "계획", null, SeriesChartType.Column, 1, Color.FromArgb(0x5A, 0x7D, 0xDE), Color.FromArgb(0x4A, 0x58, 0x7E), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); Series series2 = DundasCharts.CreateSeries(Chart1, "Series2", "Default", "실적", null, SeriesChartType.Column, 1, Color.FromArgb(0xFF, 0x8A, 0x00), Color.FromArgb(0xD7, 0x41, 0x01), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); Series series3 = DundasCharts.CreateSeries(Chart1, "Series3", "Default", "달성율", null, SeriesChartType.Line, 3, Color.FromArgb(0x00, 0xC4, 0xCB), Color.FromArgb(0x00, 0xC4, 0xCB), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); series1.ValueMembersY = "QTN_PLAN"; series2.ValueMembersY = "QTN_ACTL"; series3.ValueMembersY = "QTN_RATE"; series1.ValueMemberX = "GUBUN"; string strChartArea = Chart1.Series[series3.Name].ChartArea; series3.YAxisType = AxisType.Secondary; Chart1.ChartAreas[0].AxisY.LabelStyle.Format = "#,###"; Chart1.ChartAreas[strChartArea].AxisY2.LabelStyle.Format = "P0"; Chart1.ChartAreas[0].AxisY2.Enabled = AxisEnabled.True; Chart1.ChartAreas[Chart1.Series[series1.Name].ChartArea].AxisX.Interval = 1; DundasAnimations.DundasChartBase(Chart1, AnimationTheme.None, -1, -1, false, 1); DundasAnimations.GrowingAnimation(Chart1, series1, 0.0, 3.0, true); DundasAnimations.GrowingAnimation(Chart1, series2, 3.0, 4.0, true); DundasAnimations.GrowingAnimation(Chart1, series3, 4.0, 6.0, true); Chart1.DataBind(); } }
protected override void Dispose(bool disposing) { Chart1.Dispose(); base.Dispose(disposing); }
protected void Chart1_Load(object sender, EventArgs e) { //设置图表的数据源 DataSet ds = lpp.Query_SunMasterTypeMonthTrends(); //Chart1.DataSource= ds.Tables[0].Select("年份="+DateTime.Now.Year); //ChartArea ca=new ChartArea(); //Series mySeries= new Series(); //Chart1.ChartAreas.Add(ca); //Chart1.Series.Add(mySeries) ; //设置图表Y轴对应项 //Chart1.Series[0].YValueMembers ="出站数"; //Chart1.Series[2].YValueMembers = "合格率"; ////设置图表X轴对应项 //Chart1.Series[0].XValueMember = "月份"; //Chart1.Series[2].XValueMember = "月份"; //Chart1.DataSource = ds.Tables[0].Select("年份=" + (DateTime.Now.Year-1)); //ChartArea ca=new ChartArea(); //Series mySeries= new Series(); //Chart1.ChartAreas.Add(ca); //Chart1.Series.Add(mySeries) ; //设置图表Y轴对应项 DataTable dt = new DataTable(); if (ds.Tables[0].Select("类型='塑封桥' and 月份=" + (DropDownList1.Text)).Any()) { dt = ds.Tables[0].Select("类型='塑封桥' and 月份=" + (DropDownList1.Text)).CopyToDataTable(); foreach (DataRow dr in dt.AsEnumerable()) { Chart1.Series[0].Points.AddXY(dr["年份"], dr["出站数"]); Chart1.Series[3].Points.AddXY(dr["年份"], dr["合格率"]); } } if (ds.Tables[0].Select("类型='浇灌桥' and 月份=" + (DropDownList1.Text)).Any()) { dt = ds.Tables[0].Select("类型='浇灌桥' and 月份=" + (DropDownList1.Text)).CopyToDataTable(); foreach (DataRow dr in dt.AsEnumerable()) { Chart1.Series[1].Points.AddXY(dr["年份"], dr["出站数"]); Chart1.Series[4].Points.AddXY(dr["年份"], dr["合格率"]); } } if (ds.Tables[0].Select("类型='模块事业部产品' and 月份=" + (DropDownList1.Text)).Any()) { dt = ds.Tables[0].Select("类型='模块事业部产品' and 月份=" + (DropDownList1.Text)).CopyToDataTable(); foreach (DataRow dr in dt.AsEnumerable()) { Chart1.Series[2].Points.AddXY(dr["年份"], dr["出站数"]); Chart1.Series[5].Points.AddXY(dr["年份"], dr["合格率"]); } } Chart1.Titles[0].Text = DropDownList1.Text + "月历年塑封桥、浇灌桥和模块事业部产品产量和合格率趋势图"; //设置图表X轴对应项 //绑定数据 Chart1.DataBind(); }
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(); } } }
public void BindAssetCurrentValChart() { Series seriesAssets = null; Legend legend = null; int i = 0; string[] XValues = null; double[] YValues = null; try { // Total Assets Chart seriesAssets = new Series("Assets"); legend = new Legend("AssetsLegend"); legend.Enabled = true; XValues = new string[dsAssetAggrCurrentValues.Tables[0].Rows.Count]; YValues = new double[dsAssetAggrCurrentValues.Tables[0].Rows.Count]; seriesAssets.ChartType = SeriesChartType.Pie; foreach (DataRow dr in dsAssetAggrCurrentValues.Tables[0].Rows) { XValues[i] = dr["AssetType"].ToString(); YValues[i] = double.Parse(dr["AggrCurrentValue"].ToString()); i++; } seriesAssets.Points.DataBindXY(XValues, YValues); //Chart1.DataSource = dsAssetAggrCurrentValues.Tables[0].DefaultView; Chart1.Series.Clear(); Chart1.Series.Add(seriesAssets); //Chart1.Series[0].XValueMember = "AssetType"; //Chart1.Series[0].YValueMembers = "AggrCurrentValue"; Chart1.Legends.Add(legend); Chart1.Series[0]["CollectedSliceExploded"] = "true"; Chart1.Legends["AssetsLegend"].Title = "Assets"; Chart1.Legends["AssetsLegend"].TitleAlignment = StringAlignment.Center; Chart1.Legends["AssetsLegend"].TitleSeparator = LegendSeparatorStyle.DoubleLine; Chart1.Legends["AssetsLegend"].TitleSeparatorColor = Color.Black; //Chart1.Legends["AssetsLegend"].BackColor = Color.Transparent; Chart1.Series[0].IsValueShownAsLabel = false; Chart1.Series[0]["PieLabelStyle"] = "Disabled"; Chart1.ChartAreas[0].Area3DStyle.Enable3D = true; Chart1.ChartAreas[0].Area3DStyle.Perspective = 50; Chart1.Series[0].ToolTip = "#VALX: #PERCENT"; //Chart1.Series[0].Label = "#PERCENT"; //Chart1.Series[0]["CollectedLegendText"] = "Other"; Chart1.BackColor = Color.Transparent; Chart1.ChartAreas[0].BackColor = Color.Transparent; LegendCellColumn colorColumn = new LegendCellColumn(); colorColumn.ColumnType = LegendCellColumnType.SeriesSymbol; colorColumn.HeaderText = "Color"; colorColumn.HeaderBackColor = Color.WhiteSmoke; Chart1.Legends["AssetsLegend"].CellColumns.Add(colorColumn); LegendCellColumn asset = new LegendCellColumn(); asset.ColumnType = LegendCellColumnType.Text; asset.HeaderText = "Asset"; asset.Alignment = ContentAlignment.TopLeft; asset.Text = "#VALX"; asset.HeaderBackColor = Color.WhiteSmoke; Chart1.Legends["AssetsLegend"].CellColumns.Add(asset); LegendCellColumn assetPercent = new LegendCellColumn(); assetPercent.Alignment = ContentAlignment.MiddleLeft; assetPercent.Text = "#PERCENT"; assetPercent.HeaderText = "% Of Assets"; assetPercent.Name = "PerformanceColumn"; assetPercent.HeaderBackColor = Color.WhiteSmoke; Chart1.Legends["AssetsLegend"].CellColumns.Add(assetPercent); foreach (DataPoint point in Chart1.Series[0].Points) { point["Exploded"] = "true"; } Chart1.DataBind(); } catch (BaseApplicationException Ex) { throw Ex; } catch (Exception Ex) { BaseApplicationException exBase = new BaseApplicationException(Ex.Message, Ex); NameValueCollection FunctionInfo = new NameValueCollection(); FunctionInfo.Add("Method", "AdvisorRMCustIndiDashboard.ascx:BindAssetCurrentValChart()"); object[] objects = new object[4]; objects[0] = portfolioId; objects[1] = dsAssetAggrCurrentValues; objects[2] = XValues; objects[3] = YValues; FunctionInfo = exBase.AddObject(FunctionInfo, objects); exBase.AdditionalInformation = FunctionInfo; ExceptionManager.Publish(exBase); throw exBase; } }
private void _setGraph(DataSet dsPie, DataSet dsLine) { // Line GRAPH DundasCharts.DundasChartBase(Chart2, ChartImageType.Flash, 550, 300 , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE), Color.FromArgb(0x20, 0x80, 0xD0), ChartDashStyle.Solid , -1 , ChartHatchStyle.None, GradientType.TopBottom, AntiAliasing.None); Series[] oasrType = new Series[dsLine.Tables[0].Rows.Count]; int intLP = 0; foreach (DataRow row in dsLine.Tables[0].Rows) { oasrType[intLP] = DundasCharts.CreateSeries(Chart2, "Series" + intLP.ToString(), Chart2.ChartAreas[0].Name, row["GBN_NM"].ToString(), null, SeriesChartType.Line, 3, GetChartColor(intLP), GetChartColor(intLP), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); for (int colIndex = 1; colIndex < dsLine.Tables[0].Columns.Count; colIndex++) { string columnName = dsLine.Tables[0].Columns[colIndex].ColumnName; double YVal = double.Parse(row[columnName].ToString()); Chart2.Series[oasrType[intLP].Name].Points.AddXY(columnName, YVal); } intLP += 1; } DundasAnimations.DundasChartBase(Chart2, AnimationTheme.None, -1, -1, false, 1); for (int i = 0; i < oasrType.Length; i++) { if (i == 0) { DundasAnimations.GrowingAnimation(Chart2, oasrType[i], 0.5, 1.0, true); } else { DundasAnimations.GrowingAnimation(Chart2, oasrType[i], i + 0.1, 1.0, true); } oasrType[i].MarkerStyle = GetMarkerStyle(i); oasrType[i].MarkerColor = GetChartColor(i); oasrType[i].MarkerBorderColor = GetChartColor(i); } Chart2.ChartAreas[0].AxisY.LabelStyle.Format = "#,###"; Chart2.DataSource = dsLine.Tables[0].DefaultView; Chart2.DataBind(); // PIE GRAPH DundasCharts.DundasChartBase(Chart1, ChartImageType.Flash, 250, 300 , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE), Color.FromArgb(0x20, 0x80, 0xD0), ChartDashStyle.Solid , -1 , ChartHatchStyle.None, GradientType.TopBottom, AntiAliasing.None); Series serPie = DundasCharts.CreateSeries(Chart1, "Series1", "Default", "고객상태별점유율", null, SeriesChartType.Pie, 1, Color.FromArgb(0x5A, 0x7D, 0xDE), Color.FromArgb(0x4A, 0x58, 0x7E), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); Chart1.Series[serPie.Name].ValueMemberX = "GBN_NM"; Chart1.Series[serPie.Name].ValueMembersY = "FNL_QNT"; serPie.FontColor = Color.White; Chart1.DataSource = dsPie; Chart1.DataBind(); }
public override void DataBind() { base.DataBind(); Chart1.DataBind(); }
public void SaveChartImage(Stream stream) { Chart1.SaveImage(stream); }
private void DataBindChart() { DataSet d = r.getAllModuleByTerm("Jan-2014"); DataTable ds = new DataTable(); ds.Columns.Add("quiz"); ds.Columns.Add("marks"); //for (int i = 0; i < d.Tables[0].Rows.Count; i++) //{ // DataRow dr = ds.NewRow(); // dr["quiz"] = d.Tables[0].Rows[i][0].ToString(); // dr["marks"] = d.Tables[0].Rows[i][1].ToString(); // ds.Rows.Add(dr); //} //Chart1.DataSource = ds; //Chart1.DataBind(); for (int j = 0; j < d.Tables.Count; j++) { Series sr = new Series(); sr["q"] = d.Tables[j].ToString(); // DataRow dr1= d.Tables[j].NewRow(); //dr1["quiz1"] = d.Tables[j].Rows[j][0].ToString(); //sr.Points.AddXY(dr1["quiz1"], j); for (int i = 0; i < d.Tables[j].Rows.Count; i++) { DataRow dr = ds.NewRow(); dr["quiz"] = d.Tables[j].Rows[i][0].ToString(); dr["marks"] = d.Tables[j].Rows[i][1].ToString(); sr.Points.AddXY(dr["quiz"].ToString(), Convert.ToDouble(dr["marks"].ToString())); ds.Rows.Add(dr); } Chart1.Series.Add(sr); } Chart1.DataSource = ds; Chart1.DataBind(); Chart2.DataSource = ds; Chart2.DataBind(); //Google Chart DataTable dsChartData = ds; StringBuilder strScript = new StringBuilder(); strScript.Append(@"<script type='text/javascript'> google.load('visualization', '1', {packages: ['corechart']});</script> <script type='text/javascript'> function drawVisualization() { var data = google.visualization.arrayToDataTable([ ['quiz', 'marks'],"); foreach (DataRow row in dsChartData.Rows) { strScript.Append("['" + row["quiz"] + "'," + row["marks"] + "],"); } strScript.Remove(strScript.Length - 1, 1); strScript.Append("]);"); strScript.Append("var options = { title : 'Monthly Coffee Production by Country', vAxis: {title: 'Cups'}, hAxis: {title: 'Month'}, seriesType: 'bars', series: {3: {type: 'area'}} };"); strScript.Append(" var chart = new google.visualization.ComboChart(document.getElementById('chart_div')); chart.draw(data, options); } google.setOnLoadCallback(drawVisualization);"); strScript.Append(" </script>"); ltScripts.Text = strScript.ToString(); //Pie Chart StringBuilder strScript1 = new StringBuilder(); strScript1.Append(@"<script type='text/javascript'> google.load('visualization', '1', {packages: ['corechart']}); </script> <script type='text/javascript'> function drawChart() { var data = google.visualization.arrayToDataTable([ ['quiz', 'marks'],"); foreach (DataRow row in dsChartData.Rows) { strScript1.Append("['" + row["quiz"] + "'," + row["marks"] + "],"); } strScript1.Remove(strScript1.Length - 1, 1); strScript1.Append("]);"); strScript1.Append(@" var options = { title: 'My Daily Schedule', is3D: true, }; "); strScript1.Append(@"var chart = new google.visualization.PieChart(document.getElementById('piechart_3d')); chart.draw(data, options); } google.setOnLoadCallback(drawChart); "); strScript1.Append(" </script>"); ltScripts.Text = strScript1.ToString(); }
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 populateChartSectionViaFunction(string function, string sectionlist, int questionID) { try { MultiView1.Visible = true; Chart1.Series.Clear(); Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray; MultiView1.Visible = true; DataTable table = new DataTable(); table.Columns.Add("SectionGroup"); table.Columns.Add("AverageGrading"); table.Columns.Add("Date"); ArrayList listofdates = dbmanager.GetListofDatesViaFunction(function); string[] sectionsplit = sectionlist.Split(','); ArrayList listofquestion = dbmanager.GetAllQuestion(); ArrayList listofstaff = dbmanager.GetAllStaffDetails(); foreach (DateTime date in listofdates) { foreach (string section in sectionsplit) { double result = 0.0; double staffAverage = 0.0; double staffAverageResult = 0.0; int count = 0; foreach (staffinfo staff in listofstaff) { if (staff.Section.Contains(section) && staff.Function.Equals(function)) { if (questionID == 0) { foreach (Question qn in listofquestion) { staffAverage += dbmanager.GetAvgRating(staff.Uid, date, qn.QuestionID); // for all question } int countquestion = dbmanager.GetTotalCountQuestionInPeriod(staff.Uid, date); staffAverageResult = Math.Round((staffAverage / countquestion), 1); count++; } else { staffAverage += dbmanager.GetAvgRating(staff.Uid, date, questionID); // for per question int countquestion = dbmanager.GetTotalCountQuestionInPeriod(staff.Uid, date); staffAverageResult = staffAverage; count++; } } } try { result = Math.Round((staffAverageResult / count), 1); } catch { result = 0.0; } string monthname = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(date.Month); table.Rows.Add(section, result, monthname.Substring(0, 3) + "/" + date.Year.ToString().Substring(2, 2)); result = 0.0; staffAverage = 0.0; staffAverageResult = 0.0; } } bool display = false; for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i].ItemArray[1].ToString() == "0") { display = false; } else { display = true; break; } } if (display == true) { Chart1.Visible = true; DataTableReader datareader = table.CreateDataReader(); Chart1.ChartAreas[0].AxisX.Title = "Period of evaluation"; Chart1.ChartAreas[0].AxisY.Title = "Average grade"; Chart1.DataBindCrossTable(datareader, "SectionGroup", "Date", "AverageGrading", ""); Chart1.Legends.Add("Legend"); Chart1.Legends[0].Enabled = true; Chart1.Legends[0].BackColor = System.Drawing.Color.Transparent; Chart1.Width = 1000; Chart1.Height = 600; MultiView1.ActiveViewIndex = 0; } else { Chart1.Visible = false; MultiView1.ActiveViewIndex = 1; lbDisplay.Text = "<b>No result found</b>"; } } catch (Exception e) { MultiView1.Visible = false; MessageBoxShowWithoutredirect(e.Message); } }
protected void populateChartSectionViaFunctionALL() { try { MultiView1.Visible = true; Chart1.Series.Clear(); Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray; MultiView1.Visible = true; DataTable table = new DataTable(); table.Columns.Add("AverageGrading"); table.Columns.Add("Date"); ArrayList listofdates = dbmanager.GetListofDatesViaAll(); // decare and get items double result = 0.0; //double staffAverage = 0.0; //double staffAverageResult = 0.0; //ArrayList listofstaff = dbmanager.GetAllStaffDetails(); //ArrayList listofquestion = dbmanager.GetAllQuestion(); foreach (DateTime date in listofdates) { //foreach (staffinfo staff in listofstaff) //{ //foreach (Question qn in listofquestion) //{ //staffAverage += dbmanager.GetAvgRating(staff.Uid, date, qn.QuestionID); //staffAverage += dbmanager.GetAverageStaffPeriod(staff.Uid, date); //} //int countquestion = dbmanager.GetTotalCountQuestionInPeriod(staff.Uid, date); //staffAverageResult = Math.Round((staffAverage / countquestion), 1); //} //result = Math.Round((staffAverageResult / listofstaff.Count), 1); result = dbmanager.GetAverageAllStaffPeriod(date); string monthname = System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(date.Month); table.Rows.Add(result, monthname.Substring(0, 3) + "/" + date.Year.ToString().Substring(2, 2)); result = 0.0; //staffAverage = 0.0; //staffAverageResult = 0.0; } bool display = false; for (int i = 0; i < table.Rows.Count; i++) { if (table.Rows[i].ItemArray[1].ToString() == "0") { display = false; } else { display = true; break; } } if (display == true) { Chart1.Visible = true; DataTableReader datareader = table.CreateDataReader(); Chart1.ChartAreas[0].AxisY.Title = "Average grade"; Chart1.DataBindCrossTable(datareader, "Date", "", "AverageGrading", ""); Chart1.Legends.Add("Legend"); Chart1.Legends[0].Enabled = true; Chart1.Legends[0].BackColor = System.Drawing.Color.Transparent; Chart1.Width = 1000; Chart1.Height = 600; MultiView1.ActiveViewIndex = 0; } else { Chart1.Visible = false; MultiView1.ActiveViewIndex = 1; lbDisplay.Text = "<b>No result found</b>"; } } catch (Exception e) { MultiView1.Visible = false; MessageBoxShowWithoutredirect(e.Message); } }
private void FillAllChartsAndGrids(string QueryDate, string QueryLocation1, string QueryLocation2) { string connectionString = WebConfigurationManager.ConnectionStrings["procyk01ConnectionString"].ConnectionString; try { //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ string sql = "SELECT complaint, CT "; sql += "FROM complaints "; sql += "WHERE (complaintdate = '" + QueryDate + "') AND (neighborhood = '" + QueryLocation1 + "') "; if (CheckBox1.Checked == true) { sql += "AND complaint NOT IN ('GENERAL CONSTRUCTION', 'NONCONST', 'PAINT - PLASTER', 'PLUMBING', 'ELECTRIC', 'HEATING') "; } ; sql += "ORDER BY CT DESC LIMIT 10"; OdbcConnection con1 = new OdbcConnection(connectionString); OdbcCommand cmdO = new OdbcCommand(sql, con1); con1.Open(); OdbcDataReader reader1 = cmdO.ExecuteReader(); Chart1.DataSource = reader1; Chart1.DataBind(); Chart1.Series["Series1"].ToolTip = "#VALX\nCount: #VALY"; reader1.Close(); con1.Close(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ string sql2 = "SELECT complaint, CT "; sql2 += "FROM complaints "; sql2 += "WHERE (complaintdate = '" + QueryDate + "') AND (neighborhood = '" + QueryLocation2 + "') "; if (CheckBox2.Checked == true) { sql2 += "AND complaint NOT IN ('GENERAL CONSTRUCTION', 'NONCONST', 'PAINT - PLASTER', 'PLUMBING', 'ELECTRIC', 'HEATING') "; } ; sql2 += "ORDER BY CT DESC LIMIT 10"; OdbcConnection con2 = new OdbcConnection(connectionString); OdbcCommand cmd2 = new OdbcCommand(sql2, con2); con2.Open(); OdbcDataReader reader2 = cmd2.ExecuteReader(); Chart2.DataSource = reader2; Chart2.DataBind(); Chart2.Series["Series1"].ToolTip = "#VALX\nCount: #VALY"; reader2.Close(); con2.Close(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ string sql3 = "SELECT Neighborhood, ZipCode, AvgIncome, BelowPovertyLine, Population "; sql3 += "FROM Demographics WHERE (Neighborhood = '" + QueryLocation1 + "') "; sql3 += "ORDER BY ZipCode"; OdbcConnection con3 = new OdbcConnection(connectionString); OdbcCommand cmd3 = new OdbcCommand(sql3, con3); con3.Open(); OdbcDataReader reader3 = cmd3.ExecuteReader(); GridView2.DataSource = reader3; GridView2.DataBind(); reader3.Close(); con3.Close(); //~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ string sql4 = "SELECT Neighborhood, ZipCode, AvgIncome, BelowPovertyLine, Population "; sql4 += "FROM Demographics WHERE (Neighborhood = '" + QueryLocation2 + "') "; sql4 += "ORDER BY ZipCode"; OdbcConnection con4 = new OdbcConnection(connectionString); OdbcCommand cmd4 = new OdbcCommand(sql4, con4); con4.Open(); OdbcDataReader reader4 = cmd4.ExecuteReader(); GridView1.DataSource = reader4; GridView1.DataBind(); reader4.Close(); con4.Close(); Label1.Text = QueryLocation1; Label2.Text = QueryLocation2; } finally { //con1.Close(); } }
protected void Button1_Click(object sender, EventArgs e) { if (DropDownList1.Text == "micromax") { con.Open(); SqlDataAdapter da = new SqlDataAdapter("select Feature,Rating from microrating", con); DataTable dt = new DataTable(); DataSet ds = new DataSet(); da.Fill(ds); Chart1.DataSource = ds; Chart1.Series["Series1"].XValueMember = "Feature"; Chart1.Series["Series1"].YValueMembers = "Rating"; Chart1.DataBind(); con.Close(); } if (DropDownList1.Text == "lenovo") { con.Open(); SqlDataAdapter da = new SqlDataAdapter("select Feature,Rating from lenovorating", con); DataTable dt = new DataTable(); DataSet ds = new DataSet(); da.Fill(ds); Chart1.DataSource = ds; Chart1.Series["Series1"].XValueMember = "Feature"; Chart1.Series["Series1"].YValueMembers = "Rating"; Chart1.DataBind(); con.Close(); } if (DropDownList1.Text == "lava") { con.Open(); SqlDataAdapter da = new SqlDataAdapter("select Feature,Rating from lavarating", con); DataTable dt = new DataTable(); DataSet ds = new DataSet(); da.Fill(ds); Chart1.DataSource = ds; Chart1.Series["Series1"].XValueMember = "Feature"; Chart1.Series["Series1"].YValueMembers = "Rating"; Chart1.DataBind(); con.Close(); } if (DropDownList1.Text == "samsung") { con.Open(); SqlDataAdapter da = new SqlDataAdapter("select Feature,Rating from samsungrating", con); DataTable dt = new DataTable(); DataSet ds = new DataSet(); da.Fill(ds); Chart1.DataSource = ds; Chart1.Series["Series1"].XValueMember = "Feature"; Chart1.Series["Series1"].YValueMembers = "Rating"; Chart1.DataBind(); con.Close(); } if (DropDownList1.Text == "intex") { con.Open(); SqlDataAdapter da = new SqlDataAdapter("select Feature,Rating from intexrating", con); DataTable dt = new DataTable(); DataSet ds = new DataSet(); da.Fill(ds); Chart1.DataSource = ds; Chart1.Series["Series1"].XValueMember = "Feature"; Chart1.Series["Series1"].YValueMembers = "Rating"; Chart1.DataBind(); con.Close(); } }
static void Main(string[] args) { Config cfg = null; try { cfg = Config.LoadFromFile(ConfigFile); } catch { if (cfg == null) { cfg = new Config(); } cfg.SaveToFile(ConfigFile); Console.WriteLine("Require config"); return; } SmtpClient smtp = new SmtpClient(cfg.SmtpServer, cfg.SmtpPort) { EnableSsl = cfg.SmtpEnableSsl, Credentials = new NetworkCredential(cfg.SmtpUser, cfg.SmtpPassword) }; List <int> sended = new List <int>(), errorSend = new List <int>(); if (File.Exists(DoneFile)) { sended = JsonConvert.DeserializeObject <List <int> >(File.ReadAllText("sended.json")); if (sended == null) { sended = new List <int>(); } } // Connect using (MySqlConnection con = new MySqlConnection(new MySqlConnectionStringBuilder() { Password = cfg.DatabasePassword, Database = cfg.Database, UserID = cfg.DatabaseUserID, Server = cfg.DatabaseServer, Port = cfg.DatabasePort } .ToString())) { con.Open(); using (MySqlCommand com = con.CreateCommand()) { com.Parameters.Clear(); // Fetch users & scores using (DataTable dt = SqlHelper.SelectDataTable(com, "SELECT user_id,name,email,user_points from vteams order by user_points DESC,name ASC")) using (DataTable dtscores = SqlHelper.SelectDataTable(com, "SELECT user_id, ts, points from vscores")) { int maxScore; Score[] globalScore = Chart3.Preload(dtscores, out maxScore); Bitmap bmp_banner = Res.report; foreach (DataRow dr in dt.Rows) { string email = dr["email"].ToString(); if (string.IsNullOrEmpty(email)) { continue; } int userId = Convert.ToInt32(dr["user_id"]); if (sended.Contains(userId)) { continue; } // Get chart 1 string url1 = Chart1.GetChart(userId, com); if (string.IsNullOrEmpty(url1)) { continue; } // Get chart 2 string url2 = Chart2.GetChart(userId, com); if (string.IsNullOrEmpty(url2)) { continue; } string url3 = Chart3.GetChart(userId, dr["name"].ToString(), com, dtscores, globalScore, maxScore); if (string.IsNullOrEmpty(url3)) { continue; } // Generate image using (WebClient client = new WebClient()) { byte[] d1 = client.DownloadData(url1); byte[] d2 = client.DownloadData(url2); byte[] d3 = client.DownloadData(url3); if (d1 == null || d2 == null || d3 == null) { errorSend.Add(userId); continue; } using (MemoryStream ms1 = new MemoryStream(d1)) using (MemoryStream ms2 = new MemoryStream(d2)) using (MemoryStream ms3 = new MemoryStream(d3)) using (Image bmp1 = Image.FromStream(ms1)) using (Image bmp2 = Image.FromStream(ms2)) using (Image bmp3 = Image.FromStream(ms3)) { Bitmap bmpnew = new Bitmap(bmp_banner.Width, bmp_banner.Height); using (Graphics g = Graphics.FromImage(bmpnew)) { g.DrawImageUnscaled(bmp_banner, 0, 0); using (Font f1 = new Font("Arial", 19, FontStyle.Bold)) using (Font f2 = new Font("Arial", 21, FontStyle.Bold)) using (Brush br = new SolidBrush(Color.White)) //using (Brush br = new SolidBrush(Color.FromArgb(174, 34, 34))) using (StringFormat sf = new StringFormat() { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center }) { int puesto = dt.Rows.IndexOf(dr) + 1; g.DrawString(dr["name"].ToString(), f1, br, new Rectangle(0, 265, 350, 80), sf); g.DrawString(dr["user_points"].ToString(), f2, br, new Rectangle(550, 278, 170, 80), sf); //g.FillRectangle(br, new Rectangle(720, 265, 200, 80)); g.DrawString((puesto == 1 ? "WINNER!" : puesto.ToString() + "º"), f2, br, new Rectangle(710, 278, 195, 80), sf); } g.DrawImageUnscaled(bmp1, 64, 447); g.DrawImageUnscaled(bmp2, 64, 700); g.DrawImageUnscaled(bmp3, 64, 1023); } using (MemoryStream ms = new MemoryStream()) { bmpnew.Save(ms, ImageFormat.Png); //File.WriteAllBytes("D:\\report-test.png", ms.ToArray()); try { MailMessage msg = new MailMessage() { From = new MailAddress(cfg.SmtpUser, "No reply"), Body = cfg.MailBody, Subject = cfg.MailSubject, IsBodyHtml = false, }; //email = "*****@*****.**"; msg.To.Add(email); //msg.Bcc.Add("*****@*****.**"); ms.Seek(0, SeekOrigin.Begin); msg.Attachments.Add(new Attachment(ms, "report.png", "image/png")); smtp.Send(msg); sended.Add(userId); } catch (Exception e) { errorSend.Add(userId); } } } } } } } } File.WriteAllText(DoneFile, JsonConvert.SerializeObject(sended)); if (errorSend.Count > 0) { Console.WriteLine(string.Join(",", errorSend)); } Console.WriteLine("END PROCESS, PRESS ENTER TO CONTINUE"); Console.ReadLine(); }
protected void Button1_Click(object sender, EventArgs e) { if (FileUploader.HasFile) { try { FileUploader.SaveAs(Server.MapPath(DefaultFileName) + FileUploader.FileName); Image <Bgr, Byte> originalImage = new Image <Bgr, byte>(Server.MapPath(DefaultFileName) + FileUploader.FileName); int width, height, channels = 0; width = originalImage.Width; height = originalImage.Height; channels = originalImage.NumberOfChannels; Image <Bgr, byte> colorImage = new Image <Bgr, byte>(originalImage.ToBitmap()); Image <Gray, byte> grayImage = colorImage.Convert <Gray, Byte>(); float[] GrayHist; DenseHistogram Histo = new DenseHistogram(255, new RangeF(0, 255)); Histo.Calculate(new Image <Gray, Byte>[] { grayImage }, true, null); GrayHist = new float[256]; Histo.MatND.ManagedArray.CopyTo(GrayHist, 0); float largestHist = GrayHist[0]; int thresholdHist = 0; for (int i = 0; i < 255; i++) { if (GrayHist[i] > largestHist) { largestHist = GrayHist[i]; thresholdHist = i; } } grayImage = grayImage.ThresholdAdaptive(new Gray(255), ADAPTIVE_THRESHOLD_TYPE.CV_ADAPTIVE_THRESH_MEAN_C, THRESH.CV_THRESH_BINARY, 85, new Gray(4)); colorImage = colorImage.Copy(); int countRedCells = 0; using (MemStorage storage = new MemStorage()) { for (Contour <Point> contours = grayImage.FindContours(Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_LIST, storage); contours != null; contours = contours.HNext) { Contour <Point> currentContour = contours.ApproxPoly(contours.Perimeter * 0.015, storage); if (currentContour.BoundingRectangle.Width > 20) { CvInvoke.cvDrawContours(colorImage, contours, new MCvScalar(0, 0, 255), new MCvScalar(0, 0, 255), -1, 2, Emgu.CV.CvEnum.LINE_TYPE.EIGHT_CONNECTED, new Point(0, 0)); colorImage.Draw(currentContour.BoundingRectangle, new Bgr(0, 255, 0), 1); countRedCells++; } } } Image <Gray, byte> grayImageCopy2 = originalImage.Convert <Gray, Byte>(); grayImageCopy2 = grayImageCopy2.ThresholdBinary(new Gray(100), new Gray(255)); colorImage = colorImage.Copy(); int countMalaria = 0; using (MemStorage storage = new MemStorage()) { for (Contour <Point> contours = grayImageCopy2.FindContours(Emgu.CV.CvEnum.CHAIN_APPROX_METHOD.CV_CHAIN_APPROX_SIMPLE, Emgu.CV.CvEnum.RETR_TYPE.CV_RETR_TREE, storage); contours != null; contours = contours.HNext) { Contour <Point> currentContour = contours.ApproxPoly(contours.Perimeter * 0.015, storage); if (currentContour.BoundingRectangle.Width > 20) { CvInvoke.cvDrawContours(colorImage, contours, new MCvScalar(255, 0, 0), new MCvScalar(255, 0, 0), -1, 2, Emgu.CV.CvEnum.LINE_TYPE.EIGHT_CONNECTED, new Point(0, 0)); colorImage.Draw(currentContour.BoundingRectangle, new Bgr(0, 255, 0), 1); countMalaria++; } } } colorImage.Save(Server.MapPath(DefaultFileName2) + FileUploader.FileName); inputDiv.Attributes["style"] = "display: block; margin-left: auto; margin-right: auto"; outputDiv.Attributes["style"] = "display: block; margin-left: auto; margin-right: auto"; Image1.ImageUrl = this.ResolveUrl(DefaultFileName + FileUploader.FileName); Image2.ImageUrl = this.ResolveUrl(DefaultFileName2 + FileUploader.FileName); Chart1.DataBindTable(GrayHist); Label1.Text = "Uploaded Successfully"; Label2.Text = "File name: " + FileUploader.PostedFile.FileName + "<br>" + "File Size: " + FileUploader.PostedFile.ContentLength + " kb<br>" + "Content type: " + FileUploader.PostedFile.ContentType + "<br>" + "Resolution: " + width.ToString() + "x" + height.ToString() + "<br>" + "Number of channels: " + channels.ToString() + "<br>" + "Histogram (maximum value): " + largestHist + " @ " + thresholdHist; LabelRed.Text = countRedCells.ToString(); LabelMalaria.Text = countMalaria.ToString(); } catch (Exception ex) { Label1.Text = "ERROR: " + ex.Message.ToString(); Label2.Text = ""; } } else { Label1.Text = "You have not specified a file."; Label2.Text = ""; } }
//to generete graph by click btn protected void btnGenerate_Click(object sender, EventArgs e) { supplierCode1 = ddlSupplier1.SelectedItem.Text; supplierCode2 = ddlSupplier2.SelectedItem.Text; category = ddlCategory.SelectedItem.Text; categoryId = ics.FindCategoryByFullName(category).CategoryId; startYear = Convert.ToInt32(ddlStartYear.SelectedItem.Text); startMonth = Convert.ToInt32(ddlStartMonth.SelectedItem.Text); endYear = Convert.ToInt32(ddlEndYear.SelectedItem.Text); endMonth = Convert.ToInt32(ddlEndMonth.SelectedItem.Text); if (supplierCode1 == supplierCode2) { lblSupplierError.Text = "This will only display " + supplierCode1 + "'s data."; supplierCode2 = "None"; } else { lblSupplierError.Text = ""; } string st = startYear.ToString() + "/" + startMonth.ToString() + "/01"; string ed = endYear.ToString() + "/" + endMonth.ToString() + "/01"; dts = Convert.ToDateTime(st); dte = Convert.ToDateTime(ed); if (DateTime.Compare(dts, dte) > 0) { lblDateError.Text = "End date can not before start date, please choose again!"; PanelOrderTrend.Visible = false; } else { PanelOrderTrend.Visible = true; ordertrendlist1.Clear(); ordertrendlist2.Clear(); //identify month amount lblDateError.Text = ""; TimeSpan ts = dte - dts; double days = ts.Days; int monthamount = (int)Math.Floor((days + 2) / 30); //1. supplier1 data for (int k = 0; k < monthamount + 1; k++) { DateTime dts11 = dts.AddDays(30 * k); DateTime dts12 = dts.AddDays(30 * (k + 1)); List <Order> o1 = context.Orders.Where(x => x.DateOrdered.CompareTo(dts11) >= 0 && x.DateOrdered.CompareTo(dts12) <= 0 && x.SupplierCode == supplierCode1).ToList <Order>(); int sum1 = 0; for (int i = 0; i < o1.Count(); i++) { List <OrderDetail> od1 = iod.FindOrderDetailByPONumber(o1.ElementAt(i).PoNumber); for (int j = 0; j < od1.Count(); j++) { if (iss.FindStationeryById(od1.ElementAt(j).ItemCode).CategoryId == categoryId) { sum1 = sum1 + od1.ElementAt(j).Quantity; } } } OrderTrend ot1 = new OrderTrend(); if (startMonth + k > 12) { DateTime d11 = new DateTime(startYear + 1, startMonth + k - 12, 1); ot1.Month = string.Format("{0:MMM yyyy}", d11); } else { DateTime d10 = new DateTime(startYear, startMonth + k, 1); ot1.Month = string.Format("{0:MMM yyyy}", d10); } ot1.Quantity = sum1; ordertrendlist1.Add(ot1); } //2. supplier2 data for (int k = 0; k < monthamount + 1; k++) { DateTime dts21 = dts.AddDays(30 * k); DateTime dts22 = dts.AddDays(30 * (k + 1)); List <Order> o2 = context.Orders.Where(x => x.DateOrdered.CompareTo(dts21) >= 0 && x.DateOrdered.CompareTo(dts22) <= 0 && x.SupplierCode == supplierCode2).ToList <Order>(); int sum2 = 0; for (int i = 0; i < o2.Count(); i++) { List <OrderDetail> od2 = iod.FindOrderDetailByPONumber(o2.ElementAt(i).PoNumber); for (int j = 0; j < od2.Count(); j++) { if (iss.FindStationeryById(od2.ElementAt(j).ItemCode).CategoryId == categoryId) { sum2 = sum2 + od2.ElementAt(j).Quantity; } } } CompareOrderTrend ot2 = new CompareOrderTrend(); if (startMonth + k > 12) { DateTime d21 = new DateTime(startYear + 1, startMonth + k - 12, 1); ot2.Month = string.Format("{0:MMM yyyy}", d21); } else { DateTime d20 = new DateTime(startYear, startMonth + k, 1); ot2.Month = string.Format("{0:MMM yyyy}", d20); } ot2.CompareQuantity = sum2; ordertrendlist2.Add(ot2); } //get graphs //1. table lblTableTiltle.Text = "Order Trend Table"; var query = from otl1 in ordertrendlist1 join otl2 in ordertrendlist2 on otl1.Month equals otl2.Month select new { otl1.Month, otl1.Quantity, otl2.CompareQuantity }; gvTable.Columns[1].HeaderText = supplierCode1 + "'s Quantity"; gvTable.Columns[2].HeaderText = supplierCode2 + "'s Quantity"; gvTable.DataSource = query; gvTable.DataBind(); //2. bar chart lblChartTitle.Text = "Order Trend Chart"; Chart1.Series["Series1"].XValueMember = "Month"; Chart1.Series["Series1"].YValueMembers = "Quantity"; Chart1.Series["Series2"].XValueMember = "Month"; Chart1.Series["Series2"].YValueMembers = "CompareQuantity"; Chart1.ChartAreas["ChartArea1"].AxisX.Title = "Year-Month"; Chart1.ChartAreas["ChartArea1"].AxisY.Title = "Total Item Amount"; Chart1.Series["Series1"].Name = supplierCode1; Chart1.Series["Series2"].Name = supplierCode2; Chart1.DataSource = query; Chart1.DataBind(); } }
public void Dispose() { Chart1.Dispose(); Chart2.Dispose(); }
protected void Page_Load(object sender, EventArgs e) { //read and validate login if (Session["cuserval"] != null) { if (Session["cuserval"].ToString() == Readjobcookie()) { } else { Response.Redirect("login.aspx"); } } else { Response.Redirect("login.aspx"); } //////////////////////////////////// //set zoom levels for all charts int xzoom = Convert.ToInt32(zoomer.SelectedItem.Value); Chart1.Width = xzoom; jobapps.Width = xzoom; jobpostedview.Width = xzoom; //get recruiter id var clmpop = new DlMainpagepopulator(); int rectempid = clmpop.RecName(Session["pusername"].ToString()); //get jobviews var cljview = new DlJobviewdata(); Chart1.DataSource = cljview.GetJobviewdata(rectempid); Chart1.Series["Series1"].YValueMembers = "jobviews"; Chart1.Series["Series1"].XValueMember = "dateviewed"; Chart1.Series["Series1"].MarkerStyle = MarkerStyle.Circle; Chart1.Series["Series1"].MarkerSize = 3; Chart1.Series["Series1"].MarkerColor = Color.Black; Chart1.Series["Series1"].ChartType = SeriesChartType.Line; Chart1.DataBind(); //get applications made jobapps.DataSource = cljview.Getappviewdata(rectempid); jobapps.Series["Series1"].YValueMembers = "jobviews"; jobapps.Series["Series1"].XValueMember = "dateviewed"; jobapps.Series["Series1"].MarkerStyle = MarkerStyle.Circle; jobapps.Series["Series1"].MarkerSize = 3; jobapps.Series["Series1"].MarkerColor = Color.Black; jobapps.Series["Series1"].ChartType = SeriesChartType.Line; jobapps.DataBind(); //get posted jobs jobpostedview.DataSource = cljview.Getpjjobviewdata(rectempid); jobpostedview.Series["Series1"].YValueMembers = "jobviews"; jobpostedview.Series["Series1"].XValueMember = "dateviewed"; jobpostedview.Series["Series1"].MarkerStyle = MarkerStyle.Circle; jobpostedview.Series["Series1"].MarkerSize = 3; jobpostedview.Series["Series1"].MarkerColor = Color.Black; jobpostedview.Series["Series1"].ChartType = SeriesChartType.Line; jobpostedview.DataBind(); }
protected void btnOblicz_Click(object sender, EventArgs e) { bool bVal1 = Int32.TryParse(txtTmin.Text, out Tmin); bool bVal2 = Int32.TryParse(txtTmax.Text, out Tmax); bool bVal4 = Double.TryParse(txtUt_m.Text, out U_mnoznik); //Chart1.Visible = true; //Chart4.Visible = true; //--- modelParams = new ModelParams(); //modelParams.TimeStart = tmin; //modelParams.TimeStop = tmax; modelParams.Uarma = Ua * U_mnoznik; modelParams.Uflux = Uf; modelParams.Raext = Ra_ext; modelParams.Rfext = Rf_ext; modelParams.Maext = Ma_ext * 0.001; //przeliczenie jednostek do µF i mH modelParams.Mfext = Mf_ext * 0.001; //przeliczenie jednostek do µF i mH If = modelParams.Uflux / modelParams.Rfint; //Ia = (modelParams.Uarma - modelParams.Gaf * If * ω) / modelParams.Raint; //ω = (modelParams.Uarma - modelParams.Raint * Ia) / (modelParams.Gaf * If); //modelParams.Jrext = Jr_ext; modelParams.Drext = Dr_ext; //Text = modelParams.Drext * ω - modelParams.Gaf * If * Ia; //ustawianie parametrow momentu zewnetrznego modelParams.Textern = Text; modelParams.Textern_t1 = Text_t1; modelParams.Textern_t2 = Text_t2; //---- flag = false; //size = Convert.ToInt32(Tmax / delta); //liczenie ilości próbek ; modelParams.Tstop //modelParams.PtsResults = size; size = modelParams.PtsResults; //------------Sprawdzenie poprawności wprowadzania danych - walidacja------------- if (Tmin >= Tmax || Tmin < 0 || !bVal1 || !bVal2) { validation.Visible = true; labErrorMessage_Tm.Visible = true; labErrorMessage_Tm.Text = "Wartości parametrów t<sub>min</sub> oraz t<sub>max</sub> zostały wprowadzone błędnie "; txtTmin.BackColor = System.Drawing.Color.Red; txtTmax.BackColor = System.Drawing.Color.Red; flag = true; } /* Sprawdzenie poprawności napięć*/ if (!bVal4 || Ua < 0) { validation.Visible = true; labErrorMessage_Voltage.Visible = true; labErrorMessage_Voltage.Text = "Błędnie wprowadzona wartość napięcia twornika"; txtUt_m.BackColor = System.Drawing.Color.Red; flag = true; } /*pętla*/ if (flag == true) { return; } else { labErrorMessage.Visible = true; labErrorMessage.Text = "Dane zostały wprowadzone poprawnie"; Chart1.Visible = true; } this.mathModel = new MathModel(modelParams, modelParams.TimeStart, modelParams.InitCondit); this.solver = new Solver(modelParams, mathModel); //--- solver.SolverStart(modelParams); double[,] wyniki = solver.Results; //-- pierwsza tabela danych do wykresu 1 table1 = new DataTable(); //-- DataColumn column1; DataRow row1; //-- column1 = new DataColumn(); column1.DataType = Type.GetType("System.Double"); column1.ColumnName = "Torque"; table1.Columns.Add(column1); column1 = new DataColumn(); column1.DataType = Type.GetType("System.Double"); column1.ColumnName = "ω"; table1.Columns.Add(column1); column1 = new DataColumn(); column1.DataType = Type.GetType("System.Double"); column1.ColumnName = "ω przy Uan"; table1.Columns.Add(column1); //---------------- //int size_tmin = Convert.ToInt32(Tmin / delta); //labErrorMessage.Text = "jest to ilosc " + (int)size; double[,] array; for (int i = Tmin; i <= Tmax; i++) { array = new double[Tmax + 1, 3]; array[i, 0] = i; array[i, 1] = ((modelParams.Uarma / modelParams.Gaf * If) - (modelParams.Raint / Math.Pow(modelParams.Gaf * If, 2)) * i) * 10; array[i, 2] = ((Ua / modelParams.Gaf * If) - (modelParams.Raint / Math.Pow(modelParams.Gaf * If, 2)) * i) * 10; row1 = table1.NewRow(); row1["Torque"] = array[i, 0]; row1["ω"] = array[i, 1]; row1["ω przy Uan"] = array[i, 2]; table1.Rows.Add(row1); } //-- dView1 = new DataView(table1); //-- Chart1.Series.Clear(); Chart1.ChartAreas.Add("Wykres01"); //-- Chart1.DataBindTable(dView1, "Torque"); Chart1.Width = 900; Chart1.Height = 750; Chart1.Series["ω"].ChartType = SeriesChartType.Line; Chart1.Series["ω"].BorderWidth = 3; //grubosc wykresu Chart1.Series["ω przy Uan"].ChartType = SeriesChartType.Line; Chart1.Series["ω przy Uan"].BorderWidth = 3; //grubosc wykresu //if (chkIcs.Checked) //{ // Chart1.Visible = true; // Chart1.Series["Ics"].ChartType = SeriesChartType.Line; // Chart1.Series["Ics"].BorderWidth = 3;//grubosc wykresu //} //Chart1.ChartAreas[0].AxisX.LineWidth = 2; Chart1.ChartAreas[0].AxisX.Minimum = 0; //Chart1.ChartAreas[0].AxisX.Maximum = (double)table1.Rows[size]["Torque"]; //Chart1.ChartAreas[0].AxisY.Minimum = 0.0; Chart1.ChartAreas[0].AxisY.ArrowStyle = AxisArrowStyle.Lines;//strzałki wykresu //Chart1.ChartAreas[0].AxisX.ArrowStyle = AxisArrowStyle.Lines; Chart1.ChartAreas[0].AxisX.LabelStyle.Format = "{#0.###}"; Chart1.ChartAreas[0].AxisX.Title = "Text [Nm]"; Chart1.ChartAreas[0].AxisY.Title = "ω [rad/s]"; Chart1.ChartAreas[0].AxisX.TitleFont = new System.Drawing.Font("Calibri", 11F, System.Drawing.FontStyle.Bold); Chart1.ChartAreas[0].AxisY.TitleFont = new System.Drawing.Font("Calibri", 11F, System.Drawing.FontStyle.Bold); }
protected void btnSearch_Click(object sender, EventArgs e) { sqlParamS[0].Value = Convert.ToInt32(ddlBranch.SelectedValue); sqlParamS[1].Value = Convert.ToInt32(ddlProductDivision.SelectedValue); sqlParamS[2].Value = Convert.ToInt32(DDlYear.SelectedValue); sqlParamS[3].Value = Convert.ToInt32(DDLMonth.SelectedValue); DataSet ds = new DataSet(); ds = objSqlDataAccessLayer.ExecuteDataset(CommandType.StoredProcedure, "tmpOutBound", sqlParamS); Chart1.DataSource = ds.Tables[0]; Chart2.DataSource = ds.Tables[1]; Chart3.DataSource = ds.Tables[2]; Chart4.DataSource = ds.Tables[3]; Chart5.DataSource = ds.Tables[4]; Chart1.Series.Add("Series" + "0"); Chart2.Series.Add("Series" + "1"); Chart3.Series.Add("Series" + "2"); Chart4.Series.Add("Series" + "3"); Chart5.Series.Add("Series" + "4"); Chart1.ChartAreas.Add("ChartArea_" + "0"); Chart2.ChartAreas.Add("ChartArea_" + "1"); Chart3.ChartAreas.Add("ChartArea_" + "2"); Chart4.ChartAreas.Add("ChartArea_" + "3"); Chart5.ChartAreas.Add("ChartArea_" + "4"); Chart1.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart1.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart2.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart2.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart3.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart3.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart4.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart4.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart5.ChartAreas[0].AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; Chart5.ChartAreas[0].AxisY.MajorGrid.LineColor = System.Drawing.Color.LightGray; // Chart1.Series[rowindex].ChartArea = Chart1.ChartAreas[rowindex].Name; // Set series members names for the X and Y values Chart1.Series[0].XValueMember = "Scaleanswer_desc"; Chart1.Series[0].YValueMembers = "Percentage"; Chart2.Series[0].XValueMember = "Scaleanswer_desc"; Chart2.Series[0].YValueMembers = "Percentage"; Chart3.Series[0].XValueMember = "Scaleanswer_desc"; Chart3.Series[0].YValueMembers = "Percentage"; Chart4.Series[0].XValueMember = "Scaleanswer_desc"; Chart4.Series[0].YValueMembers = "Percentage"; Chart5.Series[0].XValueMember = "Scaleanswer_desc"; Chart5.Series[0].YValueMembers = "Percentage"; Chart1.ChartAreas[0].AxisY.Title = "Percentage (%)"; Chart1.ChartAreas[0].AxisX.Title = "Rating by customers"; Chart2.ChartAreas[0].AxisY.Title = "Percentage (%)"; Chart3.ChartAreas[0].AxisY.Title = "Percentage (%)"; Chart4.ChartAreas[0].AxisY.Title = "Percentage (%)"; Chart5.ChartAreas[0].AxisY.Title = "Percentage (%)"; Chart1.Series[0].IsValueShownAsLabel = true; Chart2.Series[0].IsValueShownAsLabel = true; Chart3.Series[0].IsValueShownAsLabel = true; Chart4.Series[0].IsValueShownAsLabel = true; Chart5.Series[0].IsValueShownAsLabel = true; Chart1.Series[0].LabelFormat = "{0:0.00}"; Chart2.Series[0].LabelFormat = "{0:0.00}"; Chart3.Series[0].LabelFormat = "{0:0.00}"; Chart4.Series[0].LabelFormat = "{0:0.00}"; Chart5.Series[0].LabelFormat = "{0:0.00}"; if (ds.Tables[0].Rows.Count > 0) { Chart1.Titles.Add(ds.Tables[0].Rows[0]["question"].ToString().Replace("<br >", "")); } if (ds.Tables[1].Rows.Count > 0) { Chart2.Titles.Add(ds.Tables[1].Rows[0]["question"].ToString()); } if (ds.Tables[2].Rows.Count > 0) { Chart3.Titles.Add(ds.Tables[2].Rows[0]["question"].ToString()); } if (ds.Tables[3].Rows.Count > 0) { Chart4.Titles.Add(ds.Tables[3].Rows[0]["question"].ToString()); } if (ds.Tables[4].Rows.Count > 0) { Chart5.Titles.Add(ds.Tables[4].Rows[0]["question"].ToString()); } // Chart1.Series[1].ChartType = SeriesChartType.Column; // Chart1.Series[1].BorderWidth = 2; //// Set series members names for the X and Y values //Chart1.Series[1].XValueMember = "Scaleanswer_desc"; //Chart1.Series[1].YValueMembers = "Percentage"; Chart1.DataBind(); }
protected void btnAnaliz_Click(object sender, EventArgs e) { DataTable table = new DataTable(); DataTable table2 = new DataTable(); table = miner.Analiz(miner.VeriTabanindaAra(txtSearch.Text, int.Parse(Session["kullanici_id"].ToString()), CheckBox1.Checked), int.Parse(Session["kullanici_id"].ToString())); if (table.Rows.Count > 1) { table2.Columns.Add("CreatedDate"); table2.Columns.Add("İyi"); table2.Columns.Add("Kötü"); table2.Columns.Add("Veri/Gün"); table.Columns.Remove("SearchId"); table.Columns.Remove("GeoCode"); table.Columns.Remove("UserId"); table.Columns.Remove("USerProfileText"); table.Columns.Remove("HasPhoto"); table.Columns.Remove("UserFollowerCount"); table.Columns.Remove("UserFollowingCount"); table.Columns.Remove("UserScreenName"); table.Columns.Remove("IsReweet"); table.Columns.Remove("Text2"); DateTime t1; DateTime t2; t1 = DateTime.Parse(table.Rows[1]["CreatedDate"].ToString()); t2 = DateTime.Parse(table.Rows[1]["CreatedDate"].ToString()); for (int t = 1; t < table.Rows.Count; t++) { if (t1 > DateTime.Parse(table.Rows[t]["CreatedDate"].ToString())) { t1 = DateTime.Parse(table.Rows[t]["CreatedDate"].ToString()); } if (t2 < DateTime.Parse(table.Rows[t]["CreatedDate"].ToString())) { t2 = DateTime.Parse(table.Rows[t]["CreatedDate"].ToString()); } } table.DefaultView.Sort = "Fark desc"; int gun = t2.DayOfYear - t1.DayOfYear; int derece, derece1 = 0, derece2 = 0, sayi1 = 0, sayi2 = 0; for (int i = 0; i <= gun; i++) { for (int j = 1; j < table.Rows.Count; j++) { string a = t1.AddDays(i).ToShortDateString(); string b = DateTime.Parse(table.Rows[1]["CreatedDate"].ToString()).ToShortDateString(); if (DateTime.Parse(table.Rows[j]["CreatedDate"].ToString()).ToShortDateString() == t1.AddDays(i).ToShortDateString() && table.Rows[j]["Fark"].ToString() != "0") { if (int.Parse(table.Rows[j]["Fark"].ToString()) > 0) { sayi1++; //derece1 += int.Parse(table.Rows[j]["İyi"].ToString()); } else if (int.Parse(table.Rows[j]["Fark"].ToString()) < 0) { sayi2++; //derece2 += int.Parse(table.Rows[j]["Kötü"].ToString()); } } } if (sayi1 != 0 && sayi2 != 0) { table2.Rows.Add(t1.AddDays(i).ToShortDateString(), sayi1 * 100 / (sayi1 + sayi2), sayi2 * 100 / (sayi1 + sayi2)); } derece1 += sayi1; derece2 += sayi2; sayi1 = 0; sayi2 = 0; } Chart1.DataSource = table2; Chart1.Series[0].XValueMember = "CreatedDate"; Chart1.Series[0].YValueMembers = "İyi"; Chart1.Series[0].Color = Color.FromArgb(141, 198, 48); Chart1.Series.Add("1"); Chart1.Series[1].XValueMember = "CreatedDate"; Chart1.Series[1].YValueMembers = "Kötü"; Chart1.Series[1].Color = Color.FromArgb(228, 81, 54); Chart1.DataBind(); GridView1.DataSource = table; GridView1.DataBind(); try { for (int i = 0; i < GridView1.Rows.Count - 1; i++) { if (int.Parse(GridView1.Rows[i].Cells[9].Text) < 0) { GridView1.Rows[i].BackColor = Color.FromArgb(228, 81, 54); } else if (int.Parse(GridView1.Rows[i].Cells[9].Text) > 0) { GridView1.Rows[i].BackColor = Color.FromArgb(141, 198, 48); } } } catch { } lblDurum.Text = "Toplam veri sayısı : " + GridView1.Rows.Count.ToString() + " Olumlu veri sayısı : " + derece1.ToString() + " Olumsuz veri sayısı : " + derece2.ToString() + " Toplam : " + (derece1 + derece2).ToString(); } else { lblDurum.Text = "Aranılan kritere uygun veri bulunamadı."; } }
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 _setGraph(DataSet dsLine, DataSet dsPie) { string strCYY = cboYY.SelectedValue; string strFYY = (int.Parse(strCYY) - 2).ToString(); string strPYY = (int.Parse(strCYY) - 1).ToString(); string strCMM = cboMM.SelectedValue; //strCYY = strCYY + "년"; // 년도별 매출량 그래프 DundasCharts.DundasChartBase(Chart1, ChartImageType.Flash, 800, 250 , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE), Color.FromArgb(0x20, 0x80, 0xD0), ChartDashStyle.Solid , -1 , ChartHatchStyle.None, GradientType.TopBottom, AntiAliasing.None); // 전년매출비중 파이그래프 DundasCharts.DundasChartBase(Chart2, ChartImageType.Flash, 265, 200 , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE), Color.FromArgb(0x20, 0x80, 0xD0), ChartDashStyle.Solid , -1 , ChartHatchStyle.None, GradientType.TopBottom, AntiAliasing.None); // 당년매출비중 파이그래프 DundasCharts.DundasChartBase(Chart3, ChartImageType.Flash, 265, 200 , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE), Color.FromArgb(0x20, 0x80, 0xD0), ChartDashStyle.Solid , -1 , ChartHatchStyle.None, GradientType.TopBottom, AntiAliasing.None); // 익년매출비중 파이그래프 DundasCharts.DundasChartBase(Chart4, ChartImageType.Flash, 265, 200 , BorderSkinStyle.Emboss, Color.FromArgb(181, 64, 1), 2 , Color.FromArgb(0xFF, 0xFF, 0xFE) , Color.FromArgb(0xFF, 0xFF, 0xFE), Color.FromArgb(0x20, 0x80, 0xD0), ChartDashStyle.Solid , -1 , ChartHatchStyle.None, GradientType.TopBottom, AntiAliasing.None); //================================================================== LINE GRAPH Series[] oasrType = new Series[dsLine.Tables[0].Rows.Count]; int intLP = 0; foreach (DataRow row in dsLine.Tables[0].Rows) { oasrType[intLP] = DundasCharts.CreateSeries(Chart1, "Series" + intLP.ToString(), Chart1.ChartAreas[0].Name, row["YY"].ToString(), null, SeriesChartType.Line, 3, GetChartColor(intLP), GetChartColor(intLP), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); for (int colIndex = 1; colIndex < dsLine.Tables[0].Columns.Count; colIndex++) { // For each column (column 1 and onward) add the value as a point string columnName = dsLine.Tables[0].Columns[colIndex].ColumnName; double YVal = double.Parse(row[columnName].ToString()); Chart1.Series[oasrType[intLP].Name].Points.AddXY(columnName, YVal); } intLP += 1; } DundasAnimations.DundasChartBase(Chart1, AnimationTheme.None, -1, -1, false, 1); for (int i = 0; i < oasrType.Length; i++) { oasrType[i].MarkerStyle = GetMarkerStyle(i); oasrType[i].MarkerColor = GetChartColor(i); oasrType[i].MarkerBorderColor = GetMarkerBorderColor(i); if (i == 0) { DundasAnimations.GrowingAnimation(Chart1, oasrType[i], 0.5, 1.0, false); } else { DundasAnimations.GrowingAnimation(Chart1, oasrType[i], i + 0.1, 1.0, true); } } Chart1.ChartAreas[0].AxisY.LabelStyle.Format = "#,###"; Chart1.DataSource = dsLine.Tables[0].DefaultView; Chart1.DataBind(); //=================================================================== PIE GRAPH Series series2 = DundasCharts.CreateSeries(Chart2, "Series2", "Default", "매출비중", null, SeriesChartType.Pie, 1, Color.FromArgb(0x5A, 0x7D, 0xDE), Color.FromArgb(0x4A, 0x58, 0x7E), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); Series series3 = DundasCharts.CreateSeries(Chart3, "Series3", "Default", "매출비중", null, SeriesChartType.Pie, 1, Color.FromArgb(0x5A, 0x7D, 0xDE), Color.FromArgb(0x4A, 0x58, 0x7E), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); Series series4 = DundasCharts.CreateSeries(Chart4, "Series4", "Default", "매출비중", null, SeriesChartType.Pie, 1, Color.FromArgb(0x5A, 0x7D, 0xDE), Color.FromArgb(0x4A, 0x58, 0x7E), Color.FromArgb(64, 0, 0, 0), 1, 9, Color.FromArgb(64, 64, 64)); series2.FontColor = Color.White; series3.FontColor = Color.White; series4.FontColor = Color.White; double dblPTAmt = 0.00; double dblCTAmt = 0.00; double dblNTAmt = 0.00; double dblPRate = 0.00; double dblCRate = 0.00; double dblNRate = 0.00; double dblEtcRate = 0.00; DataRow[] drPPie = dsPie.Tables[0].Select("YY='" + strFYY + "'", "S_RSLT DESC"); DataRow[] drCPie = dsPie.Tables[0].Select("YY='" + strPYY + "'", "S_RSLT DESC"); DataRow[] drNPie = dsPie.Tables[0].Select("YY='" + strCYY + "'", "S_RSLT DESC"); for (int i = 0; i < drPPie.Length; i++) { dblPTAmt += double.Parse(drPPie[i]["S_RSLT"].ToString()); } for (int i = 0; i < drCPie.Length; i++) { dblCTAmt += double.Parse(drCPie[i]["S_RSLT"].ToString()); } for (int i = 0; i < drNPie.Length; i++) { dblNTAmt += double.Parse(drNPie[i]["S_RSLT"].ToString()); } dblEtcRate = 0.00; int intLoop = 0; string strLabel = ""; for (intLoop = 0; intLoop < drPPie.Length; intLoop++) { dblPRate = (dblPTAmt == 0) ? 0 : (double.Parse(drPPie[intLoop]["S_RSLT"].ToString()) / dblPTAmt) * 100; if (intLoop < 3) { strLabel = drPPie[intLoop]["SGBUN_NM"].ToString() + "(" + Math.Round(dblPRate, 1).ToString() + "%)"; Chart2.Series[series2.Name].Points.AddXY(strLabel, dblPRate); } else { dblEtcRate += dblPRate; } } if (drPPie.Length > 3) { Chart2.Series[series2.Name].Points.AddXY("기타", dblEtcRate); } dblEtcRate = 0.00; for (intLoop = 0; intLoop < drCPie.Length; intLoop++) { dblCRate = (dblCTAmt == 0) ? 0 : (double.Parse(drCPie[intLoop]["S_RSLT"].ToString()) / dblCTAmt) * 100; if (intLoop < 3) { strLabel = drCPie[intLoop]["SGBUN_NM"].ToString() + "(" + Math.Round(dblCRate, 1).ToString() + "%)"; Chart3.Series[series3.Name].Points.AddXY(strLabel, dblCRate); } else { dblEtcRate += dblCRate; } } if (drCPie.Length > 3) { Chart3.Series[series3.Name].Points.AddXY("기타", dblEtcRate); } dblEtcRate = 0.00; for (intLoop = 0; intLoop < drNPie.Length; intLoop++) { dblNRate = (dblNTAmt == 0) ? 0 :(double.Parse(drNPie[intLoop]["S_RSLT"].ToString()) / dblNTAmt) * 100; if (intLoop < 3) { strLabel = drNPie[intLoop]["SGBUN_NM"].ToString() + "(" + Math.Round(dblNRate, 1).ToString() + "%)"; Chart4.Series[series4.Name].Points.AddXY(strLabel, dblNRate); } else { dblEtcRate += dblNRate; } } if (drNPie.Length > 3) { Chart4.Series[series4.Name].Points.AddXY("기타", dblEtcRate); } Chart2.Titles.Add(strFYY); Chart3.Titles.Add(strPYY); Chart4.Titles.Add(strCYY); Chart2.Titles[0].Text = (strFYY + "년"); Chart3.Titles[0].Text = (strPYY + "년"); Chart4.Titles[0].Text = (strCYY + "년"); }
protected void Button1_Click(object sender, EventArgs e) { DateTime dt = Convert.ToDateTime(TextBox1.Text); string date = dt.ToString("yyyy/MM/dd"); DateTime tt = Convert.ToDateTime(TextBox2.Text); string date2 = tt.ToString("yyyy/MM/dd"); if (dt > tt) { Page.ClientScript.RegisterStartupScript(GetType(), "msgtype", "alert('Select Date Properly !!!')", true); } else { SqlDataAdapter da; DataSet ds = new DataSet(); string ol = "select foodname,sum(quantity) as quantity,sum(amount) as amount,date from transact where date >= '" + date + "' and date<='" + date2 + "' group by foodname,quantity,amount,date"; da = new SqlDataAdapter(ol, con); da.Fill(ds); double amt = 0; if (ds.Tables[0].Rows.Count > 0) { TableHeaderRow hr = new TableHeaderRow(); TableHeaderCell thc = new TableHeaderCell(); TableHeaderCell thc1 = new TableHeaderCell(); TableHeaderCell thc2 = new TableHeaderCell(); TableHeaderCell thc3 = new TableHeaderCell(); thc.Text = "Food Name"; thc1.Text = "Quantity"; thc2.Text = "Amount"; thc3.Text = "Date"; hr.Cells.Add(thc); hr.Cells.Add(thc1); hr.Cells.Add(thc2); hr.Cells.Add(thc3); Table1.Rows.Add(hr); for (int j = 0; j < ds.Tables[0].Rows.Count; j++) { TableRow tRow = new TableRow(); TableCell tcell = new TableCell(); TableCell tcell1 = new TableCell(); TableCell tcell2 = new TableCell(); TableCell tcell3 = new TableCell(); TableCell tcell4 = new TableCell(); TableCell tcell5 = new TableCell(); tcell.Text = ds.Tables[0].Rows[j][0].ToString(); tcell.HorizontalAlign = HorizontalAlign.Center; tcell1.Text = ds.Tables[0].Rows[j][1].ToString(); tcell1.HorizontalAlign = HorizontalAlign.Center; tcell2.Text = ds.Tables[0].Rows[j][2].ToString(); tcell2.HorizontalAlign = HorizontalAlign.Center; tcell3.Text = ds.Tables[0].Rows[j][3].ToString(); tcell3.HorizontalAlign = HorizontalAlign.Center; amt = amt + Convert.ToDouble(ds.Tables[0].Rows[j][2].ToString()); tRow.Cells.Add(tcell); tRow.Cells.Add(tcell1); tRow.Cells.Add(tcell2); tRow.Cells.Add(tcell3); Table1.Rows.Add(tRow); } Chart1.DataSource = ds; TableRow tr = new TableRow(); TableCell tc = new TableCell(); TableCell tc1 = new TableCell(); tc.ColumnSpan = 2; tc.Text = "Total"; tc.HorizontalAlign = HorizontalAlign.Right; tc.Font.Bold = true; tc.Font.Size = 20; tc1.Text = Convert.ToString(amt); tc1.HorizontalAlign = HorizontalAlign.Center; tc1.Font.Bold = true; tc1.Font.Size = 20;; tr.Cells.Add(tc); tr.Cells.Add(tc1); Table1.Rows.Add(tr); Chart1.Series["Series1"].XValueMember = "foodname"; Chart1.Series["Series1"].YValueMembers = "amount"; // Chart1.Series.Add("Series2"); // Chart1.Series["Series2"].YValueMembers = "date"; Chart1.DataBind(); } else { Page.ClientScript.RegisterStartupScript(GetType(), "msgtype", "alert('No Data Available!!!')", true); } } }
protected void CreateTable(object sender, EventArgs e) { using (LastADEntities b = new LastADEntities()) { string selecteditem = DropDownList2.SelectedItem.Text.ToString(); ItemList idd = new ItemList(); //To get item id idd = b.ItemLists.Where(p => p.Description.Equals(selecteditem)).First(); String idddd = idd.ItemId; int NumOfDepts = 0; ArrayList DeptSelected = new ArrayList(); //To get all the departments chosen by user for (int i = 0; i < DeptList.Items.Count; i++) { if (DeptList.Items[i].Selected) { String temp = DeptList.Items[i].Value.ToString(); Department dd = b.Departments.Where(p => p.DepartmentName.Contains(temp)).First(); String temp2 = dd.DepartmentCode; DeptSelected.Add(temp2); NumOfDepts++; } } Chart1.ChartAreas.Add("ChartArea2"); var sd = yearrange[0]; var ed = yearrange[1]; //Setting up the Chart properties Chart1.ChartAreas[0].AxisX.Title = "Year"; Chart1.ChartAreas[0].AxisY.Title = "Quantity Ordered"; Chart1.ChartAreas[0].BorderDashStyle = ChartDashStyle.Solid; Chart1.Legends.Add("QuantityOrdered"); Title title = new Title(); title.Font = new Font("Arial", 14, FontStyle.Bold); title.Text = "Trend Analysis of Quantity of " + idd.Description + " Ordered"; Chart1.ChartAreas[0].AxisX.Minimum = sd; Chart1.ChartAreas[0].AxisX.Maximum = ed; Chart1.Titles.Add(title); int z = 0; //To get all the datapoints that match the conditions chosen by user foreach (string ddept in DeptSelected) { var xy = b.Transactions.Where(p => p.ItemId.Contains(idddd) && p.EntryDate.Value.Year >= sd && p.EntryDate.Value.Year <= ed) .Join(b.Requisitions, m => m.Requid, f => f.RequId, (m, f) => new { Requid = m.Requid, EmployeeId = f.EmployeeId, m.EntryDate, m.Quantity }) .Join(b.Employees.Where(p => p.DepartmentCode.Equals(ddept)), q => q.EmployeeId, p => p.UserId, (q, p) => new { q.EntryDate, p.DepartmentCode, q.Quantity }) .GroupBy(n => n.EntryDate.Value.Year) .Select(g => new { b = g.Key, a = g.Sum(a => a.Quantity) }).ToList(); List <int> xcoor = new List <int>(); List <int> ycoor = new List <int>(); //Converting datapoints into coordinates for the chart for (int q = sd; q <= ed; q++) { for (int p = 0; p < xy.Count; p++) { if (q == xy[p].b) { xcoor.Add(q); ycoor.Add((int)(xy[p].a)); } //else //{ // xcoor.Add(q); // ycoor.Add(0); //} } } Chart1.Series.Add(ddept.ToString()); Chart1.Series[z].ChartType = System.Web.UI.DataVisualization.Charting.SeriesChartType.Line; Chart1.Series[z].Points.DataBindXY(xcoor, ycoor); Chart1.Series[z].IsVisibleInLegend = true; Chart1.Series[z].IsValueShownAsLabel = true; Chart1.Series[z].BorderWidth = 3; Chart1.Series[z].ToolTip = "Quantity Ordered: #VALY"; Chart1.Series[z].Font = new System.Drawing.Font("Arial", 12); Chart1.Series[z]["LabelStyle"] = "Top"; Chart1.Series[z].LabelBackColor = Color.LightCyan; z++; Chart1.DataBind(); } } }
protected void Chart1_Load(object sender, EventArgs e) { DataSet ds = pmp.PurchaseInfo(Convert.ToInt32(DropDownList1.SelectedValue), Convert.ToInt32(DropDownList2.SelectedValue)); //Chart1.DataSource= ds.Tables[0].Select("年份="+DateTime.Now.Year); //ChartArea ca=new ChartArea(); //Series mySeries= new Series(); //Chart1.ChartAreas.Add(ca); //Chart1.Series.Add(mySeries) ; //设置图表Y轴对应项 //Chart1.Series[0].YValueMembers ="出站数"; //Chart1.Series[2].YValueMembers = "合格率"; ////设置图表X轴对应项 //Chart1.Series[0].XValueMember = "月份"; //Chart1.Series[2].XValueMember = "月份"; //Chart1.DataSource = ds.Tables[0].Select("年份=" + (DateTime.Now.Year-1)); //ChartArea ca=new ChartArea(); //Series mySeries= new Series(); //Chart1.ChartAreas.Add(ca); //Chart1.Series.Add(mySeries) ; //设置图表Y轴对应项 DataTable dt = new DataTable(); if (ds.Tables[0].Select("年份=" + (DropDownList1.SelectedValue == "999" ? DateTime.Now.Year.ToString(CultureInfo.InvariantCulture) : DropDownList1.SelectedValue)).Any()) { dt = ds.Tables[0].Select("年份=" + (DropDownList1.SelectedValue == "999" ? DateTime.Now.Year.ToString(CultureInfo.InvariantCulture) : DropDownList1.SelectedValue)).CopyToDataTable(); foreach (DataRow dr in dt.AsEnumerable()) { Chart1.Series[0].Points.AddXY(dr["月份"], dr["采购金额"]); } } //if (ds.Tables[0].Select("类型='浇灌桥' and 年份=" + (DropDownList1.SelectedValue)).Any()) //{ // dt = ds.Tables[0].Select("类型='浇灌桥' and 年份=" + (DropDownList1.SelectedValue)).CopyToDataTable(); // foreach (DataRow dr in dt.AsEnumerable()) // { // Chart1.Series[1].Points.AddXY(dr["月份"], dr["出站数"]); // Chart1.Series[4].Points.AddXY(dr["月份"], dr["合格率"]); // } //} //if (ds.Tables[0].Select("类型='模块事业部产品' and 年份=" + (DropDownList1.SelectedValue)).Any()) //{ // dt = ds.Tables[0].Select("类型='模块事业部产品' and 年份=" + (DropDownList1.SelectedValue)).CopyToDataTable(); // foreach (DataRow dr in dt.AsEnumerable()) // { // Chart1.Series[2].Points.AddXY(dr["月份"], dr["出站数"]); // Chart1.Series[5].Points.AddXY(dr["月份"], dr["合格率"]); // } //} Chart1.Titles[0].Text = (DropDownList1.SelectedValue == "999" ? DateTime.Now.Year.ToString(CultureInfo.InvariantCulture) : DropDownList1.SelectedValue) + "年采购金额趋势图"; //设置图表X轴对应项 //绑定数据 Chart1.DataBind(); }
private void Draw() { DataTable table, table2, table3; DataView dView; table = new DataTable(); table2 = new DataTable(); table3 = new DataTable(); DataColumn column; DataRow row; column = new DataColumn(); column.DataType = System.Type.GetType("System.Double"); column.ColumnName = "Częstotliwość"; table.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.Double"); column.ColumnName = "Widmo amplitudowe"; table.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.Double"); column.ColumnName = "Częstotliwość"; table2.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.Double"); column.ColumnName = "Widmo fazowe"; table2.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.Double"); column.ColumnName = "Częstotliwość"; table3.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.Double"); column.ColumnName = "Obwiednia prądu"; table3.Columns.Add(column); column = new DataColumn(); column.DataType = System.Type.GetType("System.Double"); column.ColumnName = "-Obwiednia prądu"; table3.Columns.Add(column); for (int i = 0; i <= fmax - fmin; i++) { row = table.NewRow(); row["Częstotliwość"] = Results[i, 0]; row["Widmo amplitudowe"] = Results[i, 1]; table.Rows.Add(row); } dView = new DataView(table); Chart1.Series.Clear(); Chart1.DataBindTable(dView, "Częstotliwość"); Chart1.Series["Widmo amplitudowe"].ChartType = SeriesChartType.Line; Chart1.ChartAreas[0].AxisX.LabelStyle.Format = "{#0}"; Chart1.Height = 600; Chart1.Width = 1500; Chart1.ChartAreas[0].BackColor = System.Drawing.Color.Azure; Chart1.BackColor = System.Drawing.Color.SeaShell; Chart1.ChartAreas[0].AxisX.LineWidth = 3; Chart1.ChartAreas[0].AxisX.Title = "f [Hz]"; Chart1.ChartAreas[0].AxisY.Title = "ku [dB]"; Chart1.ChartAreas[0].AxisX.TitleFont = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic); Chart1.ChartAreas[0].AxisX.LogarithmBase = 10; Chart1.ChartAreas[0].AxisX.IsLogarithmic = true; Chart1.ChartAreas[0].AxisY.TitleFont = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Bold); Chart1.Titles.Add("Widmo amplitudowe"); Chart1.Titles[0].Font = new System.Drawing.Font("Times New Roman", 16F, System.Drawing.FontStyle.Bold); Chart1.Titles[0].ForeColor = System.Drawing.Color.Black; Chart1.Legends[0].DockedToChartArea = Chart1.ChartAreas[0].Name; Chart1.Legends[0].Docking = Docking.Right; Chart1.ChartAreas[0].AxisX.Minimum = fmin; Chart1.ChartAreas[0].AxisX.Maximum = fmax; for (int i = 0; i <= fmax - fmin; i++) { row = table2.NewRow(); row["Częstotliwość"] = Results[i, 0]; row["Widmo fazowe"] = Results[i, 2]; table2.Rows.Add(row); } dView = new DataView(table2); Chart2.Series.Clear(); Chart2.DataBindTable(dView, "Częstotliwość"); Chart2.Series["Widmo fazowe"].ChartType = SeriesChartType.Line; Chart2.ChartAreas[0].AxisX.LabelStyle.Format = "{#0}"; Chart2.Height = 600; Chart2.Width = 1500; Chart2.ChartAreas[0].BackColor = System.Drawing.Color.Azure; Chart2.BackColor = System.Drawing.Color.SeaShell; Chart2.ChartAreas[0].AxisX.LineWidth = 3; Chart2.ChartAreas[0].AxisX.Title = "f [Hz]"; Chart2.ChartAreas[0].AxisY.Title = "fi [rad]"; Chart2.ChartAreas[0].AxisX.TitleFont = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic); Chart2.ChartAreas[0].AxisX.LogarithmBase = 10; Chart2.ChartAreas[0].AxisX.IsLogarithmic = true; Chart2.ChartAreas[0].AxisY.TitleFont = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Bold); Chart2.Titles.Add("Widmo fazowe"); Chart2.Titles[0].Font = new System.Drawing.Font("Times New Roman", 16F, System.Drawing.FontStyle.Bold); Chart2.Titles[0].ForeColor = System.Drawing.Color.Black; Chart2.Legends[0].DockedToChartArea = Chart2.ChartAreas[0].Name; Chart2.Legends[0].Docking = Docking.Right; Chart2.ChartAreas[0].AxisX.Minimum = fmin; Chart2.ChartAreas[0].AxisX.Maximum = fmax; for (int i = 0; i <= fmax - fmin; i++) { row = table3.NewRow(); row["Częstotliwość"] = Results[i, 0]; row["Obwiednia prądu"] = Results[i, 3]; row["-Obwiednia prądu"] = Results[i, 4]; table3.Rows.Add(row); } dView = new DataView(table3); Chart3.Series.Clear(); Chart3.DataBindTable(dView, "Częstotliwość"); Chart3.Series["Obwiednia prądu"].ChartType = SeriesChartType.Line; Chart3.Series["-Obwiednia prądu"].ChartType = SeriesChartType.Line; Chart3.ChartAreas[0].AxisX.LabelStyle.Format = "{#0}"; Chart3.Height = 600; Chart3.Width = 1500; Chart3.ChartAreas[0].BackColor = System.Drawing.Color.Azure; //Chart3.BackImage = "~/backround2.png"; Chart3.ChartAreas[0].AxisX.LineWidth = 3; Chart3.ChartAreas[0].AxisX.Title = "f [Hz]"; Chart3.ChartAreas[0].AxisY.Title = "I [A]"; Chart3.ChartAreas[0].AxisX.TitleFont = new System.Drawing.Font("Arial", 12F, System.Drawing.FontStyle.Italic); Chart3.ChartAreas[0].AxisX.LogarithmBase = 10; Chart3.ChartAreas[0].AxisX.IsLogarithmic = true; Chart3.ChartAreas[0].AxisY.TitleFont = new System.Drawing.Font("Times New Roman", 12F, System.Drawing.FontStyle.Bold); Chart3.Titles.Add("Obwiednia prądu zasilającego"); Chart3.Titles[0].Font = new System.Drawing.Font("Times New Roman", 16F, System.Drawing.FontStyle.Bold); Chart3.Titles[0].ForeColor = System.Drawing.Color.Black; Chart3.Legends[0].DockedToChartArea = Chart2.ChartAreas[0].Name; Chart3.Legends[0].Docking = Docking.Right; Chart3.ChartAreas[0].AxisX.Minimum = fmin; Chart3.ChartAreas[0].AxisX.Maximum = fmax; }
private void PrintChart() { ds = GetTeamName(Convert.ToInt32(Session["team"])); if (ds.Tables["Team"].Rows.Count > 0) { TeamName = ds.Tables["Team"].Rows[0]["T_TeamName"].ToString(); } BindPieChart1(); Document pdfDoc = new Document(PageSize.A3, 10f, 10f, 10f, 0f); PdfWriter.GetInstance(pdfDoc, Response.OutputStream); pdfDoc.Open(); using (MemoryStream stream = new MemoryStream()) { //iTextSharp.text.Image gif = iTextSharp.text.Image.GetInstance(imagePath); //gif.ScalePercent(24f); //gif.Alignment = iTextSharp.text.Image.ALIGN_RIGHT; Chart1.SaveImage(stream, ChartImageFormat.Png); iTextSharp.text.Image chartImage = iTextSharp.text.Image.GetInstance(stream.GetBuffer()); chartImage.ScalePercent(75f); //pdfDoc.Add(gif); pdfDoc.Add(chartImage); } pdfDoc.Close(); Response.ContentType = "application/pdf"; if (type == "TeamClientsUsage") { Response.AddHeader("content-disposition", "attachment;" + "filename=RTM Client Usage - " + TeamName + ".pdf"); } else if (type == "Tasks") { Response.AddHeader("content-disposition", "attachment;" + "filename=RTM Task Usage - " + TeamName + ".pdf"); } Response.Cache.SetCacheability(HttpCacheability.NoCache); Response.Write(pdfDoc); Response.End(); //Response.ContentType = "application/pdf"; //Response.AddHeader("content-disposition", "inline;filename=TestPage.pdf"); ////Response.AddHeader("content-disposition", "attachment;filename=TestPage.pdf"); //Response.Cache.SetCacheability(HttpCacheability.NoCache); //StringWriter sw = new StringWriter(); //HtmlTextWriter hw = new HtmlTextWriter(sw); //this.Page.RenderControl(hw); //StringReader sr = new StringReader(sw.ToString()); //Document pdfDoc = new Document(PageSize.A4, 10f, 10f, 100f, 0f); //HTMLWorker htmlparser = new HTMLWorker(pdfDoc); //PdfWriter.GetInstance(pdfDoc, Response.OutputStream); //pdfDoc.Open(); ////htmlparser.Parse(sr); //pdfDoc.Close(); //Response.Write(pdfDoc); //Response.End(); }