Skip to main content
All docs
V24.1

SummaryDataAdapter.TimeSpanSummaryOptions Property

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

Namespace: DevExpress.XtraCharts

Assembly: DevExpress.XtraCharts.v24.1.dll

NuGet Package: DevExpress.Charts

Declaration

[PersistenceMode(PersistenceMode.InnerProperty)]
[XtraChartsLocalizableCategory(XtraChartsCategory.Data)]
[XtraSerializableProperty(XtraSerializationVisibility.Content)]
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, which defines a function used to summarize series values.

Example

The following example shows how to create a series and aggregate points with equal arguments.

A summary function is not applied. A summary function (SUM) is applied.
A summary function is not applied The SUM summary function is applied
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) {

            // Create a series.                
            Series series = new Series("Series", ViewType.Point);

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

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

            // 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
            });

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

            // Assign the data adapter to the series.
            series.DataAdapter = dataAdapter;

            // Add the series to the chart.
            chart.Series.Add(series);
        }

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