Dundas Chart for ASP.NET
Filter(DateRangeType,String,String,String) Method
See Also  Example Send comments on this topic.
Dundas.Charting.WebControl Namespace > DataManipulator Class > Filter Method : Filter(DateRangeType,String,String,String) Method


dateRange
An DateRangeType enumeration value which is a date/time interval (e.g. days of the week, days of the month, etc.). Determines the ranges that will have the given elements filtered.
Element type.
rangeElements
Determines the elements within the date/time range (specified by the dateRange parameter) that will be filtered. Can be a single value (e.g. "7"), comma-separated values (e.g. "5,6"), a range of values (e.g. 9-11), or any variation thereof (e.g. "5,6,9-11").
Comma separated element indexes.
inputSeriesNames
The name(s) of the series that will be filtered. For multiple series use a comma-separated list of names, and make sure that the series are aligned. An asterisk (*) may be used to filter all series in the series collection (in which case the outputSeriesName parameter must be empty).
Comma separated input series names.
outputSeriesNames
The name(s) of the series that store the filtered data. Make sure that the number of output series matches the number of input series, otherwise an exception will be thrown.
Comma separated output series names.

Enterprise Edition Only Feature. Filters one or more series' data points, either removing or marking as empty the specified data points for the given date/time ranges.


Filters points using the elements indexes.

Syntax

Visual Basic (Declaration)  
Public Overloads Sub Filter( _
   ByVal dateRange As DateRangeType, _
   ByVal rangeElements As String, _
   ByVal inputSeriesNames As String, _
   ByVal outputSeriesNames As String _
) 
Visual Basic (Usage) Copy Code
Dim instance As DataManipulator
Dim dateRange As DateRangeType
Dim rangeElements As String
Dim inputSeriesNames As String
Dim outputSeriesNames As String
 
instance.Filter(dateRange, rangeElements, inputSeriesNames, outputSeriesNames)
C#  
public void Filter( 
   DateRangeType dateRange,
   string rangeElements,
   string inputSeriesNames,
   string outputSeriesNames
)

Parameters

dateRange
An DateRangeType enumeration value which is a date/time interval (e.g. days of the week, days of the month, etc.). Determines the ranges that will have the given elements filtered.
Element type.
rangeElements
Determines the elements within the date/time range (specified by the dateRange parameter) that will be filtered. Can be a single value (e.g. "7"), comma-separated values (e.g. "5,6"), a range of values (e.g. 9-11), or any variation thereof (e.g. "5,6,9-11").
Comma separated element indexes.
inputSeriesNames
The name(s) of the series that will be filtered. For multiple series use a comma-separated list of names, and make sure that the series are aligned. An asterisk (*) may be used to filter all series in the series collection (in which case the outputSeriesName parameter must be empty).
Comma separated input series names.
outputSeriesNames
The name(s) of the series that store the filtered data. Make sure that the number of output series matches the number of input series, otherwise an exception will be thrown.
Comma separated output series names.

Example

The following sample adds multiple data points that have unique date/time X-values and randomly set Y-values to two series named Series1 and Series2. Then the series are filtered so that all Saturdays and Sundays are removed, and the modified data is stored in two other series named Series3 and Series4.

We do not display the first two series.

Visual Basic Copy Code
using Dundas.Charting.WebControl; <CRLF> ... <CRLF><CRLF>DateTime currentDate;<CRLF>Dim randomValues As New Random()<CRLF>Dim i As Int32<CRLF><CRLF>' Initialize variables<CRLF>currentDate = DateTime.Now.Date<CRLF><CRLF>' Add randomly-sized data points to Series1 and Series2<CRLF>For i = 0 To 20<CRLF> currentDate = currentDate.AddDays(i)<CRLF> Chart1.Series("Series1").Points.AddXY(currentDate.Date, randomValues.Next(0, 100))<CRLF> Chart1.Series("Series2").Points.AddXY(currentDate.Date, randomValues.Next(0, 100))<CRLF>Next<CRLF><CRLF>' Filter out Saturdays and Sundays<CRLF>Chart1.DataManipulator.Filter(DateRangeType.DayOfWeek, "0
C# Copy Code
using Dundas.Charting.WebControl;<CRLF>  ...<CRLF><CRLF>DateTime currentDate;<CRLF>Random randomValues = new Random();<CRLF>Int32 i = 0;<CRLF><CRLF>// Initialize variables<CRLF>currentDate = DateTime.Now.Date;<CRLF><CRLF>// Add randomly-sized data points to Series1 and Series2<CRLF>for (i = 0; i &lt;= 20; i++)<CRLF>{<CRLF>    currentDate = currentDate.AddDays(i);<CRLF>    Chart1.Series["Series1"].Points.AddXY(currentDate.Date, randomValues.Next(0, 100));<CRLF>    Chart1.Series["Series2"].Points.AddXY(currentDate.Date, randomValues.Next(0, 100));<CRLF>}<CRLF><CRLF>// Filter out Saturdays and Sundays<CRLF>Chart1.DataManipulator.Filter(DateRangeType.DayOfWeek, "0

Remarks

This method filters one or more series' data points specified by the rangeElements parameter within date/time ranges that are determined by the dateRange parameter. For example, if  dateRange is "dateRange.DaysOfWeek" and  rangeElements is "0,6" then all data points for every Saturday and Sunday are filtered (remember that Sunday is considered day number zero in a week).

Filtering should only be applied to multiple series that are aligned, otherwise an exception will be thrown (for information concerning alignment of data see the Aligning Data topic). Note also that multiple series are filtered using the values from the FIRST specified series. If two series must be filtered independently call the Filter method twice using one series as a parameter.

If a specified output series has not been created and added to the SeriesCollection when this function call is made it will be created and added to the collection automatically, and have default Series properties (e.g. column chart type, etc.). In addition, the ChartArea property of the series is set to "Default", and if a chart area with the name "Default" exists in the ChartAreasCollection it will be used to draw the chart. If there is no chart area with this name the first ChartArea object in the collection will be used to display the series.

Filters are always applied to an entire series.

Filtered points can be either removed from a series (default) or displayed as empty points, depending on the FilterSetEmptyPoints value.

Points can also be marked as filtered if they DO NOT match filtering criteria (determined by the FilterMatchPoints value).

To filter data and only keep a specified number of highest or lowest values use the FilterTopN method instead.

Requirements

Target Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Windows Vista, Windows Server 2008 family

See Also

Copyright © 2001 - 2009 Dundas Data Visualization, Inc. and others.