回复 3楼iamzhaiwei的帖子
这段代码是用于区域报表内设置 Chart 数据源,可以在 section Format 事件中调用:
- // create the series
- DataDynamics.ActiveReports.Chart.Series s = new DataDynamics.ActiveReports.Chart.Series();
- string m_cnnString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Northwind.mdb;Persist Security Info=False";
- System.Data.OleDb.OleDbConnection m_cnn = new System.Data.OleDb.OleDbConnection(m_cnnString);
- System.Data.OleDb.OleDbDataAdapter oDBAdapter;
-
- // create the dataset
- System.Data.DataSet oDS;
- oDBAdapter = new System.Data.OleDb.OleDbDataAdapter("SELECT ShipCountry, SUM(Freight) AS Expr1 FROM Orders GROUP BY ShipCountry", m_cnnString);
- oDS = new System.Data.DataSet();
- oDBAdapter.Fill(oDS, "Expr1");
-
- // set the DataSource and ValueMembersY properties
- this.chartControl1.DataSource = oDS;
- s.ValueMembersY = "Expr1";
-
- this.chartControl1.Series.Add(s);
复制代码
你先尝试下,如果有问题可以继续提出来。 |