xtrareports-devexpress-dot-xtrareports-dot-ui.md
A control that allows you to embed graphical gauges in a report.
Namespace : DevExpress.XtraReports.UI
Assembly : DevExpress.XtraReports.v25.2.dll
NuGet Package : DevExpress.Reporting.Core
public class XRGauge :
XRControl
Public Class XRGauge
Inherits XRControl
The following members return XRGauge objects:
To add a gauge to a report, drag the XRGauge item from the DX:25.2: Report Controls Toolbox tab and drop the item onto the report.
Warning
The XRGauge export is unavailable in applications that use the System.Drawing.Common package v7 and higher in non-Windows environments.
The following properties allow you to customize the gauge appearance:
|
A linear horizontal dark gauge
|
A circular half light gauge
| | --- | --- | |
|
|
Note
The above XRGauge properties allow you to make basic changes to gauge appearance. Advanced gauge customization is available in code only. Refer to the following repository for information on advanced gauge customization: Advanced Gauge Customization
The Actual Value property allows you to specify the value a gauge displays. The Target Value property sets the position of the target value marker. The Maximum and Minimum properties specify the gauge’s maximum and minimum value.
The following example shows a circular gauge whose Actual Value , Target Value , Maximum , and Minimum properties are set to 3, 7, 0, and 10 respectively.
You can click the control’s smart tag to bind the gauge’s Actual Value , Target Value , Maximum , and Minimum properties to data. In the invoked action list, expand the drop-down Expression list for one of the properties and specify the data field or expression to which the property should be bound.
The following example demonstrates how to create the XRGauge control in code and bind it to data. In this example, the report is bound to the Northwind database and the Product table is specified as a data member.
using DevExpress.XtraGauges.Core.Customization;
using DevExpress.XtraReports.UI;
//...
// Create a gauge and customize its appearance.
var gauge = new XRGauge() {
ViewType = DashboardGaugeType.Linear,
ViewStyle = DashboardGaugeStyle.Horizontal,
ViewTheme = DashboardGaugeTheme.FlatDark,
Minimum = 0, Maximum = 50
};
// Specify an expression for the gauge's "ActualValue" property.
gauge.ExpressionBindings.Add(
new ExpressionBinding("ActualValue", "[UnitPrice]")
);
Imports DevExpress.XtraGauges.Core.Customization
Imports DevExpress.XtraReports.UI
'...
' Create a gauge and customize its appearance.
Private gauge = New XRGauge() With {
.ViewType = DashboardGaugeType.Linear,
.ViewStyle = DashboardGaugeStyle.Horizontal,
.ViewTheme = DashboardGaugeTheme.FlatDark,
.Minimum = 0,
.Maximum = 50
}
' Specify an expression for the gauge's "ActualValue" property.
gauge.ExpressionBindings.Add(New ExpressionBinding("ActualValue", "[UnitPrice]"))
Object MarshalByRefObject Component XRControl XRGauge
See Also