Download ActiveReports 6 User Guide
Transcript
ActiveReports 6 User Guide | 136
Chart Data
Bound Data
The Chart control has its own data source which is distinct from the report data source. To access the chart's
data source, click the Data Source verb which appears below the Properties window when the chart is
selected on the report. If the Data Source verb does not appear, see Access the Chart Wizard and Data
Source for help.
Unbound Data
The Chart control allows you to set the data source for a chart control, series, or data points collection at run
time.
Any of the following objects can be used as data sources:
Dataset
Dataset Column
Data Table
SqlCommand/OleDbCommand
SqlDataAdapter/OleDbDataAdapter
Array
XML data
Below are some examples of binding to different data sources at run time.
Dataset
The Chart control's DataSource property can be set to a dataset at run time. The following code demonstrates
how to set up a dataset, set the DataSource property to the dataset, create a series, and set the
ValueMembersY property to the dataset expression at run time.
1.
2.
In design view of the report, double-click the section where you placed your chart. This creates a Format
event handling method for the section.
Add code to the handler to create a data source and bind a series to a dataset expression.
To write the code in Visual Basic.NET
Visual Basic.NET code. Paste INSIDE the section Format event.
' create the series
Dim s As New DataDynamics.ActiveReports.Chart.Series
Dim m_cnnString As String = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:/Northwind.mdb; Persist Secu
Dim m_cnn As New System.Data.OleDb.OleDbConnection(m_cnnString)
Dim oDBAdapter As System.Data.OleDb.OleDbDataAdapter
' create the dataset
Dim oDS As DataSet
oDBAdapter = New System.Data.OleDb.OleDbDataAdapter("SELECT ShipCountry, SUM(Freight) AS Expr1 FROM Orde
oDS = New DataSet
oDBAdapter.Fill(oDS, "Expr1")
' set the DataSource and ValueMembersY properties
Me.ChartControl1.DataSource = oDS
s.ValueMembersY = "Expr1"
Me.ChartControl1.Series.Add(s)
To write the code in C#
C# code. Paste INSIDE the section Format event.
// 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 Inf
System.Data.OleDb.OleDbConnection m_cnn = new System.Data.OleDb.OleDbConnection(m_cnnString);
Related documents
ActiveReports 7 User Guide
Warranty - Advanced Test Equipment Rentals
CK30 Handheld Computer User's Manual
l6.2.5 Programmstart und Audio-Alarm
CMSi Admin Manual - Conservation Management System
Contract Management Tracking Software
CuteReport User Manual - The UK Mirror Service
MAPublisher 8.0 User Guide
Pyramid TimeTrax Mobile Time System User Manual
602LAN SUITE 2004 Manual
Product Manual - Time Clock Experts