private void BuildSubPerVerGraph() { ZedGraph.ZedGraphControl zg1 = new ZedGraph.ZedGraphControl(); zg1.Dock = DockStyle.Fill; zg1.IsEnableZoom = false; zg1.IsShowPointValues = false; ZedGraph.GraphPane pane = zg1.GraphPane; pane.Fill = new ZedGraph.Fill(Color.Azure, Color.FromArgb(230, 220, 250), 90); pane.Chart.Fill = new ZedGraph.Fill(Color.FromArgb(225, 220, 245), Color.LightCyan, -90); pane.Title.Text = "Submission per Verdict"; pane.Title.FontSpec.Size = 18; pane.Title.FontSpec.FontColor = Color.Maroon; pane.Title.FontSpec.Family = "Segoe UI Semibold"; pane.Title.FontSpec.IsBold = false; pane.Legend.IsVisible = false; double[] yval = new double[] { _acCount, _waCount, _tleCount, _reCount, _peCount, _ceCount, _oleCount, _subeCount, _mleCount }; string[] labels = new string[] { "AC", "WA", "TLE", "RE", "PE", "CE", "OLE", "SUBE", "MLE" }; for (int i = 0; i < yval.Length; ++i) { labels[i] += string.Format("\n({0})", yval[i].ToString()); } pane.XAxis.Title.Text = "Verdicts"; pane.XAxis.Title.FontSpec.Family = "Courier New"; pane.XAxis.Title.FontSpec.FontColor = Color.Maroon; pane.XAxis.Title.FontSpec.IsBold = false; pane.XAxis.Scale.TextLabels = labels; pane.XAxis.Type = ZedGraph.AxisType.Text; pane.YAxis.Title.Text = "Submissions"; pane.YAxis.Title.FontSpec.Family = "Courier New"; pane.YAxis.Title.FontSpec.FontColor = Color.Navy; pane.YAxis.Title.FontSpec.IsBold = false; // Generate a bar chart ZedGraph.BarItem bar = pane.AddBar("Verdicts", null, yval, Color.DarkTurquoise); bar.Label.IsVisible = true; pane.AxisChange(); this.subPerVerTab.Controls.Clear(); this.subPerVerTab.Controls.Add(zg1); }
/// <summary> /// Configures and displays the graph for the last-run report. /// </summary> /// <param name="_data">The data table that contains the report data. Only reads two columns.</param> private void ConfigureReportGraph(DataTable _data) { ZedGraph.GraphPane gp = zed_R_Chart.GraphPane; gp.CurveList.Clear(); gp.XAxis.Title.Text = cb_R_GroupBy.Items[cb_R_GroupBy.SelectedIndex].ToString(); gp.YAxis.Title.Text = cb_R_ReportSource.Items[cb_R_ReportSource.SelectedIndex].ToString(); List <string> labels = new List <string>(); List <double> counts = new List <double>(); gp.XAxis.Type = ZedGraph.AxisType.Text; //Loop through each row and add the values to the lists foreach (DataRow dr in _data.Rows) { labels.Add(dr[0].ToString()); counts.Add(Convert.ToDouble(dr[1])); } gp.XAxis.Scale.TextLabels = labels.ToArray(); gp.AddBar(null, null, counts.ToArray(), Color.Red); zed_R_Chart.AxisChange(); zed_R_Chart.Refresh(); }
private void Draw() { if (DataConvertationClass.IsUndefinedElement(_dataAr)) { MessageBox.Show(Text + ". Існують не визначені елементи!"); return; } dataGridView1.ColumnCount = _degree + 2; dataGridView1.RowCount = 2; dataGridView1[0, 0].Value = "Автокореляції"; dataGridView1[0, 1].Value = "ЧАКФ"; double[] ACArray = Statistical.ACF(_dataAr, _degree); double[] PACArray = Statistical.PACF(_dataAr, _degree); double[] XList = new double[_degree + 1]; for (int i = 1; i < dataGridView1.ColumnCount; i++) { dataGridView1.Columns[i].Name = (i - 1).ToString(); dataGridView1[i, 0].Value = ACArray[i - 1].ToString("F6"); if (Math.Abs(ACArray[i - 1]) >= level) { dataGridView1[i, 0].Style.ForeColor = Color.Red; } else { dataGridView1[i, 0].Style.ForeColor = Color.Black; } dataGridView1[i, 1].Value = PACArray[i - 1].ToString("F6"); if (Math.Abs(PACArray[i - 1]) >= level) { dataGridView1[i, 1].Style.ForeColor = Color.Red; } else { dataGridView1[i, 1].Style.ForeColor = Color.Black; } XList[i - 1] = i - 1; } dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; ZedGraph.LineObj levelLine1 = new ZedGraph.LineObj(Color.Red, -1, level, _degree + 1, level); levelLine1.Line.Width = 2; ZedGraph.LineObj levelLine2 = new ZedGraph.LineObj(Color.Red, -1, -level, _degree + 1, -level); levelLine2.Line.Width = 2; ZedGraph.GraphPane ACpane = ACzedGraphControl.GraphPane; ACpane.CurveList.Clear(); ACpane.GraphObjList.Clear(); ACpane.Title.Text = "Автокореляція"; ACpane.XAxis.Title.IsVisible = false; ACpane.XAxis.MajorGrid.IsVisible = true; ACpane.XAxis.MajorGrid.DashOn = 1; ACpane.XAxis.MajorGrid.DashOff = 1; ACpane.XAxis.Scale.Min = 0; ACpane.XAxis.Scale.Max = ACArray.Length; ACpane.YAxis.Title.IsVisible = false; ACpane.YAxis.MajorGrid.IsVisible = true; ACpane.YAxis.MajorGrid.DashOn = 1; ACpane.YAxis.MajorGrid.DashOff = 1; ACpane.YAxis.Scale.Min = -2; ACpane.YAxis.Scale.Max = 2; ZedGraph.PointPairList ACList = new ZedGraph.PointPairList(XList, ACArray); ACpane.AddBar("", ACList, Color.BlanchedAlmond); ACpane.GraphObjList.Add(levelLine1); ACpane.GraphObjList.Add(levelLine2); ACzedGraphControl.Refresh(); ZedGraph.GraphPane PACpane = PACzedGraphControl.GraphPane; PACpane.CurveList.Clear(); PACpane.GraphObjList.Clear(); PACpane.Title.Text = "ЧАКФ"; PACpane.XAxis.Title.IsVisible = false; PACpane.XAxis.MajorGrid.IsVisible = true; PACpane.XAxis.MajorGrid.DashOn = 1; PACpane.XAxis.MajorGrid.DashOff = 1; PACpane.XAxis.Scale.Min = 0; PACpane.XAxis.Scale.Max = ACArray.Length; PACpane.YAxis.Title.IsVisible = false; PACpane.YAxis.MajorGrid.IsVisible = true; PACpane.YAxis.MajorGrid.DashOn = 1; PACpane.YAxis.MajorGrid.DashOff = 1; PACpane.YAxis.Scale.Min = -2; PACpane.YAxis.Scale.Max = 2; ZedGraph.PointPairList PACList = new ZedGraph.PointPairList(XList, PACArray); PACpane.AddBar("", PACList, Color.BlanchedAlmond); PACpane.GraphObjList.Add(levelLine1); PACpane.GraphObjList.Add(levelLine2); PACzedGraphControl.Refresh(); }
private void btnMonthEffort_Click(object sender, EventArgs e) { string mes = dTP.Value.Month.ToString(); List <string> _tasks = new List <string>(); List <double> _times = new List <double>(); foreach (DataTable tbl in PBData.Tables) { //checks if month is in selected day string[] s = tbl.TableName.Split(':'); if (s.Length > 1) { s = s[1].Split('-'); } if (s.Length > 1 && s[1] == mes) { //adds each task foreach (DataRow r in tbl.Rows) { //position int i = _tasks.IndexOf(r["colTask"].ToString()); if (i < 0) { i = _tasks.Count; _tasks.Add(r["colTask"].ToString()); _times.Add(0); } //time count _times[i] += (double)((int)r["colElapTimeInSeconds"]); } } } Random rnd = new Random(); //zedGraph Pie Chart DataTable t = GetDateTbl(); frmChart frmBar = new frmChart(); frmBar.itemsMenu.Visible = false; ZedGraph.GraphPane Pane = frmBar.zedGraph.GraphPane; //Titulos frmBar.Text = btnMonthEffort.Text + ": " + lblMonth.Text + " " + System.Globalization.CultureInfo.CurrentCulture.DateTimeFormat.MonthNames[dTP.Value.Month - 1] + "/" + dTP.Value.Year.ToString(); Pane.Title.Text = frmBar.Text; Pane.Title.FontSpec.Size = 24f; //Pane.Title.FontSpec.IsItalic = true; Pane.Fill = new ZedGraph.Fill(Color.White, Color.LightYellow, 45f); Pane.Chart.Fill.Type = ZedGraph.FillType.None; //fonte da legenda Pane.Legend.FontSpec.Size = 11f; Pane.BarSettings.Base = ZedGraph.BarBase.Y; //Bars double[] yy = new double[_tasks.Count]; double[] xx = new double[_tasks.Count]; for (int j = 0; j < _tasks.Count; j++) { yy[j] = (double)(j + 1); xx[j] = Math.Round(_times[j] / 3600, 2); } Color cor = Color.FromArgb(rnd.Next(240), rnd.Next(240), rnd.Next(240)); ZedGraph.BarItem p = Pane.AddBar("", xx, yy, Color.White); p.Bar.Fill = new ZedGraph.Fill(cor, Color.White, cor); Pane.YAxis.Scale.TextLabels = _tasks.ToArray(); Pane.YAxis.Type = ZedGraph.AxisType.Text; Pane.YAxis.MajorTic.IsBetweenLabels = true; Pane.XAxis.Title.Text = lblTotalTH.Text; Pane.YAxis.Title.Text = lblTask.Text; frmBar.zedGraph.AxisChange(); frmBar.Show(); }