You can also load data to your PopChart Web Server Control directly from a database.
Your PopChart can be bound to any dataSet, dataTable, or dataView object in your web form. For instructions on creating a data set, data table, and/or data view, you should refer to your Visual Studio .NET documentation.
You connect the PopChart Web Server Control to data the same way that you connect a Data Grid web server control to data (the web server control actually derives from System.Web.UI.WebControls.DataGrid). Search your .NET documentation for instructions on using the DataGrid object if the following instructions are insufficient.
After setting up your data, you will need to modify your PopChart's DataSource property (in the Data group). Select the appropriate data object from the DataSource pull-down menu.
Once you've selected a DataSource for your PopChart Web Server Control, be sure to fill in the dataSet and bind the dataSet to your web control. You can do this by calling the Fill method on your data adapter object, and then calling the DataBind method on your PopChart web server control. This will all need to be done in your ASP.NET page's class file.
So, for example, if your data adapter were named OleDbDataAdapter, your data set named DataSet1, and your PopChart web server control named PopChart1, you would need to add the following code under the Page_Load section in the class file:
Example B.3 Filling in the Data Set and Binding the Data
private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here
Experienced programmers might find it easier to simply code in their data source. The following example code shows one way you could load data into your PopChart using C# code. It assumes your PopChart web server control has been named PopChart1 (the default name). All of the code is placed inside of the Page_Load method for your web form.