Skip to main content
All docs
V24.2

SeriesTemplateSummaryAdapter.TimeSpanSummaryOptions Property

Returns options that configure how the series calculates summary values of a data source with TimeSpan arguments.

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.2.dll

Declaration

[PersistenceMode(PersistenceMode.InnerProperty)]
[XtraChartsLocalizableCategory(XtraChartsCategory.Data)]
public TimeSpanSummaryOptions TimeSpanSummaryOptions { get; }

Property Value

Type Description
TimeSpanSummaryOptions

Stores summarization settings for a chart with TimeSpan arguments.

Remarks

The TimeSpanSummaryOptions include the SummaryFunction property. This property defines a function used to summarize series values.

Example

The following example shows how to create multiple series based on a template and aggregate their points with equal arguments:

using DevExpress.XtraCharts;
using System;
using System.Collections.Generic;
using System.Windows.Forms;

namespace SummaryChart {
    public partial class Form1 : Form {

        private void OnLoad(object sender, EventArgs e) {

            // Specify the chart data source.
            chart.DataSource = DataPoint.GetDataPoints();

            //Create a summary data adapter.
            SeriesTemplateSummaryAdapter dataAdapter = new SeriesTemplateSummaryAdapter();

            // Create a data member that defines arguments.
            dataAdapter.DataMembers.Add(new DataMember {
                DataMemberType = ChartDataMemberType.Argument,
                ColumnName = "Argument",
                ScaleType = ScaleType.TimeSpan
            });
            // Create a data member that defines values.
            dataAdapter.DataMembers.Add(new DataMember {
                DataMemberType = ChartDataMemberType.Value,
                ColumnName = "Value",
                ScaleType = ScaleType.Numerical
            });
            // Create a data member that identifies data series.
            dataAdapter.DataMembers.Add(new DataMember {
                DataMemberType = ChartDataMemberType.Series,
                ColumnName = "Name",
                ScaleType = ScaleType.Qualitative
            });

            // Specify a summary function.
            dataAdapter.TimeSpanSummaryOptions.SummaryFunction = "AVERAGE([Value])";

            // Assign the data adapter to the chart.
            chart.SeriesTemplate.DataAdapter = dataAdapter;

        }
        public class DataPoint {
            public TimeSpan Argument { get; set; }
            public double Value { get; set; }
            public string Name { get; set; }
            public static List<DataPoint> GetDataPoints() {
                return new List<DataPoint> {
                    new DataPoint { Argument= new TimeSpan(1,0,0), Value = 853D, Name = "Series 2"},
                    new DataPoint { Argument= new TimeSpan(1,0,0), Value = 321D, Name = "Series 2"},
                    new DataPoint { Argument= new TimeSpan(1,0,0), Value = 655D, Name = "Series 1"},
                    new DataPoint { Argument= new TimeSpan(2,0,0), Value = 1325D, Name = "Series 1"},
                    new DataPoint { Argument= new TimeSpan(2,0,0), Value = 653D, Name = "Series 2"},
                    new DataPoint { Argument= new TimeSpan(2,0,0), Value = 172D, Name = "Series 2"},
                    new DataPoint { Argument= new TimeSpan(3,0,0), Value = 255D, Name = "Series 1"},
                    new DataPoint { Argument= new TimeSpan(3,0,0), Value = 981D, Name = "Series 1"},
                    new DataPoint { Argument= new TimeSpan(3,0,0), Value = 913D, Name = "Series 2"},
                    new DataPoint { Argument= new TimeSpan(3,0,0), Value = 123D, Name = "Series 1"},
                    new DataPoint { Argument= new TimeSpan(4,0,0), Value = 1011D, Name = "Series 1"},
                    new DataPoint { Argument= new TimeSpan(4,0,0), Value = 359D, Name = "Series 2"},
                    new DataPoint { Argument= new TimeSpan(4,0,0), Value = 721D, Name = "Series 2"},
                    new DataPoint { Argument= new TimeSpan(4,0,0), Value = 565D, Name = "Series 1"}
                };
            }
        }
    }
}
See Also