Dundas Chart for Windows Forms
Aligning Data
See Also Send comments on this topic.
Using Dundas Chart > Enterprise Edition Features > Data Manipulation > Aligning Data



Glossary Item Box

Overview

Enterprise Edition Only Feature.

Two Series are considered to be "aligned" if they have the same number of data points, and the X values of corresponding points are equal. For example, you would consider two series to be aligned if the first points in all of their series have the same X values, and the second points in all of their series have the same X values, and so on. Figure 1 below illustrates aligned, and unaligned Series.

 

Figure 1: Illustrates two Series, one is unaligned (shown left), the other is aligned (shown right).

 

Exceptions Alert

In the following situations, if multiple series are used and not aligned, then an exception will be thrown:

How to Align Series

If several non-aligned series store the same type of the data, and the X value range for these is similar, then they can be aligned using one of the following techniques:

 

Common Alignment Issues and Solutions

This lists possible alignment issues and ways to solve them:

Not all series can be aligned since alignment depends on the type of data points and their values ranges. For example, let's assume two series are using their X values to store the date of a sale and their Y values for the sale amount. The first series has sales information for the year 1995 and the second series for 2001. In this case aligning these series does not make any sense due to the vastly different date of sales. Another good example would be when two series have incompatible X value types (e.g. one series uses its X values to store dates while the other one uses its X values to store the serial number of the product sold).

 

Example

This example demonstrates how to go about aligning Series by inserting empty points for missing data. We assume that each series must have one data point for each week.

Visual Basic Copy Code
Imports Dundas.Charting.WinControl
  ...
  
' Insert empty points for each day if no data point exists.
Chart1.DataManipulator.InsertEmptyPoints(1, IntervalType.Weeks, "Series1, Series2")

C# Copy Code
using Dundas.Charting.WinControl;
  ...
  
// Insert empty points for each day if no data point exists.
Chart1.DataManipulator.InsertEmptyPoints(1, IntervalType.Weeks, "Series1, Series2");

 

Example

This example demonstrates how to align two series by grouping the data points. We will assume that each series must have one data point per week, even if the original data has a data point for each day.

Visual Basic Copy Code
Imports Dundas.Charting.WinControl
  ...
  
' Group all sales for a week into one point with the Y value set to the total.
Chart1.DataManipulator.Group("SUM", 1, IntervalType.Weeks, "Series1, Series2")

C# Copy Code
using Dundas.Charting.WinControl;
  ...
  
// Group all sales for a week into one point with the Y value set to the total.
Chart1.DataManipulator.Group("SUM", 1, IntervalType.Weeks, "Series1, Series2");

 

Example

This example demonstrates how to align two series by grouping, adding empty points, and then filtering. We will assume that each series must have one data point for each working day, and that it is possible for the raw data to have no sales per day, or more than one sale per day.

Visual Basic Copy Code
Imports Dundas.Charting.WinControl
  ...
  
Dim myDatManip As DataManipulator = Chart1.DataManipulator

' Group all sales for each day into one point, with the Y value set to the total sales.
myDatManip.Group("SUM", 1, IntervalType.Days, "Series1, Series2")

' Insert empty points for each day if no data point exists.
myDatManip.InsertEmptyPoints(1, IntervalType.Days, "Series1, Series2")

' Remove Sundays and Saturdays from the series.
myDatManip.Filter(DateRangeType.DayOfWeek, "0,6", "Series1, Series2")

C# Copy Code
using Dundas.Charting.WinControl;
  ...
  
DataManipulator myDatManip = Chart1.DataManipulator;

// Group all sales for each day into one point, with the Y value set to the total sales.
myDatManip.Group( "SUM", 1, IntervalType.Days, "Series1, Series2" ); 

// Insert empty points for each day if no data point exists.
myDatManip.InsertEmptyPoints( 1, IntervalType.Days, "Series1, Series2" ); 

// Remove Sundays and Saturdays from the series.
myDatManip.Filter( DateRangeType.DayOfWeek, "0,6", "Series1, Series2" ); 

See Also

©2009. All Rights Reserved.