Log In
Home
Support
Demos
Documentation
Blogs
Training
Webinars
[Expand]General Information
[Collapse]WinForms Controls
  Prerequisites
 [Expand]What's Installed
 [Expand]Build an Application
 [Collapse]Controls and Libraries
  [Expand]Forms and User Controls
  [Expand]Messages, Notifications and Dialogs
  [Expand]Editors and Simple Controls
  [Expand]Ribbon, Bars and Menu
  [Expand]Application UI Manager
  [Expand]Docking Library
  [Expand]Data Grid
  [Expand]Vertical Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Collapse]Chart Control
   [Expand]Getting Started
   [Expand]Fundamentals
   [Expand]Providing Data
   [Expand]Appearance Customization
   [Expand]End-User Features
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Collapse]Examples
    [Expand]General
    [Collapse]Creating Charts
     [Collapse]Providing Data
       How to: Bind Individual Chart Series to Data
       How to: Bind Individual Chart Series to Data (Runtime Sample)
       How to: Bind a Chart to Data Using Series Templates
       How to: Bind a Chart to Data Using Series Templates (Runtime Sample)
       How to: Individually Change the View Type of Automatically Created Series
       How to: Change Colors of Automatically Created Series
       How to: Bind Series to Data and Display Them In Separate Panes (Runtime Sample)
       How to: Bind a Chart to an MDB Database (Runtime Sample)
       How to: Bind a Chart to an Array List
       How to: Bind a Chart to an XML Data Source
       How to: Bind a Chart to an XPO Data Source
       How to: Link a Chart to the PivotGridControl's Data Source
       How to: Colorize Charts Using the Color Object Colorizer
       How to: Colorize Charts Using the Key-Color Colorizer
       How to: Colorize Charts Using the Range Colorizer
     [Expand]Data Representation
     [Expand]Appearance Customization
     [Expand]Series Views
    [Expand]Chart Elements
    [Expand]End-User Interaction
    [Expand]Producing Output
   [Expand]Additional Resources
  [Expand]Diagrams
  [Expand]Gauges
  [Expand]Map Control
  [Expand]Scheduler
  [Expand]Spreadsheet
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]Printing-Exporting
  [Expand]PDF Viewer
   Reporting
  [Expand]Snap
  [Expand]TreeMap Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

How to: Bind a Chart to an Array List

This tutorial demonstrates how to bind a chart to data represented in an System.Collections.ArrayList object

Show Me

A complete sample project is available in the DevExpress Code Examples database at http://www.devexpress.com/example=E2080.

To bind a chart to an array list, do the following.

  1. Start MS Visual Studio (2008 or 2010), and create a new Windows Forms Application, or open an existing one.

  2. Add a chart to the form.

  3. Declare a class that represents an individual record. The code below declares a class with the ID, Name and Age public properties. These properties will be data source fields.
  4. Once the record class has been declared, the data source object can be filled with records. This example will use an System.Collections.ArrayList as the report's data source. So, there is no need to create a custom object implementing the IList, ITypedList or IBindingList interfaces.

    The code below fills the System.Collections.ArrayList with records and assigns it to the chart's ChartControl.DataSource property. Then, you can adjust the SeriesBase.ArgumentDataMember and SeriesBase.ValueDataMembers properties of the chart's series.

Now, the chart has been bound to data. Run the application, and view the result.

Expanded See Also

How would you rate this topic?​​​​​​​