DevExpress+Winform(六 完结)

视频:https://www.bilibili.com/video/BV15x411x7WN?p=7

ChartControl图表控件的运用。

 

 选择一种图表类型,先不考虑各种图表的叠加。

 

 绑定数据,设置横坐标和纵坐标。

   private void XtraForm1_Load(object sender, EventArgs e)
   {
       Series series = this.chartControl1.Series[0];
       DataTable table = new DataTable();
       table.Columns.Add("Class");
       table.Columns.Add("TotalGrade",typeof(double));
       var row = table.NewRow();
       row["Class"] = "一班";
       row["TotalGrade"] = 5190;
       table.Rows.Add(row);
       var row1 = table.NewRow();
       row1["Class"] = "二班";
       row1["TotalGrade"] = 3776;
       table.Rows.Add(row1);

       series.DataSource = table;
       // 设置横坐标
       series.ArgumentDataMember = "Class"; 
       // 设置纵坐标
       series.ValueDataMembers[0] = "TotalGrade";
      
   }

 

posted @ 2020-05-12 10:33  舒碧  阅读(394)  评论(0编辑  收藏