Float values for min and max

4 posts, 0 answers
  1. Anj
    Anj avatar
    8 posts
    Member since:
    Jul 2010

    Posted 01 Mar 2011 Link to this post

    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?
  2. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 03 Mar 2011 Link to this post

    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!
  3. DevCraft banner
  4. Anj
    Anj avatar
    8 posts
    Member since:
    Jul 2010

    Posted 06 Mar 2011 Link to this post

    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?
  5. Andrey
    Admin
    Andrey avatar
    1681 posts

    Posted 09 Mar 2011 Link to this post

    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!
Back to Top