Top-Bottom
- 3 minutes to read
The Top-Bottom format conditions allow you to highlight a specific number of topmost/bottommost values. You can specify this number as an absolute or percent value.
- Supported Types
- Create a Format Rule in the WinForms Designer
- Create a Format Rule in the Web Dashboard
- Create a Format Rule in Code
Supported Types
The following condition types are supported for measures.
Format Condition | Description | Can be applied to |
---|---|---|
Top N | The Top N format condition allows you to apply formatting to elements whose values are ranked at the top. For instance, the following image displays a Grid dashboard item whose top 3 Extended Price values filled in green. | Measures |
Bottom N | The Bottom N format condition allows you to apply formatting to elements whose values are ranked at the bottom. For instance, the following image displays a Grid dashboard item whose bottom 40 percent Extended Price values are filled in red. | Measures |
Create a Format Rule in the WinForms Designer
Click the measure’s menu button and select Add Format Rule | Top/Bottom and choose the required type:
This action invokes the dialog that allows you to configure a format rule and specify its style:
Here you can specify the number of top or bottom values to be displayed and whether to use a number or a percent to calculate top / bottom values.
Create a Format Rule in the Web Dashboard
In the Conditional Formatting section, click the plus button to add a new format rule:
Select the data item you want to format and set the condition type to Top/Bottom:
Select the required format rule’s type:
This action opens the Top/Bottom settings where you can configure a format rule and specify its style:
- The Count option allows you to specify the number of top or bottom values to be displayed.
- The Rank Type option is used to specify whether to use a number or a percent to calculate top / bottom values.
Create a Format Rule in Code
To create the Top-Bottom format condition in code, create the FormatConditionTopBottom class instance and specify the following settings.
- Specify whether the formatting is applied to top or bottom values using the FormatConditionTopBottom.TopBottom property.
- Specify whether an absolute or percent boundary value is used to apply formatting using the FormatConditionTopBottom.RankType property.
- Specify the required rank value using the FormatConditionTopBottom.Rank property.
- Specify the required style settings applied to target elements using the FormatConditionStyleBase.StyleSettings property. You can change the color of dashboard item elements, font settings (AppearanceSettings) or add predefined icons (IconSettings).
Assign the resulting FormatConditionTopBottom object to the DashboardItemFormatRule.Condition property.
The following example shows how to apply conditional formatting to Grid cells: