All docs
V20.1
20.1
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.

GaugeContext Class

Provides a connection between data item containers from the Gauges section and underlying control's gauges.

Namespace: DevExpress.DashboardWin

Assembly: DevExpress.Dashboard.v20.1.Win.dll

Declaration

public class GaugeContext :
    ControlContext
Public Class GaugeContext
    Inherits ControlContext

Related API Members

The following members accept/return GaugeContext objects:

Remarks

A gauge context provides the connection between dashboard data item containers from the Gauges section and the underlying control's elements (gauge elements, or gauges). The GetDashboardItemGauge method returns Gauge that corresponds to the specified gauge element. The GetControlGauges method, in turn, gets a collection of gauge elements (the CircularGauge or LinearGauge objects) that corresponds to the specified Gauge.

For example, the Gauge dashboard item has two data item containers (the Gauges section): Extended Price and Quantity. The OrderDate (Year) series contains three values: 2014, 2015, and 2016. The image below shows the Gauge's elements that are used to define context:

win-gauge-context

When you pass the Extended Price data item container as the GetControlGauges method parameter, you get a collection of CircularGauge or LinearGauge elements that corresponds 2014, 2015, and 2016 values in return:

On the contrary, if you pass one of the CircularGauge or LinearGauge objects as the GetDashboardItemGauge method parameter, you get a Gauge object that corresponds to the opened data layer in the selected Gauge dashboard item:

The following code shows how to paint the tickmark text for circular gauges to red. The DashboardDesigner.DashboardItemControlUpdated event is used to update the Gauge's appearance.

using DevExpress.DashboardCommon;
using DevExpress.DashboardWin;
using DevExpress.XtraGauges.Core.Drawing;
using DevExpress.XtraGauges.Win.Gauges.Circular;

// ...

private void DashboardDesigner1_DashboardItemControlUpdated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) {
    if(e.GaugeControl != null) {
        DashboardDesigner designer = (DashboardDesigner)sender;
        var gaugeDashboardItem = designer.Dashboard.Items[e.DashboardItemName] as GaugeDashboardItem;
        foreach(var dashGaugeElement in gaugeDashboardItem.Gauges) {
            var gaugeCollection = e.GaugeContext.GetGaugeControlGauges(dashGaugeElement);
            if(gaugeCollection != null) {
                for(int i = 0; i < gaugeCollection.Count; i++) {
                    CircularGauge gauge = gaugeCollection[i] as CircularGauge;
                    if(gauge != null)
                        gauge.Scales[0].AppearanceTickmarkText.TextBrush = new SolidBrushObject(Color.Red);
                }
            }
        }
    }
}

Inheritance

See Also