Example #1
0
        private void PopulateChart()
        {


            List<Commiter> Commiters = new List<Commiter>();
            foreach (GridViewRow Row in GridView.Rows)
            {
                string Author = Row.Cells[1].Text;
                Commiter Commiter = Commiters.Find(delegate (Commiter C) { return C.Author == Author; });
                if (Commiter == null)
                {
                    Commiter = new Commiter() { Author = Author };
                    Commiters.Add(Commiter);
                }
                if (Row.Cells[5].Text.Contains("Pass"))
                    Commiter.NumPasses++;
                else
                    Commiter.NumFailures++;
                Commiter.NumPatches++;
            }
            foreach (Commiter Commiter in Commiters)
            {
                int TotalCommits = Commiter.NumPasses + Commiter.NumFailures;
                if (TotalCommits > 0)
                    Commiter.PercentagePass = Convert.ToDouble(Commiter.NumPasses) / TotalCommits * 100;
            }

            DataTable GoodCommiterData = new DataTable();
            GoodCommiterData.Columns.Add("Author", typeof(string));
            GoodCommiterData.Columns.Add("NumPasses", typeof(int));
            GoodCommiterData.Columns.Add("NumFailures", typeof(int));
            GoodCommiterData.Columns.Add("PercentagePass", typeof(int));
            FillDataTable(Commiters.OrderByDescending(Commiter => Commiter.NumPatches),
                          GoodCommiterData);

            DataTable BadCommiterData = new DataTable();
            BadCommiterData.Columns.Add("Author", typeof(string));
            BadCommiterData.Columns.Add("NumPasses", typeof(int));
            BadCommiterData.Columns.Add("NumFailures", typeof(int));
            BadCommiterData.Columns.Add("PercentagePass", typeof(int));
            FillDataTable(Commiters.OrderByDescending(Commiter => Commiter.PercentagePass),
                          BadCommiterData,
                          AddNumPatchesToAuthor: true, MinNumPatches: 10);

            Chart1.DataSource = GoodCommiterData;
            Chart1.Series[0].XValueMember = "Author";
            Chart1.Series[0].YValueMembers = "NumFailures";
            Chart1.Series[1].XValueMember = "Author";
            Chart1.Series[1].YValueMembers = "NumPasses";

            Chart2.DataSource = BadCommiterData;
            Chart2.Series[0].XValueMember = "Author";
            Chart2.Series[0].YValueMembers = "PercentagePass";
        }
Example #2
0
        private void PopulateChart()
        {
            List <Commiter> Commiters = new List <Commiter>();

            foreach (GridViewRow Row in GridView.Rows)
            {
                string   Author   = Row.Cells[0].Text;
                Commiter Commiter = Commiters.Find(delegate(Commiter C) { return(C.Author == Author); });
                if (Commiter == null)
                {
                    Commiter = new Commiter()
                    {
                        Author = Author
                    };
                    Commiters.Add(Commiter);
                }
                if (Row.Cells[4].Text.Contains("Pass"))
                {
                    Commiter.NumPasses++;
                }
                else
                {
                    Commiter.NumFailures++;
                }
                Commiter.NumPatches++;
            }
            foreach (Commiter Commiter in Commiters)
            {
                int TotalCommits = Commiter.NumPasses + Commiter.NumFailures;
                if (TotalCommits > 0)
                {
                    Commiter.PercentagePass = Convert.ToDouble(Commiter.NumPasses) / TotalCommits * 100;
                }
            }

            DataTable GoodCommiterData = new DataTable();

            GoodCommiterData.Columns.Add("Author", typeof(string));
            GoodCommiterData.Columns.Add("NumPasses", typeof(int));
            GoodCommiterData.Columns.Add("NumFailures", typeof(int));
            GoodCommiterData.Columns.Add("PercentagePass", typeof(int));
            FillDataTable(Commiters.OrderByDescending(Commiter => Commiter.NumPatches),
                          GoodCommiterData);

            DataTable BadCommiterData = new DataTable();

            BadCommiterData.Columns.Add("Author", typeof(string));
            BadCommiterData.Columns.Add("NumPasses", typeof(int));
            BadCommiterData.Columns.Add("NumFailures", typeof(int));
            BadCommiterData.Columns.Add("PercentagePass", typeof(int));
            FillDataTable(Commiters.OrderByDescending(Commiter => Commiter.PercentagePass),
                          BadCommiterData,
                          AddNumPatchesToAuthor: true, MinNumPatches: 10);

            Chart1.DataSource              = GoodCommiterData;
            Chart1.Series[0].XValueMember  = "Author";
            Chart1.Series[0].YValueMembers = "NumFailures";
            Chart1.Series[1].XValueMember  = "Author";
            Chart1.Series[1].YValueMembers = "NumPasses";

            Chart2.DataSource              = BadCommiterData;
            Chart2.Series[0].XValueMember  = "Author";
            Chart2.Series[0].YValueMembers = "PercentagePass";
        }
Example #3
0
 /// <summary>
 ///
 /// </summary>
 /// <returns></returns>
 public override int GetHashCode()
 {
     unchecked {
         return(((Commiter != null ? Commiter.GetHashCode() : 0) * 397) ^ Time.GetHashCode());
     }
 }