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]Pivot Grid
  [Expand]Tree List
  [Collapse]Chart Control
   [Expand]Getting Started
   [Expand]Fundamentals
   [Collapse]Providing Data
    [Collapse]Providing Data
      Manually Create a Series
      Manually Add Points to a Series
      Specify Series Data Members
      Automatic Series Creation
      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
      Data Aggregation
      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]Document Server
[Expand]Reporting
[Expand]Report Server
[Expand]Dashboard
[Expand]eXpressApp Framework
[Expand]CodeRush
[Expand]CodeRush Classic
[Expand]Cross-Platform Core Libraries
[Expand]Tools and Utilities
 End-User Documentation

Data Aggregation

This document explains the concept of data aggregation, and how to customize this feature for date-time and numeric data.

The document consists of the following sections.

Expanded Overview

Data aggregation is useful when your charts display a very large amount of data (e.g., thousands or even millions of data points), and it is necessary to show a quick aggregated view of this data.

The image below shows a chart with non-aggregated data.

When data aggregation is enabled in the chart control, the chart will split the entire X-axis into intervals (according to the measure unit value), and automatically aggregate data for each interval.

Note

Data aggregation is available for the argument axis (X-axis) only, and neither the value axis (Y-axis) nor the secondary axes have this property.

The following image shows chart data aggregated by year.

The data aggregation feature provides three scale modes (ScaleOptionsBase.ScaleMode) for both date-time and numeric data.

  • ScaleMode.Automatic - in which the chart control automatically defines the most optimal unit of measure for an axis based on the input data, the current chart control size and the zoom level.

    You can specify the aggregate function using the DevExpress.XtraCharts.ScaleOptionsBase.AggregateFunction property.

  • ScaleMode.Manual - where you can define the scale measure unit (DateTimeScaleOptions.MeasureUnit, NumericScaleOptions.MeasureUnit), aggregate function and grid settings.
  • ScaleMode.Continuous - data aggregation is disabled in these scale options and therefore an axis scale is not divided into intervals.

The sections below detail the specifics of using the aggregation feature for date-time and numeric data.

Expanded Aggregate Function

Data for each interval on the X-axis is aggregated using the function specified by the DevExpress.XtraCharts.ScaleOptionsBase.AggregateFunction property (available both in ScaleMode.Automatic and ScaleMode.Manual scale modes). Although by default, aggregate function is set to AggregateFunction.Average, it can be changed to any function lists in the AggregateFunction enumeration.

The table below shows data aggregation in the ScaleMode.Automatic scale mode using the AggregateFunction.Minimum and AggregateFunction.Sum functions.

Property value

Resulting image

DevExpress.XtraCharts.ScaleOptionsBase.AggregateFunction = AggregateFunction.Minimum

DevExpress.XtraCharts.ScaleOptionsBase.AggregateFunction = AggregateFunction.Sum

In automatic date-time scale mode, the DateTimeOptions.Format and DateTimeOptions.FormatString properties are calculated automatically. Their values can be obtained in the ChartControl.AxisScaleChanged event handler.

This event also allows you to obtain the values calculated for an axis grid alignment unit and a measure unit, and also allows you to access other properties of the axis. For a code example, refer to How to: Obtain Values Calculated for Automatic Axis Date-Time Scale Modes.

Note

When the Aggregate function is set to None, all series are grouped against point arguments and the arithmetic operation is not applied to data.

If you specify the summary function, the aggregate function can't be applied to data.

If you wish to disable aggregation, set the ScaleOptionsBase.ScaleMode property to Continuous. In this mode, an axis scale is not divided into intervals, and therefore aggregation cannot be applied to chart data.

Note

Only Continuous mode is available for a Gantt series because their values intrinsically have the date-time scale type, when only the numeric value scale type is required.

Expanded Date-time Data

For date-time data on the X-axis, data aggregation is enabled by default, and the date-time ScaleOptionsBase.ScaleMode is ScaleMode.Manual. In this mode, the DateTimeScaleOptions.GridAlignment and DateTimeScaleOptions.MeasureUnit properties are available. These properties allow you to define the output format of date-time values shown by the axis labels. The following image illustrates these options.

For instance, you can use the DateTimeScaleOptions.MeasureUnit property to determine the detail level for date-time values. Predefined measure units for date-time scales are stored in the DateTimeMeasurementUnit and their values are DateTimeMeasurementUnit.Millisecond, DateTimeMeasurementUnit.Second, DateTimeMeasurementUnit.Minute, DateTimeMeasurementUnit.Hour, DateTimeMeasurementUnit.Day, DateTimeMeasurementUnit.Week, DateTimeMeasurementUnit.Month, DateTimeMeasurementUnit.Quarter and DateTimeMeasurementUnit.Year.

The following table shows data aggregation for the measure unit set to DateTimeMeasurementUnit.Quarter and DateTimeMeasurementUnit.Year.

Note

To use a custom Date-Time measure unit in a Automatic scale mode, assign an object of a class implementing the IDateTimeMeasureUnitsCalculator interface to the DateTimeScaleOptions.AutomaticMeasureUnitsCalculator property. Refer to the How to: Use Custom Measure Units in an Automatic Date-Time Scale Mode example to learn more.

Expanded Numeric Data

Data aggregation is disabled for the numeric scale type because the scale mode is set to ScaleMode.Continuous by default.

To enable this feature, you need to change the current scale mode to either ScaleMode.Manual or ScaleMode.Automatic.

The following image shows data aggregation in ScaleMode.Automatic scale mode using the default AggregateFunction.Average function.

If the AggregateFunction.Average aggregate function does not meet your business requirements, you can apply another function using the DevExpress.XtraCharts.ScaleOptionsBase.AggregateFunction property (also available in ScaleMode.Manual scale mode).

In ScaleMode.Manual scale mode, it is possible to use one of the measure units that are listed in the NumericMeasureUnit; the predefined measure units are NumericMeasureUnit.Ones, NumericMeasureUnit.Tens, NumericMeasureUnit.Hundreds, NumericMeasureUnit.Thousands, NumericMeasureUnit.Millions and NumericMeasureUnit.Billions. In addition, you can specify a custom measure unit using the NumericScaleOptions.CustomMeasureUnit property when the NumericScaleOptions.MeasureUnit property is set to NumericMeasureUnit.Custom.

The following table shows data aggregation of a random function for a measure unit set to NumericMeasureUnit.Hundreds and NumericMeasureUnit.Thousands.

Note

To use a custom numeric measure unit in a Automatic scale mode, assign an object of a class implementing the INumericMeasureUnitsCalculator interface to the NumericScaleOptions.AutomaticMeasureUnitsCalculator property. Refer to the How to: Use Custom Measure Units in an Automatic Numeric Scale Mode example to learn more.

Expanded See Also

How would you rate this topic?​​​​​​​