Back to Devexpress

ChartControl.SeriesTemplate Property

windowsforms-devexpress-dot-xtracharts-dot-chartcontrol-446fb450.md

latest6.6 KB
Original Source

ChartControl.SeriesTemplate Property

Returns the series template the chart uses to generate its series.

Namespace : DevExpress.XtraCharts

Assembly : DevExpress.XtraCharts.v25.2.UI.dll

NuGet Package : DevExpress.Win.Charts

Declaration

csharp
public SeriesTemplate SeriesTemplate { get; }
vb
Public ReadOnly Property SeriesTemplate As SeriesTemplate

Property Value

TypeDescription
SeriesTemplate

The series template the chart uses to generate its series.

|

Remarks

Refer to the Generate Series from a Data Source topic for more information about design time template configuration.

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");
' ...

The following code snippets (auto-collected from DevExpress Examples) contain references to the SeriesTemplate property.

Note

The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

winforms-visualize-data-grid-rows-in-a-chart/CS/ControlRowSourceSample/MainForm.cs#L26

csharp
SeriesBase seriesTemplate = chartControl.SeriesTemplate;
seriesTemplate.ArgumentDataMember = "Category";

winforms-charts-sort-stacked-bars-by-total-values-with-qualitativescalecomparer/CS/Form1.cs#L17

csharp
chartControl1.SeriesDataMember = "Series";
SeriesTemplate seriesTemplate = chartControl1.SeriesTemplate;
seriesTemplate.ArgumentDataMember = "Argument";

winforms-charts-configure-settings-for-template-series-and-series-added-manually/CS/series-base-example/Form1.cs#L22

csharp
chart.SeriesTemplate.View = new LineSeriesView();
ConfigureSeries(chart.SeriesTemplate);

winforms-visualize-data-grid-rows-in-a-chart/VB/ControlRowSourceSample/MainForm.vb#L24

vb
chartControl.SeriesDataMember = "State"
Dim seriesTemplate As SeriesBase = chartControl.SeriesTemplate
seriesTemplate.ArgumentDataMember = "Category"

winforms-charts-sort-stacked-bars-by-total-values-with-qualitativescalecomparer/VB/Form1.vb#L18

vb
chartControl1.SeriesDataMember = "Series"
Dim seriesTemplate As SeriesTemplate = chartControl1.SeriesTemplate
seriesTemplate.ArgumentDataMember = "Argument"

winforms-charts-configure-settings-for-template-series-and-series-added-manually/VB/series-base-example/Form1.vb#L24

vb
chart.SeriesTemplate.View = New LineSeriesView()
ConfigureSeries(chart.SeriesTemplate)
' Add a single series.

See Also

ChartControl Class

ChartControl Members

DevExpress.XtraCharts Namespace