This is a migrated thread and some comments may be shown as answers.

Float values for min and max

3 Answers 125 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
Anj
Top achievements
Rank 1
Anj asked on 01 Mar 2011, 10:25 AM
I want to use float values for min and max. I can set float values in the code, but on the UI they show up as rounded integers. Is there a way I can display float value ranges on the gauge?

3 Answers, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 03 Mar 2011, 03:43 PM
Hi Anj,

You can use the Format property of label properties element to show float values in labels.
The sample code is below.
<telerik:RadGauge Width="300" Height="300">
    <telerik:RadialGauge>
        <telerik:RadialScale x:Name="radialScale"
                             Min="0" Max="1.2"
                             MajorTickStep="0.1">
            <telerik:RadialScale.Label>
                 <telerik:LabelProperties Format="{}{0:F1}" />
             </telerik:RadialScale.Label>
             <telerik:IndicatorList>
                 <telerik:Needle x:Name="needle"
                                 IsAnimated="True"
                                 Value="0.75"/>
             </telerik:IndicatorList>
         </telerik:RadialScale>
     </telerik:RadialGauge>
</telerik:RadGauge>

For more information please take a look to the Format topic of our online documentation:
http://www.telerik.com/help/silverlight/radgauge-features-labels-format.html

Best wishes,
Andrey Murzov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
0
Anj
Top achievements
Rank 1
answered on 07 Mar 2011, 05:02 AM
Thanks for the solution. It works.

Is there a way I can control the number of decimal places? With min=23.12 and max=45.67 and 3 major ticks, I have these major tick values: 26.7575, 34.395, 40.0325. Is there a way I can display say 4 decimal places for all the major ticks?
0
Andrey
Telerik team
answered on 09 Mar 2011, 10:42 AM
Hi Anj,

The Format property represents standard Silverlight format string for numbers. You can use any numeric format string instead of "F1". For example "F4" will show 4 decimal digits:

<telerik:RadialScale.Label
   <telerik:LabelProperties Format="{}{0:F4}" /> 
</telerik:RadialScale.Label

You can find more information about standard numeric format strings here:

http://msdn.microsoft.com/en-us/library/dwhawy9k.aspx

Kind regards,
Andrey Murzov
the Telerik team
Registration for Q1 2011 What’s New Webinar Week is now open. Mark your calendar for the week starting March 21st and book your seat for a walk through all the exciting stuff we ship with the new release!
Tags
Gauge
Asked by
Anj
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Anj
Top achievements
Rank 1
Share this question
or