Dundas Chart for ASP.NET
FilterTopN(Int32,String,String,String,Boolean) Method
See Also  Example Send comments on this topic.
Dundas.Charting.WebControl Namespace > DataManipulator Class > FilterTopN Method : FilterTopN(Int32,String,String,String,Boolean) 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. 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 (in which case the outputSeriesName 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.
usingValue
The data point value of the first named series that is examined (e.g. "X", "Y", "Y2", etc.) .
Defines which value of the point use in comparison (X, Y, Y2, ...).
getTopValues
Largest values are kept if true, otherwise smallest values are kept.
Indicate that N top values must be retrieved, otherwise N bottom values.

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 input series that have the largest or smallest values.


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, _
   ByVal outputSeriesNames As String, _
   ByVal usingValue As String, _
   ByVal getTopValues As Boolean _
) 
Visual Basic (Usage) Copy Code
Dim instance As DataManipulator
Dim pointCount As Integer
Dim inputSeriesNames As String
Dim outputSeriesNames As String
Dim usingValue As String
Dim getTopValues As Boolean
 
instance.FilterTopN(pointCount, inputSeriesNames, outputSeriesNames, usingValue, getTopValues)
C#  
public void FilterTopN( 
   int pointCount,
   string inputSeriesNames,
   string outputSeriesNames,
   string usingValue,
   bool getTopValues
)

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. 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 (in which case the outputSeriesName 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.
usingValue
The data point value of the first named series that is examined (e.g. "X", "Y", "Y2", etc.) .
Defines which value of the point use in comparison (X, Y, Y2, ...).
getTopValues
Largest values are kept if true, otherwise smallest values are kept.
Indicate that N top values must be retrieved, otherwise N bottom values.

Example

The following sample code filters 2 chart series, and only 10 data points in both series are kept, these being the points that correspond to those of the first series that have the smallest second Y-values. Series1 and Series2 are filtered, and the resulting data is stored in Series3 and Series4, respectively. We only display Series3 and Series4.
Visual Basic Copy Code
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load<CRLF> <CRLF> ' Filter out all points except 10 data points, that correspond to the first series with the largest Y values<CRLF> Chart1.DataManipulator.FilterTopN(10, "Series1
C# Copy Code
private void Page_Load(object sender, System.EventArgs e)<CRLF>{<CRLF><CRLF>    // Filter out all points except 10 data points, that correspond to the first series with the largest Y values<CRLF>    Chart1.DataManipulator.FilterTopN(10, "Series1

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 or smallest values. getTopValues determines whether largest or smallest points are removed.

The values in the first series that are examined are determined by the usingValue parameter (e.g. "X", "Y", "Y2", 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 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 output series that stores the filtered data from the first input series will have its data points sorted by the value specified by the usingValue parameter. Since all output series are aligned this means that the data in each output series is ordered according to the sorting of the first output series.

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.

Filtered points can be either removed from a series (default) or displayed as empty points, depending on the FilterSetEmptyPoints value.

Filters are always applied to an entire series.

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

Copyright © 2001 - 2009 Dundas Data Visualization, Inc. and others.