Dundas Data Visualization Support Site
Dundas Support Site Home  |  Contact Us  |  Dundas Home  
Contact Us via Email
Home

Can I rotate the scale while keeping the pointer stationary?

 

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.

A compass gauge

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.

 

Additional Downloads:

Demo code, C# solution
Demo code, VB.NET solution
PoorExcellent