Back to Devexpress

SeriesTemplate Class

corelibraries-devexpress-dot-xtracharts-695f62b4.md

latest5.7 KB
Original Source

SeriesTemplate Class

The series template that the chart uses to generate its series.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.dll

NuGet Package : DevExpress.Charts

Declaration

csharp
public class SeriesTemplate :
    SeriesBase,
    ISeriesFactory,
    ISeriesPointFactory,
    ISeriesTemplate
vb
Public Class SeriesTemplate
    Inherits SeriesBase
    Implements ISeriesFactory,
               ISeriesPointFactory,
               ISeriesTemplate

The following members return SeriesTemplate objects:

LibraryRelated API Members
Cross-Platform Class LibraryBreadcrumbItem.Template
SeriesTemplate.ArgumentDrillTemplate
SeriesTemplate.SeriesDrillTemplate
SeriesTemplate.SeriesPointDrillTemplate
WinForms ControlsChartControl.SeriesTemplate
ASP.NET MVC ExtensionsChartControlSettings.SeriesTemplate
ASP.NET Web Forms ControlsWebChartControl.SeriesTemplate
.NET Reporting ToolsXRChart.SeriesTemplate

Remarks

The example uses the following classes and members:

|

Symbol

|

Description

| | --- | --- | |

ChartControl.SeriesTemplate for WinForms,

WebChartControl.SeriesTemplate for ASP.NET WebForms,

ChartControlSettings.SeriesTemplate for ASP.NET MVC

|

Returns the series template 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.

|

Example

The following code demonstrates how to automatically generate series and fill them with data from a data source. It uses the classes and properties below:

SymbolDescription
ChartControl.SeriesTemplateReturns the series template the chart uses to generate its series.
SeriesTemplateThe series template that the chart uses to generate its series.
SeriesTemplate.SeriesDataMemberGets or sets the name of the data member whose values identify series.
SeriesBase.ArgumentDataMemberGets or sets the name of the data field that contains series point arguments.
SeriesBase.ValueDataMembersGets a collection of the names of data fields that contain series point values.
csharp
class GdpInfo {
    public int Year { get; set; }
    public String Region { get; set; }
    public double Value { get; set; }
}

// ...
// Note that the GetGdpDataSource method is not a part of the Chart Control API.
// This method provides a data object list that the Chart should display.
List<GdpInfo> gdpDataSource = GetGdpDataSource();
chartControl.DataSource = gdpDataSource;
chartControl.SeriesTemplate.SeriesDataMember = "Year";
chartControl.SeriesTemplate.ArgumentDataMember = "Region";
chartControl.SeriesTemplate.ValueDataMembers.AddRange("Value");
// ...
vb
Class GdpInfo
    Public Property Year As Integer
    Public Property Region As String 
    Public Property Value As Double
End Class

' ...
' Note that the GetGdpDataSource method is not a part of the Chart Control API.
' This method provides a data object list that the Chart should display.
Dim gdpDataSource As List(Of GdpInfo) = GetGdpDataSource()
chartControl.DataSource = gdpDataSource;
chartControl.SeriesTemplate.SeriesDataMember = "Year";
chartControl.SeriesTemplate.ArgumentDataMember = "Region";
chartControl.SeriesTemplate.ValueDataMembers.AddRange("Value");
' ...

Implements

IXtraSupportDeserializeCollectionItem

Inheritance

Object ChartElement SeriesBase SeriesTemplate

See Also

SeriesTemplate Members

DevExpress.XtraCharts Namespace