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); }
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(); }