FormatConditionRangeSet Class

A format condition used to apply formatting using value ranges and corresponding style settings.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v18.1.Core.dll

Syntax

public class FormatConditionRangeSet :
    FormatConditionRangeBase,
    IAggregationInfo,
    IFormatCondition,
    IXmlSerializableElement,
    IFormatStyleSettingsOwner,
    IMinMaxInfo

Range conditions allow you to apply formatting using a predefined set of value ranges and corresponding style settings. You can use a predefined set of colors/icons to apply formatting or use custom ranges and corresponding icons/colors.

  1. To use a predefined set of colors/icons, pass the required FormatConditionRangeSetPredefinedType enumeration value to the FormatConditionRangeSet constructor or call the corresponding FormatConditionRangeSet.Generate method overload.
  2. To use a predefined set of colors/icons and custom range boundaries, do the following.

  3. To use custom range boundaries and the required style specified for each range, do the following.

Assign the resulting FormatConditionRangeSet object to the DashboardItemFormatRule.Condition property.

Examples

Range conditions (FormatConditionRangeSet) allow you to use predefined or custom sets of icons/colors to apply conditional formatting to different ranges of values.

This example shows how to apply conditional formatting to Grid cells using a predefined set of icons. Use the Update Formatting button to change the number of ranges, specify new range boundaries and customize icons corresponding to existing ranges.

´╗┐using DevExpress.DashboardCommon;

namespace Grid_IconRangeCondition {
    public partial class Form1 : DevExpress.XtraEditors.XtraForm {
        public Form1() {
            InitializeComponent();
            Dashboard dashboard = new Dashboard(); dashboard.LoadFromXml(@"..\..\Data\Dashboard.xml");
            dashboardViewer1.Dashboard = dashboard;
            GridDashboardItem grid = (GridDashboardItem)dashboard.Items["gridDashboardItem1"];
            GridMeasureColumn extendedPrice = (GridMeasureColumn)grid.Columns[1];

            GridItemFormatRule rangeRule = new GridItemFormatRule(extendedPrice);
            FormatConditionRangeSet rangeCondition = 
                new FormatConditionRangeSet(FormatConditionRangeSetPredefinedType.PositiveNegative3);
            rangeRule.Condition = rangeCondition;

            grid.FormatRules.AddRange(rangeRule);
        }

        private void button1_Click(object sender, System.EventArgs e) {
            GridDashboardItem grid = 
                (GridDashboardItem)dashboardViewer1.Dashboard.Items["gridDashboardItem1"];
            GridItemFormatRule rangeRule = grid.FormatRules[0];
            FormatConditionRangeSet rangeCondition = (FormatConditionRangeSet)rangeRule.Condition;
            RangeInfo range3 = rangeCondition.RangeSet[2];
            range3.Value = 50;
            range3.StyleSettings = 
                new IconSettings(FormatConditionIconType.DirectionalYellowUpInclineArrow);

            RangeInfo range4 = new RangeInfo();
            range4.Value = 75;
            range4.StyleSettings = 
                new IconSettings(FormatConditionIconType.IndicatorCircledGreenCheck);
            rangeCondition.RangeSet.Add(range4);

            rangeRule.Condition = rangeCondition;
        }
    }
}

See Also