[DevExpress Support Team: CLONED FROM T496098: How to control scales in GaugeDashboardItem]
great, thanks, its Works…
But, my question was wrong…
I need "ranges"… using colors if possible…
do you can change this sample? thanks again!!
[DevExpress Support Team: CLONED FROM T496098: How to control scales in GaugeDashboardItem]
great, thanks, its Works…
But, my question was wrong…
I need "ranges"… using colors if possible…
do you can change this sample? thanks again!!
It is only possible to accomplish this task by accessing the underlying GaugeControl used to display the item. This approach is described in the Access to Underlying Controls help topic. I have attached a sample project demonstrating how to accomplish this task to this reply.
Note: This solution works only if a few gauges are displayed and scrolling is not required.
C#private void dashboardViewer1_DashboardItemControlCreated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) {
if (e.GaugeControl != null) {
UpdateGauge(e.GaugeControl);
}
}
private void dashboardViewer1_DashboardItemControlUpdated(object sender, DevExpress.DashboardWin.DashboardItemControlEventArgs e) {
if (e.GaugeControl != null) {
UpdateGauge(e.GaugeControl);
}
}
private static void UpdateGauge(GaugeControl gaugeControl) {
foreach (CircularGauge gauge in gaugeControl.Gauges) {
gauge.Scales[0].MaxValue = 100;
gauge.Scales[0].MajorTickCount = 6;
gauge.Scales[0].MajorTickmark.FormatString = "{0}";
gauge.Scales[0].Ranges.Add( CreateNewRange( 0, 20, Color.Red ) );
gauge.Scales[0].Ranges.Add(CreateNewRange(20, 60, Color.Yellow));
}
}
private static IRange CreateNewRange(int startValue, int endValue, Color color) {
IRange result = new ArcScaleRange();
result.AppearanceRange.ContentBrush = new SolidBrushObject(color);
result.StartValue = startValue;
result.EndValue = endValue;
result.StartThickness = 10f;
result.EndThickness = 10f;
return result;
}
Please refer to the Web dashboard - change needle color or show different colored ranges in gauge ticket for a sample project illustrating how to configure the gauge layout in a Web application.
Disclaimer: The information provided on DevExpress.com and affiliated web properties (including the DevExpress Support Center) is provided "as is" without warranty of any kind. Developer Express Inc disclaims all warranties, either express or implied, including the warranties of merchantability and fitness for a particular purpose. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.
Confidential Information: Developer Express Inc does not wish to receive, will not act to procure, nor will it solicit, confidential or proprietary materials and information from you through the DevExpress Support Center or its web properties. Any and all materials or information divulged during chats, email communications, online discussions, Support Center tickets, or made available to Developer Express Inc in any manner will be deemed NOT to be confidential by Developer Express Inc. Please refer to the DevExpress.com Website Terms of Use for more information in this regard.