Dundas Chart for Windows Forms
Filter(DateRangeType,String,String) Method
See Also  Example Send comments on this topic.
DundasWinChart Assembly > Dundas.Charting.WinControl Namespace > DataManipulator Class > Filter Method : Filter(DateRangeType,String,String) Method


dateRange
A 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.
Comma separated input 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. The filtered Series object(s) are used to store the modified data.


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 _
) 
Visual Basic (Usage) Copy Code
Dim instance As DataManipulator
Dim dateRange As DateRangeType
Dim rangeElements As String
Dim inputSeriesNames As String
 
instance.Filter(dateRange, rangeElements, inputSeriesNames)
C#  
public void Filter( 
   DateRangeType dateRange,
   string rangeElements,
   string inputSeriesNames
)

Parameters

dateRange
A 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.
Comma separated input series names.

Example

The following sample adds multiple data points to two series that have unique date/time X-values and randomly set Y-values. Then the two series are filtered so that all Saturdays and Sundays are displayed as empty points.
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

Dim currentDate As DateTime
Dim randomValues As New Random()
Dim i As Int32

' Display filtered points as empty points instead of removing them from the source data series
Chart1.DataManipulator.FilterSetEmptyPoints = True

' Initialize variables
currentDate = DateTime.Now.Date

' Add randomly-sized data points to Series1 and Series2
For i = 0 To 20
    currentDate = currentDate.AddDays(i)
    Chart1.Series("Series1").Points.AddXY(currentDate.Date, randomValues.Next(0, 100))
    Chart1.Series("Series2").Points.AddXY(currentDate.Date, randomValues.Next(0, 100))
Next

' Filter out Saturdays and Sundays
Chart1.DataManipulator.Filter (DateRangeType.DayOfWeek, "0,6", "Series1,Series2")

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 is not created at design-time it will automatically be created at run-time, 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

© 2009 All Rights Reserved.