Skip to main content

FormatConditionBar Class

A format condition used to visualize numeric values using bars.

Namespace: DevExpress.DashboardCommon

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


public class FormatConditionBar :


To create a format condition to display bars with lengths proportional to corresponding values, do the following.

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


The Bar format condition (FormatConditionBar) allows you to visualize numeric values using bars.

This example shows how to display data bars within grid cells. Note that bars corresponding to positive and negative values are colored differently.

View Example

using DevExpress.DashboardCommon;

namespace Grid_FormatRules {
    public partial class BarConditionForm : DevExpress.XtraEditors.XtraForm {
        public BarConditionForm() {
            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 barRule = new GridItemFormatRule(extendedPrice);
            FormatConditionBar barCondition = new FormatConditionBar();
            barCondition.StyleSettings = new BarStyleSettings(FormatConditionAppearanceType.PaleBlue);
            barCondition.NegativeStyleSettings = new BarStyleSettings(FormatConditionAppearanceType.PaleRed);
            barCondition.BarOptions.AllowNegativeAxis = checkBox1.Checked;
            barCondition.BarOptions.DrawAxis = checkBox2.Checked;
            barRule.Condition = barCondition;


        private void checkBox1_CheckedChanged(object sender, System.EventArgs e) {

        private void checkBox2_CheckedChanged(object sender, System.EventArgs e) {

        private void checkBox3_CheckedChanged(object sender, System.EventArgs e) {

        private void UpdateBarOptions() {
            GridDashboardItem grid = (GridDashboardItem)dashboardViewer1.Dashboard.Items[0];
            FormatConditionBarOptions barOptions = ((FormatConditionBar)(grid.FormatRules[0]).Condition).BarOptions;
            barOptions.AllowNegativeAxis = checkBox1.Checked;
            barOptions.DrawAxis = checkBox2.Checked;
            barOptions.ShowBarOnly = checkBox3.Checked;

The following code snippets (auto-collected from DevExpress Examples) contain references to the FormatConditionBar class.


The algorithm used to collect these code examples remains a work in progress. Accordingly, the links and snippets below may produce inaccurate results. If you encounter an issue with code examples below, please use the feedback form on this page to report the issue.

See Also