Back to Devexpress

How to: Bind a Chart to an Array List

windowsforms-7787-controls-and-libraries-chart-control-examples-creating-charts-providing-data-how-to-bind-a-chart-to-an-array-list.md

latest1.5 KB
Original Source

How to: Bind a Chart to an Array List

  • Jan 15, 2024
  • 3 minutes to read

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

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

  1. Start Microsoft Visual Studio, 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 ArrayList as the report’s data source. So, there is no need to create a custom object implementing the IList , ITypedList or IBindingList interfaces.

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

See Also

How to: Bind a Chart to Data Using Series Templates (Runtime Sample)