[Expand]General Information
[Collapse]WinForms Controls
  .NET Core Support
 [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]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Expand]Gantt Control
  [Collapse]Chart Control
   [Expand]Getting Started
   [Expand]Charting Basics
   [Expand]Series Views
   [Expand]Chart Elements
   [Expand]Providing Data
   [Expand]Data Representation
   [Expand]Appearance Customization
   [Expand]End-User Features
   [Expand]Design-Time Features
   [Expand]Visual Elements
    [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]Map Control
  [Expand]Rich Text Editor
  [Expand]Spell Checker
  [Expand]Form Layout Managers
  [Expand]Navigation Controls
  [Expand]PDF Viewer
  [Expand]TreeMap Control
  [Expand]Sunburst Control
 [Expand]Common Features
  Get More Help
 [Expand]API Reference
[Expand]ASP.NET Controls and MVC Extensions
[Expand]ASP.NET Bootstrap Controls
[Expand]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Report and Dashboard Server
[Expand]eXpressApp Framework
[Expand]eXpress Persistent Objects
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation
View this topic on docs.devexpress.com (Learn more)

How to: Bind a Chart to an XPO Data Source

This tutorial demonstrates how a chart can be bound to an eXpress Persistent Objects (XPO) data source. XPO is a DevExpress technology that gives you the freedom to build true business objects without having to deal with the tedious complexities of mapping them onto database tables. eXpress Persistent Objects for .NET completely abstracts the database layer from the developer, leaving him or her fully in the object-oriented realm. With XPO, you can build applications that are compatible with multiple database systems (currently supported are: MS Access, MS SQL Server, MySQL, Oracle, PostgreSql, Firebird, PervasiveSQL, VistaDB, SQL Anywhere, Advantage, DB2 and Sybase) without making ANY changes to your code. For more information, refer to eXpress Persistent Objects.

To bind a chart to an XPO data source, 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. From the DX.19.2: Data toolbox tab, drop the XPCollection component onto the form.

  4. Now, switch from the design view of the form to its code, and declare the XPObject class descendant. For example, use the following code.

  5. To populate the data source, handle the Form1_Load event using the following code.

  6. Rebuild the application so that this object can be used for the XPCollection.
  7. Set the ObjectClassInfo property of the XPCollection object to the SeriesRecord object.

  8. Now, set the ChartControl.DataSource property to this XPCollection object.

    And, define where the chart's series should obtain data for its points' arguments and their values, set the SeriesBase.ArgumentDataMember property to Argument, and the SeriesBase.ValueDataMembers property to Value.

The chart is now bound to the XPO data source, and the result is shown in the following image.


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

Is this topic helpful?​​​​​​​