示例#1
0
        public void ChartData()
        {
            lnChart.Series.Add("Student State");
            lnChart.Series["Student State"].ChartType = SeriesChartType.Line;
            //stChart.Series["Student State"].Points.AddXY(0,0);
            lnChart.Series["Student State"].ToolTip = "#VALX : #VALY";

            if (File.Exists(MainWindow.FilePath))
            {
                using (StreamReader reader = new StreamReader(MainWindow.FilePath))
                {
                    string             json       = reader.ReadToEnd();
                    List <StudentProp> readObject = JsonConvert.DeserializeObject <List <StudentProp> >(json);
                    foreach (StudentProp pr in readObject)
                    {
                        lnChart.Series["Student State"].SmartLabelStyle.Enabled = true;
                        if (!StudentState.GetState(pr))
                        {
                            lnChart.Series["Student State"].Color = Color.Green;
                        }
                        else
                        {
                            lnChart.Series["Student State"].Color = Color.Red;
                        }
                        lnChart.Series["Student State"].Points.AddXY(pr.Name, pr.Subjects.Total);
                    }
                }
            }
        }
示例#2
0
        public void ChartData()
        {
            stChart.Series.Add("Student State");
            stChart.Series["Student State"].ChartType = SeriesChartType.Pie;
            //stChart.Series["Student State"].Points.AddXY(0,0);
            stChart.Series["Student State"].ToolTip = "#VALX : #VALY";

            if (File.Exists(MainWindow.FilePath))
            {
                using (StreamReader reader = new StreamReader(MainWindow.FilePath))
                {
                    int                pass       = 0;
                    int                fail       = 0;
                    string             json       = reader.ReadToEnd();
                    List <StudentProp> readObject = JsonConvert.DeserializeObject <List <StudentProp> >(json);
                    foreach (StudentProp pr in readObject)
                    {
                        if (!StudentState.GetState(pr))
                        {
                            pass++;
                        }
                        else
                        {
                            fail++;
                        }
                    }
                    if (pass != 0)
                    {
                        stChart.Series["Student State"].Points.AddXY("Pass : "******"Student State"].Points.AddXY("Fail : " + fail, fail);
                    }
                }
            }
        }