Allows for custom filtering of a series' data.
Checks if specified data point must be filtered.
Visual Basic (Declaration) | |
---|---|
Function FilterDataPoint( _ ByVal point As DataPoint, _ ByVal series As Series, _ ByVal pointIndex As Integer _ ) As Boolean |
Visual Basic (Usage) | Copy Code |
---|---|
|
Parameters
- point
-
The DataPoint object to be filtered.
series
The Series object that the data point belongs to.
pointIndex
The index of the data point (determines its position in the series).
Data point object. - series
- The Series object that the data point belongs to.
Series of the point. - pointIndex
- The index of the data point (determines its position in the series).
Index of the point in the series.
Return Value
True if the data point is removed, otherwise false.
True if point must be removed
The following sample demonstrates how to implement the IDataPointFilter interface for a web form and then override the FilterDataPoint method. The custom filtering logic will mark data points as filtered if their (first) Y-values are greater than 5 or less than 2. We perform the filtering operation before data is displayed using the Page_Load event.
Visual Basic | Copy Code |
---|---|
Imports Dundas.Charting.WinControl<CRLF>...<CRLF> <CRLF>Public Class WebForm1<CRLF> Inherits System.Web.UI.Page 'inherit the IDataPointFilter interface for our web form<CRLF> Implements IDataPointFilter<CRLF> <CRLF> 'declare function that contains the custom filtering logic (used by the Filter function)<CRLF> Public Function FilterDataPoint(ByVal point As DataPoint, ByVal series As Series, ByVal pointIndex As Integer) As Boolean Implements IDataPointFilter.FilterDataPoint<CRLF> <CRLF> 'if first Y value is greater than 5 or less than 2 filter out this data point, otherwise keep it<CRLF> If point.YValues(0) > 5 Or point.YValues(0) < 2 Then<CRLF> FilterDataPoint = True<CRLF> Else<CRLF> FilterDataPoint = False<CRLF> End If<CRLF> <CRLF> End Function<CRLF> ...<CRLF> <CRLF> 'perform filtering before data is displayed by chart<CRLF> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<CRLF> Chart1.DataManipulator().Filter(Me, "Series2", "Result")<CRLF> End Sub<CRLF><CRLF>End Class |
This method should be called for each data point in a series, and returns a boolean value indicating whether a data point needs to be filtered.
To provide custom filtering derive a new or existing class (e.g. the WebForm class) from the IDataPointFilter interface and then implement this FilterDataPoint method. Provide custom criteria matching logic, and then return True or False to mark data points as filtered. Once this method has been implemented use one of the Filter method definitions that takes an IDataPointFilter object as a parameter to perform the filtering.
Filtered points by default are removed from a series. They can also be displayed as empty points by setting the FilterSetEmptyPoints value to True.
Filtered points can also be marked as filtered if they do NOT match filtering criteria (determined by the FilterMatchPoints value).
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