Q. Can I rotate the scale while keeping the pointer stationary?
A. You can use of the StartAngle property of the Scale object to rotate the scale in your gauge. With some help from geometry, you will know how many degrees to rotate the scale.
The sample code for this article calculates the angles and forces the pointer to point upward using this code:
CircularScale scale = GaugeContainer1.CircularGauges[0].Scales[0]; double range = scale.Maximum - scale.Minimum; double rotateAngle = val / range * scale.SweepAngle; if (rotateAngle < 180) rotateAngle = 180 - rotateAngle; else rotateAngle = 180 + (360 - rotateAngle); scale.StartAngle = (float)rotateAngle;
This code is good if your scale does not have starting or ending points, such as a standard compass.
You can also use this code if your gauge has a very confined space and only a small section can be shown. In that case, you can position your gauge manually to show only the top part where the pointer is located. Your data can then be visualized without sacrificing too much of your screen real estate.
Demo code, C# solutionDemo code, VB.NET solution
For information on DUNDAS's products and services, please send e-mail to sales@dundas.com, phone us at 416-467-5100, 800-463-1492, or FAX your request to 416-422-4801.
Copyright © 2007 Dundas Data Visualization, Inc. and others. Please observe our terms of use.