예제 #1
0
        private void StaticForm_Load(object sender, EventArgs e)
        {
            StudentStatistic statistic = new StudentStatistic();
            int total = statistic.totalStudent();

            totalStudent_lb.Text = total.ToString();

            int female = statistic.femaleAmount();
            int male   = statistic.maleAmount();

            malePercent_lb.Text   = ((male * 100.0) / total).ToString() + "%";
            femalePercent_lb.Text = ((female * 100.0) / total).ToString() + "%";

            var seri = genderChart.Series.Add("genderAmount");

            seri.IsValueShownAsLabel = true;
            seri.ChartType           = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie;
            seri.Points.AddXY("Male", (male * 100.0) / total);
            seri.Points.AddXY("Female", (female * 100.0) / total);
            genderChart.Titles.Add("Gender Chart");
            genderChart.Series.RemoveAt(0);
        }
예제 #2
0
        private void ResultStatisticForm_Load(object sender, EventArgs e)
        {
            Course course = new Course();

            // score_ch
            score_ch.Series.RemoveAt(0);
            var data = course.getAvgScoreByCourse();

            if (data.Rows.Count < 1)
            {
                MessageBox.Show("No score infomation!");
                return;
            }
            score_ch.DataSource = data;
            var seri = score_ch.Series.Add("Average Score");

            seri.XValueMember        = "label";
            seri.YValueMembers       = "AverageGrade";
            seri.IsValueShownAsLabel = true;
            score_ch.Titles.Add("Average Score per Cource Chart");

            //passFail_chart
            Score            score     = new Score();
            StudentStatistic statistic = new StudentStatistic();
            int total = statistic.totalStudent();
            int pass  = score.getPassNumber();
            int fail  = score.getFailNumber();

            passFail_chart.Series.RemoveAt(0);
            seri = passFail_chart.Series.Add("Average Score");
            seri.Points.AddXY("Pass", (pass * 100.0) / total);
            seri.Points.AddXY("Fail", (fail * 100.0) / total);
            seri.IsValueShownAsLabel = true;
            seri.ChartType           = System.Windows.Forms.DataVisualization.Charting.SeriesChartType.Pie;
            passFail_chart.Titles.Add("Pass and fail percent");
        }