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


pointCount
The number of data points that the filtering operation will not remove (or mark as empty).
Number of top/bottom points to return.
inputSeriesNames
The name(s) of the series that will be filtered (and will also store the filtered data).  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 all data points in one or more series except for a specified number of points. The points that aren't filtered correspond to points in the first series that have the largest first Y-values.  The Series object(s) that are filtered are used to store the modified data.
Keeps only N top/bottom points of the series.

Syntax

Visual Basic (Declaration)  
Public Overloads Sub FilterTopN( _
   ByVal pointCount As Integer, _
   ByVal inputSeriesNames As String _
) 
Visual Basic (Usage) Copy Code
Dim instance As DataManipulator
Dim pointCount As Integer
Dim inputSeriesNames As String
 
instance.FilterTopN(pointCount, inputSeriesNames)
C#  
public void FilterTopN( 
   int pointCount,
   string inputSeriesNames
)

Parameters

pointCount
The number of data points that the filtering operation will not remove (or mark as empty).
Number of top/bottom points to return.
inputSeriesNames
The name(s) of the series that will be filtered (and will also store the filtered data).  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 code filters all chart series, and only 10 data points in all series are kept, these being the points that correspond to those of the first series that have the largest first Y values.
Visual Basic Copy Code
Imports Dundas.Charting.WinControl
...

    ' Filter out all points except 10 data points,
    ' that correspond To the first series with the largest Y values.
    Chart1.DataManipulator.FilterTopN(10, "*")

...
C# Copy Code
using Dundas.Charting.WinControl
...

   
// Filter out all points except 10 data points,
   
// that correspond to the first series with the largest Y values.
   
Chart1.DataManipulator.FilterTopN(10, "*");

...     

Remarks

This method filters all data points from one or more series except for a specified number of points. The points that aren't filtered correspond to points in the first series that have the largest first Y-values. For example, this method can be used to retrieve the top five products by sales. 

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 FilterTopN method twice using one series as a parameter.

IMPORTANT: the first input series will have its data points sorted by the first Y-value.  Since all series are aligned this means that the data in each series will be ordered according to the sorting of the first 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.

To filter a series:

  • and keep data points with the smallest values use another definition of this function that uses a getTopValues argument.
  • based on a data point value other than the first Y-value (e.g. "X", "Y2", "Y3", etc.) use another definition of this method that takes a usingValue argument.
  • and preserve the original series use another definition of this function that uses an outputSeries argument.

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.