GaugeMeter range

Walter,

how can we indicate the range for the Gauge Meter in GoInstrument to some other value instead of 0- 100?

I set the scale.maximize to the value I wanted but the label of the number turn into a double value

for example 4.000005 display instead of 4

I assume you mean the GraduatedScale.Maximum and .Minimum properties.

Regarding your second issue, that depends on whether you want to restrict the Indicator.Value to be a more limited set of values, or whether you just want to change the digits that are displayed on the GraduatedScale. Or maybe you want to control both.
For the former, you can set Indicator.Quantized to true and .QuantizeUnit and .QuantizeBase to values that are good for your application.
For the latter, you can set the GraduatedScale.LabelFormat property to control how the double-precision floating point number is converted to text. If you want more flexibility regarding the formatting of scale labels, you can override GraduatedScale.GetLabelString.

Hi Walter,

can you give an example how to use labelFormat.
An Example for override GetLabelString would be nice too.

I have the same problem
scale.Minimum = 0
scale.Maximum = 9

but the instrument shows me for the max display label 8.9999999 but it should be 9!
so how can i force it to an integer value for the scale label?

can you give an example how to use labelFormat.

  this.LabelFormat = "g2";

here is how that is used in the Instruments code:

    String format = this.LabelFormat;
    return val.ToString(format);

so… you can look at ToString to see what LabelFormat does.

An Example for override GetLabelString would be nice too.


See the Timeline class in the InstrumentDemo sample.