All docs
V20.2
20.2
20.1
The page you are viewing does not exist in version 20.1. This link will take you to the root page.
19.2
The page you are viewing does not exist in version 19.2. This link will take you to the root page.
19.1
The page you are viewing does not exist in version 19.1. This link will take you to the root page.
18.2
The page you are viewing does not exist in version 18.2. This link will take you to the root page.
18.1
The page you are viewing does not exist in version 18.1. This link will take you to the root page.
17.2
The page you are viewing does not exist in version 17.2. This link will take you to the root page.

ChartItemFormatRule Class

A format rule that is used to apply conditional formatting to the Chart dashboard item.

Namespace: DevExpress.DashboardCommon

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

Declaration

public class ChartItemFormatRule :
    ChartItemFormatRuleBase
Public Class ChartItemFormatRule
    Inherits ChartItemFormatRuleBase

Remarks

View Example: How to Apply Conditional Formatting to the Chart Dashboard Item

Create a ChartItemFormatRule object and specify its settings to add a format rule:

Set ChartItemFormatRuleBase.ShowInLegend property to true to display a rule in a chart's legend. Use the ChartItemFormatRuleBase.DisplayName property to specify the rule's caption that is displayed in a legend.

The following code snippet shows how to apply the Gradient Range and Value rules to the Chart Dashboard item:

public Form1() {
    InitializeComponent();
    ChartDashboardItem chart1 = (ChartDashboardItem)dashboardDesigner1.Dashboard.Items["chartDashboardItem1"];
    ChartDashboardItem chart2 = (ChartDashboardItem)dashboardDesigner1.Dashboard.Items["chartDashboardItem2"];
    AddFormatRulesToBarSeries(chart1);
    AddFormatRulesToLineSeries(chart2);
}
public void AddFormatRulesToBarSeries(ChartDashboardItem chart) {
    SimpleSeries series = chart.Panes[0].Series[0] as SimpleSeries;
    ChartItemFormatRule gradientRule = new ChartItemFormatRule(series.Value, series);
    FormatConditionRangeGradient condition = new FormatConditionRangeGradient(FormatConditionRangeGradientPredefinedType.RedBlue);
    gradientRule.Condition = condition;
    gradientRule.ShowInLegend = false;
    chart.FormatRules.Add(gradientRule);
}
public void AddFormatRulesToLineSeries(ChartDashboardItem chart) {
    SimpleSeries series = chart.Panes[0].Series[0] as SimpleSeries;
    ChartItemFormatRule valueRule1 = new ChartItemFormatRule(series.Value, series);
    FormatConditionValue valueCondition1 = new FormatConditionValue(DashboardFormatCondition.Greater, 3000);
    valueCondition1.StyleSettings = new ColorStyleSettings(Color.Green);
    valueRule1.Condition = valueCondition1;
    valueRule1.ShowInLegend = true;
    valueRule1.Description = "UnitPrice greater than $3K";
    chart.FormatRules.Add(valueRule1);
}
See Also