Skip to main content
A newer version of this page is available. .

FormatConditionBar Class

A format condition used to visualize numeric values using bars.

Namespace: DevExpress.DashboardCommon

Assembly: DevExpress.Dashboard.v20.2.Core.dll

NuGet Packages: DevExpress.Dashboard.Core, DevExpress.WindowsDesktop.Dashboard.Core

Declaration

public class FormatConditionBar :
    FormatConditionMinMaxBase

Remarks

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.

Example

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

Imports DevExpress.DashboardCommon
Imports DevExpress.DashboardWin

Namespace Grid_IconRangeCondition
    Partial Public Class Form1
        Inherits DevExpress.XtraEditors.XtraForm

        Public Sub New()
            InitializeComponent()
            Dim dashboard As New Dashboard()
            dashboard.LoadFromXml("..\..\Data\Dashboard.xml")
            dashboardViewer1.Dashboard = dashboard
            Dim grid As GridDashboardItem = CType(dashboard.Items("gridDashboardItem1"), GridDashboardItem)
            Dim extendedPrice As GridMeasureColumn = CType(grid.Columns(1), GridMeasureColumn)

            Dim barRule As New GridItemFormatRule(extendedPrice)
            Dim barCondition As New FormatConditionBar()
            barCondition.StyleSettings = New BarStyleSettings(FormatConditionAppearanceType.PaleBlue)
            barCondition.NegativeStyleSettings = New BarStyleSettings(FormatConditionAppearanceType.PaleRed)
            barCondition.BarOptions.AllowNegativeAxis = checkBox1.Checked
            barCondition.BarOptions.DrawAxis = True
            barRule.Condition = barCondition

            grid.FormatRules.AddRange(barRule)
        End Sub

        Private Sub checkBox1_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles checkBox1.CheckedChanged
            UpdateBarOptions()
        End Sub

        Private Sub checkBox2_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles checkBox2.CheckedChanged
            UpdateBarOptions()
        End Sub

        Private Sub checkBox3_CheckedChanged(ByVal sender As Object, ByVal e As System.EventArgs) _
            Handles checkBox3.CheckedChanged
            UpdateBarOptions()
        End Sub

        Private Sub UpdateBarOptions()
            Dim grid As GridDashboardItem = CType(dashboardViewer1.Dashboard.Items(0), GridDashboardItem)
            Dim barOptions As FormatConditionBarOptions =
                CType((grid.FormatRules(0)).Condition, FormatConditionBar).BarOptions
            barOptions.AllowNegativeAxis = checkBox1.Checked
            barOptions.DrawAxis = checkBox2.Checked
            barOptions.ShowBarOnly = checkBox3.Checked
        End Sub
    End Class
End Namespace
See Also