Using The Top-N Feature
- 3 minutes to read
This topic describes how to aggregate multiple series points into a single point.
The topic consists of the following sections.
Top-N Feature Overview
DevExpress ASP.NET Charts support the Top-N feature, which allows you to eliminate series points with negligibly small values by either aggregating them into a single cumulative point, or by excluding them from the chart. Note that this does not affect the series points collection, and only has an effect on how the chart is displayed.
In general, this cumulative point (when made visible) behaves like an ordinary point (e.g., it can be exploded and displayed in the legend, where it can be accompanied by custom text).
Note
The Top-N feature is only available for a series whose data points contain one value, because this value is used to determine which points to show. Thus, the Top-N feature is not available for series view types that utilize more than one value (e.g., Stock or Bubble).
If a series contains data points with negative values, their absolute values are used to calculate which points are visible within the chart.
Using the Top-N Feature
To enable the Top-N feature within the SeriesBase.TopNOptions property, set the TopNOptions.Enabled property to true
. Then, use the TopNOptions.Mode property to specify how to determine the number of Top-N series points to display. The available modes are described below.
Count
When this mode is specified, only the first N points within the collection remain visible, while others are aggregated in the cumulative point. Use the TopNOptions.Count property to limit the number of visible points.
Count = 5 Note that in Bar, Line and Area Stacked Charts, series values with shared arguments are stacked, so the Top-N points for multiple series (calculated independently for each series) can include points with the same arguments.
The table below shows how this works for a Stacked Bar Chart with each series TopNOptions.Count property set to 3. Excluding the “Others” cumulative point, 6 values (3 per series) are shown for 5 arguments.
The Top-N feature is not applied. The Top-N feature is applied for both series (Count=3). ThresholdValue
When this mode is specified, you should define the threshold value that points must exceed, so that they are not included in the cumulative point. To do this, use the TopNOptions.ThresholdValue property.
ThresholdValue = 5 ThresholdPercent
In this mode, use the TopNOptions.ThresholdPercent property to specify the threshold as a percentage. The sum of all point values in the series is considered to be 100%. A point is included in the cumulative point if the point’s value is less than the ThresholdPercent of the sum.
ThresholdPercent = 7
To specify whether or not the cumulative point is visible, use the TopNOptions.ShowOthers property. Note that if values are displayed as percentages (either in series point labels or in the legend), the overall percentage ignores the values of hidden points - as shown in the following image.
If the TopNOptions.OthersArgument property is set to true
and arguments are included in the legend item and series label text patterns, the legend displays the cumulative point and series label with the Others argument. You can use this property to change the argument displayed for the cumulative point.
To explode the cumulative point in a Pie or Doughnut chart, set the PieSeriesViewBase.ExplodeMode property to Others.