The requested page is not available for the requested platform. You are viewing the content for Default platform.

FormatConditionColorRangeBar Class

A format condition used to visualize numeric values using bars whose colors are contained in the specified color set.

Namespace: DevExpress.DashboardCommon

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

Declaration

public class FormatConditionColorRangeBar :
    FormatConditionRangeSet,
    IMinMaxInfo
Public Class FormatConditionColorRangeBar
    Inherits FormatConditionRangeSet
    Implements IMinMaxInfo

Remarks

Range conditions allow you to apply formatting using a predefined set of value ranges and corresponding style settings.

To create a format condition to display bars of different colors with lengths proportional to corresponding values, use the following approaches.

  1. To use a predefined set of colors, pass the required FormatConditionRangeSetPredefinedType enumeration value to the FormatConditionColorRangeBar constructor or call the FormatConditionColorRangeBar.Generate method.
  2. To use a predefined set of colors 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 FormatConditionColorRangeBar object to the DashboardItemFormatRule.Condition property.

Examples

The Bar Color Ranges condition (FormatConditionColorRangeBar) allows you to visualize numeric values using bars whose colors are contained in the specified color set.

This example shows how to display colored bars within Grid cells. Use the Update Formatting button to change the number of ranges, specify new range boundaries and customize colors 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);
            FormatConditionColorRangeBar rangeBarCondition =
                new FormatConditionColorRangeBar(FormatConditionRangeSetPredefinedType.ColorsRedGreenBlue);
            rangeBarCondition.BarOptions.ShowBarOnly = true;
            rangeRule.Condition = rangeBarCondition;

            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];
            FormatConditionColorRangeBar rangeBarCondition = (FormatConditionColorRangeBar)rangeRule.Condition;
            RangeInfo range3 = rangeBarCondition.RangeSet[2];
            range3.Value = 50;
            range3.StyleSettings =
                new BarStyleSettings(FormatConditionAppearanceType.GradientGreen);

            RangeInfo range4 = new RangeInfo();
            range4.Value = 75;
            range4.StyleSettings =
                new BarStyleSettings(FormatConditionAppearanceType.GradientBlue);
            rangeBarCondition.RangeSet.Add(range4);

            rangeRule.Condition = rangeBarCondition;
        }
    }
}

Implements

DevExpress.DashboardCommon.Native.IAggregationInfo
DevExpress.DashboardCommon.Native.IFormatCondition
DevExpress.DashboardCommon.Native.IXmlSerializableElement
DevExpress.DashboardCommon.Native.IFormatStyleSettingsOwner
DevExpress.DashboardCommon.Native.IMinMaxInfo
See Also