FormatConditionBar Class
A format condition used to visualize numeric values using bars.
Namespace: DevExpress.DashboardCommon
Assembly: DevExpress.Dashboard.v24.1.Core.dll
NuGet Package: DevExpress.Dashboard.Core
Declaration
Remarks
To create a format condition to display bars with lengths proportional to corresponding values, do the following.
- Specify colors for bars corresponding to positive and negative numeric values using the FormatConditionBar.StyleSettings and FormatConditionBar.NegativeStyleSettings, respectively.
- If necessary, specify values corresponding to the shortest or longest bars using the FormatConditionMinMaxBase.Minimum and FormatConditionMinMaxBase.Maximum properties. Use the FormatConditionMinMaxBase.MinimumType and FormatConditionMinMaxBase.MaximumType properties to specify the type of these values.
- Optionally, specify options related to bar visualizing using the FormatConditionBar.BarOptions property.
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.
using DevExpress.DashboardCommon;
namespace Grid_FormatRules {
public partial class BarConditionForm : DevExpress.XtraEditors.XtraForm {
public BarConditionForm() {
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 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;
grid.FormatRules.AddRange(barRule);
}
private void checkBox1_CheckedChanged(object sender, System.EventArgs e) {
UpdateBarOptions();
}
private void checkBox2_CheckedChanged(object sender, System.EventArgs e) {
UpdateBarOptions();
}
private void checkBox3_CheckedChanged(object sender, System.EventArgs e) {
UpdateBarOptions();
}
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;
}
}
}
Inheritance
See Also