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


filterInterface
An object that implements the IDataPointFilter interface.
Filtering interface.
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 which case the outSeriesName 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. Performs custom filtering on one or more series' data points, based on the first series' points.


Filters data points using IDataPointFilter interface.

Syntax

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

Parameters

filterInterface
An object that implements the IDataPointFilter interface.
Filtering interface.
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 which case the outSeriesName 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 filters Series1 and Series2 data points if the second Y-value from Series1' data points is greater than 100. Note that both series must be aligned, or an exception will be raised. The filtered data from Series1 and Series2 is stored in Series3 and Series4, respectively. We only display Series3 and Series4.
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

' Implement the IDataPointFilter interface for our web form
Public Class WebForm1
    Inherits System.Web.UI.Page
    Implements IDataPointFilter
    ...

    ' Declare function that contains the custom filtering logic (used by the Filter function)
    Public Function FilterDataPoint(ByVal point As DataPoint, ByVal series As Series, ByVal pointIndex As Integer) As Boolean _
        Implements IDataPointFilter.FilterDataPoint

        ' If Y2 (second Y value) is greater than 100 filter out this data point, otherwise keep it
        If point.YValues(1) > 100 Then
            FilterDataPoint = True
        Else
            FilterDataPoint = False
        End If

    End Function
    ...

    ' Perform filtering before data is displayed by chart
    Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Chart1.DataManipulator.Filter(Me, "Series1,Series2", "Series3,Series4")

        ' Do not display first two series
        Chart1.Series("Series1").ChartArea = ""
        Chart1.Series("Series2").ChartArea = ""

    End Sub
    ...

Remarks

To utilize this method use a new or existing class (e.g. the WebForm class) that implements the IDataPointFilter interface and then override the FilterDataPoint method to provide custom filtering logic.

Note that filtering can be based on any attribute(s) of the data points (e.g. their first, second and third Y-values, etc.).

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 data points 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).

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.