Nevron .NET Vision
Chart for .NET / User's Guide / Data Manipulation / Subset Operations / Filtering

In This Topic
    In This Topic

    The data series of Nevron Chart for .NET have built-in support for filtering. In general filtering represents the ability to extract a data series subset based on a user specified criteria.

     Performing a Filter operation

    The filtering functionality of the data series is exposed by the Filter method of the NDataSeries class. The filter operations can be performed only on data series of type Double. If you attempt to execute the Filter method on a data series of other type the component will raise an exception. The Filter command receives two arguments - the compare method which must be used and the compare value. The method will return an instance of a NDataSeriesSubset object containing the indexes of the values in the data series which match the specified criteria.

    The following code retrieves the subset of bar values which are smaller than 50.

    Copy Code
    NDataSeriesSubset subset = barseries.Values.Filter(CompareMethod.Less, 50);
    Visual Basic
    Copy Code
    Dim subset As NDataSeriesSubset =  barseries.Values.Filter(CompareMethod.Less,50)
     Supported Compare methods

    The compare method passed to the Filter function is of type CompareMethod which has the following fields:


    Internally the filter method iterates through the data series values and performs the compare method against the current value. If the current value satisfies the specified criteria its index is added to the returned subset. The following table describes the operation which is performed by the compare methods:

    Compare Method Description
    More curValue > compareValue
    Less curValue < compareValue
    Equal curValue = compareValue
    MoreOrEqual curValue >= compareValue
    LessOrEqual curValue <= compareValue
    NotEqual curValue != compareValue
     Implementing complex filtering

    In conjunction with the powerful set operations implemented by the NDataSeriesSubset class the user can implement complex filtering of the data. The following example generates an array of the data series values which are which are bigger than 35 and smaller than 85.

    Copy Code
    NDataSeriesSubset s1, s2;
    s1 = bar.Values.Filter(CompareMethod.More, 35);
    s2 = bar.Values.Filter(CompareMethod.Less, 85);
    ArrayList arrValues = new ArrayList();
    foreach (int index in s1)
    Visual Basic
    Copy Code
    Dim s1 As NDataSeriesSubset,s2 As NDataSeriesSubset
    s1 = bar.Values.Filter(CompareMethod.More, 35)
    s2 = bar.Values.Filter(CompareMethod.Less, 85)
    Dim arrValues As ArrayList =  New ArrayList()
    Dim index As Integer
    For Each index In s1
     Related Examples
    Windows forms: All Examples\Data Manipulation\General\Filtering
    See Also