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]Property Grid
  [Expand]Pivot Grid
  [Expand]Tree List
  [Collapse]Chart Control
   [Expand]Getting Started
   [Expand]Fundamentals
   [Collapse]Providing Data
    [Collapse]Providing Data
      Create a Series Manually
      Manually Add Points to a Series
      Specify Series Data Members
      Generate Series from a Data Source
      Integration with a Data Grid, Vertical Grid, Tree List or List Box via ControlRowSource
      Pivot Charting (Integration with a Pivot Grid Control)
      Series Customization
      Series Scale Types
      Series Point Colorizer
      Series Colorizer
    [Expand]Data Representation
   [Expand]Appearance Customization
   [Expand]End-User Features
   [Expand]Design-Time Features
   [Expand]Visual Elements
   [Expand]Examples
   [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]ASP.NET Core Bootstrap Controls
[Expand]WPF Controls
[Expand]Xamarin Controls
[Expand]Windows 10 App Controls
[Expand]Office File API
[Expand]Reporting
[Expand]Report and Dashboard Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Generate Series from a Data Source

The Chart Control can automatically generate series from the chart's data source using the Series Template. This approach is an alternative of manual series creation.

This document consists of the following sections explaining:

Expanded How to Configure the Series Template at Design-Time

The Chart Control allows you to configure the series template at design time in the following ways.

Note

Before beginning series template configuration, you must assign a data source to the Chart Control. This allows Visual Studio to populate data member editors with data source field names.

  • Using the Chart Designer

    Select the Chart Control, click its smart tag and then click Run Designer... in the invoked menu.

    Select the chart in the designer's structure tree. Switch to the Data tab and drag the data members to the data member fields to assign data source members to the series template's series, argument and values data members. The series template uses the series data member values to generate series, and uses the argument and values data members to fill generated series with data points.

  • Using the Properties window

    Locate the ChartControl.SeriesTemplate property in the Properties window and expand it. Find the template's SeriesTemplate.SeriesDataMember property and specify which data member values should be used as series identifiers.

    Then, assign the data fields whose values should specify point arguments and values to the SeriesBase.ArgumentDataMember and SeriesBase.ValueDataMembers properties.

    Important

    The number of value data members that should be assigned to a series depends on the series template's view. Several view types require more than one data member that provides values. For example, the Bubble series view requires two data members - one provides series point values and the other - series point weights.

A series template stores settings and elements that are used to initialize all automatically-created chart series. The Chart Control provides the ChartControl.BoundDataChanged to customize each generated series individually. Refer to the Obtain and Customize an Auto-Created Series topic section for more information.

Expanded How to Configure the Series Template at Runtime

The following is an example of how to configure the chart's series template at runtime.

The above-mentioned code uses the following classes and properties.

Symbol Description
ChartControl.SeriesTemplate Returns the series template the chart uses to generate its series.
SeriesTemplate The series template that the chart uses to generate its series.
SeriesTemplate.SeriesDataMember Gets or sets the name of the data member whose values identify series.
SeriesBase.ArgumentDataMember Gets or sets the name of the data field that contains series point arguments.
SeriesBase.ValueDataMembers Gets a collection of the names of data fields that contain series point values.

A series template stores settings and elements that are used to initialize all automatically-created chart series. The Chart Control provides the ChartControl.BoundDataChanged to customize each generated series individually. Refer to the Obtain and Customize an Auto-Created Series topic section for more information.

Expanded How to Obtain and Customize an Auto-Created Series

The series template configures the automatically generated series' appearance and behavior using the same settings as an individual Series. All the template customizations affect the automatically generated series. Use the ChartControl.BoundDataChanged event to configure each generated series individually.

In addition to the default series template settings, the Chart Control provides the SeriesNameTemplate property. This property customizes automatically generated series names using a prefix and postfix.

The Chart Control can sort automatically generated series by name using the ChartControl.SeriesSorting property that specifies the series sort order. Refer to Sorting Data topic for more information.

Important

The series name template does not effect the names of the series that are added manually.

Expanded See Also

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