A format rule that is calculated by delta and used to apply conditional formatting to the Card dashboard item.
public class CardItemDeltaFormatRule : CardItemFormatRuleBase, IDeltaFormatRule
Public Class CardItemDeltaFormatRule Inherits CardItemFormatRuleBase Implements IDeltaFormatRule
If you have multiple cards in the Cards section, the delta format rule applies only to the card by whose values you calculate the format rule. When you use hidden measures or series dimensions to calculate a format rule (CardItemFormatRule), the rule applies to all cards.
Create the CardItemDeltaFormatRule object and specify its settings to add a delta format rule:
- Create a condition (the FormatConditionBase descendant), specify its settings and assign the resulting object to the DashboardItemFormatRule.Condition property.
- Assign a card to the CardItemDeltaFormatRule.Card property. The card's values are used to calculate the condition.
- Specify the CardItemDeltaFormatRule.DeltaValueType property to select the delta type according to which a condition is calculated. Delta can be expressed as an absolute value, an absolute variation or a percentage variation.
Assign the specified CardFormatRuleLayoutElement to the CardItemFormatRuleBase.ApplyToLayoutElement property. This property allows you to select the layout element to apply formatting. A background color applies to all card elements regardless of the selected layout element.
Add the created format rule to the CardItemFormatRuleCollection collection.
The following code snippet illustrates the delta rule that is calculated by the delta's absolute variation value.
using System.Windows.Forms; using DevExpress.DashboardCommon; CardDashboardItem card = (CardDashboardItem)dashboardDesigner1.Dashboard.Items["cardDashboardItem1"]; CardItemDeltaFormatRule rule = new CardItemDeltaFormatRule(); rule.DeltaValueType = DeltaValueType.AbsoluteVariation; rule.Card = card.Cards; var condition = new FormatConditionRangeGradient(FormatConditionRangeGradientPredefinedType.BlueGreen); rule.Condition = condition; card.FormatRules.Add(rule);