Aligning Data in Chart Controls

Two Series are considered to be aligned if they have the same number of data points and the same data in their corresponding X values.

Use one or a combination of the following methods to align your data.

Filtering

Remove unnecessary points from each series, so that all series have the same number of points. For more information, see Filtering Data.

Grouping

Group points in a series in required intervals, such as days, weeks, and months. For more information, see Grouping Data.

Inserting Empty Points

Empty points represent missing data, and can be used to maintain a consistent number of points in all series. For more information, see Using Empty Data Points.

The following code demonstrates how to align two series by grouping data, adding empty points, and then filtering data. It aligns Series1 and Series2, which may have no data point per day or multiple data points per day.

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

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

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