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

Programatically Created Gauges not showing Scale

1 Answer 83 Views
Gauge
This is a migrated thread and some comments may be shown as answers.
David Gunderson
Top achievements
Rank 1
David Gunderson asked on 28 Apr 2010, 08:23 PM

So i have something in the wrong place? Looks right to me but the Scale is still not being displayed.

Partial Public Class MainPage  
    Inherits UserControl  
    Private autoRange As RadialRange  
    Private AutoRangeR As RadialRange  
    Private AutoRangeY As RadialRange  
    Private autoscale As RadialScale  
    Private autoneedle As Needle  
    Public Sub New()  
 
        InitializeComponent()  
 
 
        AddHandler Loaded, AddressOf SilverlightControl_Loaded  
    End Sub 
    Private Sub SilverlightControl_Loaded(ByVal sender As ObjectByVal e As RoutedEventArgs)  
 
        ' create the RadGauge   
        Dim radGauge = New RadGauge()  
        ' add RadGauge to the LayoutRoot   
        LayoutRoot.Children.Add(radGauge)  
        ' create the RadialGauge   
        Dim gauge = New RadialGauge()  
 
 
        ' add RadialGauge to the RadGauge   
        radGauge.Content = gauge  
 
 
        ' create the RadialScale   
        autoscale = New RadialScale()  
        autoscale.Name = "RadialScale22" 
        autoscale.Min = 0  
        autoscale.Max = 100  
        autoscale.MinorTicks = 2  
        autoscale.MiddleTicks = 2  
        autoscale.Radius = 75  
 
        ' add RadialScale to the RadialGauge   
        gauge.Items.Add(autoscale)  
 
        Dim RangeList1 = New RangeList()  
        autoscale.Items.Add(RangeList1)  
 
        'Create the Range Green  
        autoRange = New RadialRange()  
        autoRange.Name = "Green" 
        autoRange.StartWidth = 0.06  
        autoRange.EndWidth = 0.06  
        autoRange.Min = 90  
        autoRange.Max = 100  
        autoRange.Background = New SolidColorBrush(Colors.Green)  
 
        autoscale.Ranges.Add(autoRange)  
 
 
        'Create the Range Yellow  
        AutoRangeY = New RadialRange()  
        autoRangeY.Name = "Yellow" 
        autoRangeY.StartWidth = 0.06  
        autoRangeY.EndWidth = 0.06  
        autoRangeY.Min = 40  
        autoRangeY.Max = 50  
        autoRangeY.Background = New SolidColorBrush(Colors.Yellow)  
        autoscale.Ranges.Add(autoRangeY)  
 
 
        'Create the Range Red  
        AutoRangeR = New RadialRange()  
        autoRangeR.Name = "Red" 
        autoRangeR.StartWidth = 0.06  
        autoRangeR.EndWidth = 0.06  
        autoRangeR.Min = 0  
        autoRangeR.Max = 10  
        autoRangeR.Background = New SolidColorBrush(Colors.Red)  
        autoscale.Ranges.Add(autoRangeR)  
 
 
 
        Dim IndicatorList1 = New IndicatorList()  
        autoscale.Items.Add(IndicatorList1)  
        ' create the Needle   
        autoneedle = New Needle()  
        autoneedle.Value = 0  
        ' add needle to indicators collection   
        autoscale.Indicators.Add(autoneedle)  
 
    End Sub 

1 Answer, 1 is accepted

Sort by
0
Andrey
Telerik team
answered on 29 Apr 2010, 12:51 PM

Hi David,

The problem is in the following line:
autoscale.Radius = 75

The Radius property value is a radius of the scale relative to its container. It should be between 0 and 1.
The correct value would be 0.75.


Kind regards,
Andrey Murzov
the Telerik team


Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items.
Tags
Gauge
Asked by
David Gunderson
Top achievements
Rank 1
Answers by
Andrey
Telerik team
Share this question
or