dashboard-15696-winforms-dashboard-winforms-designer-create-dashboards-in-the-winforms-designer-data-shaping-top-n.md
The Top N feature allows you to display only a limited number of values that correspond to the highest or lowest values of a particular measure.
To display the top values in a dimension, select Top N from the data item menu.
This invokes the Top N Values dialog.
In this dialog, check the Enabled check box and specify the following settings.
|
Mode
|
Specifies whether top or bottom values should be displayed.
| |
Count
|
The number of values to be displayed.
| |
Measure
|
The parameter according to which the top or bottom values will be determined.
| |
Show “Others” value
|
If enabled, all values that are not the top/bottom ones are consolidated in the “Others” value.
Note
Note that this capability is not supported in OLAP mode.
|
You can use the hidden measure as a parameter according to which the top or bottom values will be determined.
To configure the Top N feature in code, use the Dimension.TopNOptions property. This property returns a DimensionTopNOptions object that exposes the following properties.
|
|
Gets or sets whether the Top N Values feature is enabled.
| |
|
Gets or sets whether the smallest or largest values should be displayed.
| |
|
Gets or sets the number of top or bottom values to be displayed.
| |
|
Gets or sets the Measure by whose values the dimension values are ranged.
| |
DimensionTopNOptions.ShowOthers
|
Gets or sets whether to show the “Others” value.
|
The following code snippet shows how to display 3 sales persons with the largest Extended Price summaries.
Dimension salesPersonDimension = new Dimension("Sales Person");
Measure extendedPriceMeasure = new Measure("Extended Price");
//...
salesPersonDimension.TopNOptions.BeginUpdate();
salesPersonDimension.TopNOptions.Enabled = true;
salesPersonDimension.TopNOptions.Count = 3;
salesPersonDimension.TopNOptions.Measure = extendedPriceMeasure;
salesPersonDimension.TopNOptions.EndUpdate();
Dim salesPersonDimension As New Dimension("Sales Person")
Dim extendedPriceMeasure As New Measure("Extended Price")
'...
salesPersonDimension.TopNOptions.BeginUpdate()
salesPersonDimension.TopNOptions.Enabled = True
salesPersonDimension.TopNOptions.Count = 3
salesPersonDimension.TopNOptions.Measure = extendedPriceMeasure
salesPersonDimension.TopNOptions.EndUpdate()
The “Others” value has the following limitations:
| API | Description |
|---|---|
| Dimension.TopNOptions | Provides access to the Top N settings. |
| DimensionTopNOptions | Contains the Top N settings. |