The example shows how to customize the XRGauge
control to create a progress bar.
In the Report Designer, you can set up the basic XRGauge
settings: view, style, theme, actual and target values, minimum and maximum values. For advanced customization, you can use the XRGauge
's
Gauge
property that gives you access to the XRGauge
's internal model. The following example demonstrates how to use the Gauge
property
to create a gauge with formatted values:
XRGauge gaugeControl = new XRGauge();
IDashboardGauge gauge = gaugeControl.Gauge;
gauge.Scale.MajorTickmark.FormatString = "{0}%";
The example in this repository shows how to customize the XRGauge
control to create a progress bar:
-
Create a linear gauge:
XRGauge gauge = new XRGauge() { ViewType = DashboardGaugeType.Linear, ViewStyle = DashboardGaugeStyle.Full, SizeF = new SizeF(500, 200) };
-
Customize the gauge's elements:
IDashboardGauge gaugeControl = gauge.Gauge; var gaugeElements = gaugeControl.Elements; LinearScale linearScale = GetOrAdd<LinearScale>(gaugeElements); SetupLinearScale(linearScale); LinearScaleRangeBar rangeBar = GetOrAdd<LinearScaleRangeBar>(gaugeElements); SetupRangeBar(rangeBar); AddMarker(gaugeControl as DashboardGauge, 50f);
(you will be redirected to DevExpress.com to submit your response)