WinForms and ASP.NET Charts: Automatic Data Aggregation (What’s New in 13.2)

25 November 2013

OK, call this both good news and bad news: this post is not only a “What’s New” but also partially describes some breaking changes.

What is Data Aggregation?

Starting from 13.2, XtraCharts (both ASP.NET and WinForms) will support automatic data aggregation. This is extremely useful in the situation where your charts are trying to display a very large amount of data (e.g., thousands or even millions of data points), and it is necessary to have a quick aggregated overview of this data. Our data aggregation feature works for an X-axis (the argument axis) that is showing either numeric or date-time data.

To quickly demonstrate this feature, below is a chart with non-aggregated data:

XtraCharts: Chart showing non-aggregated data

And below is a chart with the same data, but automatically aggregated by years.

XtraCharts: Chart showing data aggregated by year

In addition, the WinForms Chart control supports automatic data aggregation when your end-users scroll, zoom, or resize a chart.

How Does It Work for a Numeric X-Axis?

Though data aggregation is by default disabled for numeric scales, you can easily enable it by setting the AxisX.NumericScaleOptions.ScaleMode property either to Manual or Automatic. In this case, the chart will split the entire X-axis into intervals (according to the AxisX.NumericScaleOptions.MeasureUnit property value) and automatically aggregate data for each interval. Predefined intervals for a numeric scale are Tens, Hundreds, Thousands, Millions, Billions, or you can define any custom value.

The only difference between Manual and Automatic modes is that in Manual mode you need to specify the desired MeasureUnit, while in Automatic mode this measure unit will be chosen automatically by a chart according to its current size and zoom level. So, in most cases, Automatic is the recommended choice.

XtraCharts: animated chart showing numeric data aggregation

(Also, there is Continuous scale mode, in which an axis scale is not divided into intervals and therefore aggregation cannot be applied to chart data.)

After you enable data aggregation, data for each interval on X-axis are aggregated using the function specified by the NumericScaleOptions.AggregateFunction property. By default it is Average, though you may change it to Minimum, Maximum, Sum and others.

To disable aggregation, simply set AggregateFunction to None.

How Does It Work for a Date-time X-Axis?

For date-time data on the X-axis everything is even easier, because data aggregation is enabled by default. Just check out the AxisX.DateTimeScaleOptions.ScaleMode property value and either leave it Manual, or choose Automatic.

XtraCharts: animated chart showing DateTime aggregate data

Predefined measure units for date-time scales are Millisecond, Second, Minute, Hour, Day, Week, Month, Quarter and Year. By default, Day is chosen to provide backward compatibility.

Video

For those who prefer watching to reading, here is a short video describing this feature in detail.

Breaking Changes

To implement all these features, we had to do some significant work and had to rewrite some big chunks of the XtraCharts product. We didn’t stop there: since we were rewriting parts of the product, we took some time to optimize the code both for performance and for usability. As a result there have been some breaking changes. Whereas we’re certain these changes were necessary in order to move the product forward, we recognize that they might have an impact on your migration process to 13.2; nevertheless we’ve tried to minimize the effects to the public API.

Here is a list of breaking changes in XtraCharts 13.2:

  • The drawing of all Area, Stacked Line, and Full-Stacked Line views has changed when series contain missing or empty points.
  • The series points are always aggregated for date-time arguments by default.
  • Setting the DateTimeScaleOptions.GridAlignment property to a value less than the current measure unit no longer affects data representation and calculation.
  • In previous versions, you could not set grid alignment to a value less than the measure unit specified in the DateTimeScaleOptions.MeasureUnit  (e.g., MeasureUnitMonth, GridAlignmentDay). Also, for example, the width of bars no longer depends on the GridAlignment property.
  • The AxisBase.GridSpacing property now specifies the number of grid alignment units.
  • The ColorEach algorithm has been changed for unsorted data with numeric or date-time arguments.
  • The current chart interlacing can become inverted in some scenarios.
  • The MeasureUnit property for date-time Y-axes is no longer supported.
  • The number and/or position of Tickmarks and Gridlines in X-Axes might be changed.
  • The order of qualitative arguments in X-Axis might have changed in some cases. (For example: suppose the first series has arguments A, B, D, and the second series has arguments A, C, B, D. Prior to version 13.2, the arguments on the X-axis would appear as A, C, B, D; with 3.2, the arguments will be in the order A, B, D, C.)
  • The SeriesPoint.Tag property now returns the list of tags for all aggregated points.
  • The ChartControl.DateTimeMeasurementUnitsCalculated event no longer exists. Instead, handle the ChartControl.AxisScaleChanged event, which is raised when the scale mode, measure unit, grid alignment or grid spacing of the axis scale has been changed.
1 comment(s)
László Pétervári

Hello,

this sounds very good, and I'm looking forward to test it.

We are mostly dealing with power network measurement data visualization. There are series which representing the minimum or maximum values of some kind of data in every minute. In this case the averaging aggration is not suitable, because it would show incorrect values. For these series I need to set the aggregation method to minmum or maximum. But in the same chart I can have series which represents other kind of data, which needs the averaging aggregation.

Can I set the aggregation method for each individual series, which would override the axis' default setting?

Thanks,

Zoltán

15 January, 2014

Please login or register to post comments.