Labels disappear

3 posts, 1 answers
  1. Grtjn
    Grtjn avatar
    129 posts
    Member since:
    Feb 2010

    Posted 14 Apr 2010 Link to this post

    Hi all,

    I just created a halfcircle radgauge using the Q1 2010 version.
    The problem I have is that my labels get stuck in the border of this gauge (shown in the attached image)

    This is the code for my radgauge:
    RadGauge radgauge = (FindName((e.Result as RadGaugeData).XAMLNaam) as RadGauge);  
     
                    if ((e.Result as RadGaugeData).Visible)  
                    {  
                        radgauge.Visibility = System.Windows.Visibility.Visible;  
                    }  
                    else  
                    {  
                        radgauge.Visibility = System.Windows.Visibility.Collapsed;  
                    }  
     
     
                    RadialGauge gauge = new RadialGauge()  
                    {  
                        MaxHeight = 100,  
                        MaxWidth = 175                      
                    };  
                    radgauge.Content = gauge;  
                    RadialScale scale = new RadialScale()  
                    {  
                        Min = (e.Result as RadGaugeData).ScaleMin,  
                        Max = (e.Result as RadGaugeData).ScaleMax,  
                        //StartAngle = 180,  
                        //SweepAngle = 180,  
                        IsLogarithmic = false,  
                        MajorTickStep = (e.Result as RadGaugeData).TickStep,  
                        //MiddleTicks = 5,  
                        LabelRotationModeLabelRotationMode = LabelRotationMode.None,  
                        Location = ScaleObjectLocation.OverInside  
                    };  
                    scale.MiddleTick.Length = 0.08;  
                    scale.MajorTick.Length = 0.1;  
                    gauge.Items.Add(scale);  
     
                    ColorConverter converter = new ColorConverter();  
                    SolidColorBrush lowcol = converter.getSolidColorBrushFromString((e.Result as RadGaugeData).ColorLow);  
                    SolidColorBrush medcol = converter.getSolidColorBrushFromString((e.Result as RadGaugeData).ColorMed);  
                    SolidColorBrush highcol = converter.getSolidColorBrushFromString((e.Result as RadGaugeData).ColorHigh);  
     
                    scale.Ranges.Add(new RadialRange()  
                    {  
                        Min = (e.Result as RadGaugeData).ScaleMin,  
                        Max = (e.Result as RadGaugeData).LowTresHold,  
                        Location = ScaleObjectLocation.Inside,  
                        StartWidth = 0.05,  
                        EndWidth = 0.1,  
                        Background = lowcol 
                    });  
                    scale.Ranges.Add(new RadialRange()  
                    {  
                        Min = (e.Result as RadGaugeData).LowTresHold,  
                        Max = (e.Result as RadGaugeData).HighTresHold,  
                        Location = ScaleObjectLocation.Inside,  
                        StartWidth = 0.1,  
                        EndWidth = 0.15,  
                        Background = medcol 
                    });  
                    scale.Ranges.Add(new RadialRange()  
                    {  
                        Min = (e.Result as RadGaugeData).HighTresHold,  
                        Max = (e.Result as RadGaugeData).ScaleMax,  
                        Location = ScaleObjectLocation.Inside,  
                        StartWidth = 0.15,  
                        EndWidth = 0.2,  
                        Background = highcol 
                    });   
     
                    Needle ndl = new Needle()  
                    {  
                        Location = ScaleObjectLocation.CenterInside,  
                        IsAnimated = true,  
                        Value = (e.Result as RadGaugeData).Waarde,  
                        //Background = new SolidColorBrush(Colors.Red),  
                        TooltipFormat = "{0:F2}" 
                    };  
                    var uri = new Uri("/Telerik.Windows.Controls.Gauge;component/Themes/generic.xaml", UriKind.Relative);  
                    var dictionary = new ResourceDictionary();  
                    dictionary.Source = uri;  
                    if (dictionary.Contains("RadialGaugeHalfCircleNStyle"))  
                    {  
                        gauge.Style = dictionary["RadialGaugeHalfCircleNStyle"] as Style;  
                    }  
                    if (dictionary.Contains("RadialScaleHalfCircleNStyle"))  
                    {  
                        scale.Style = dictionary["RadialScaleHalfCircleNStyle"] as Style;  
                    }  
                    scale.Indicators.Add(ndl);  
     
                    String RGTitel = (e.Result as RadGaugeData).XAMLNaam;  
                    TextBlock TargetBlock = new TextBlock();  
                    if (RGTitel == "rg1")  
                        TargetBlock = tb1;  
                    else if (RGTitel == "rg2")  
                        TargetBlock = tb2;  
                    else if (RGTitel == "rg3")  
                        TargetBlock = tb3;  
                    else if (RGTitel == "rg4")  
                        TargetBlock = tb4;  
                    else if (RGTitel == "rg5")  
                        TargetBlock = tb5;  
                    TargetBlock.Text = (e.Result as RadGaugeData).Titel; 
    And Location = ScaleObjectLocation.OverInside did not do the trick...

    Any help ?

    Kind regards,

    Gertjan
  2. Answer
    Sia
    Admin
    Sia avatar
    667 posts

    Posted 16 Apr 2010 Link to this post

    Hi Grtjn,

    The default values for some properties doesn't fit in you scenario. There are several possible solutions of the problem:
    • set smaller Radius to the RadialScale = 1.15 or less
    • change the Location of the Labels to Inside and make the Location=Outside for all RadialRange elements
    • set FontSize=8 and Offset=-0.07 for the Labels
    Just play with some of these properties and find the solution which is the most appropriate for your case.

    Hope this helps.
    Best wishes,
    Sia
    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.
  3. DevCraft banner
  4. Grtjn
    Grtjn avatar
    129 posts
    Member since:
    Feb 2010

    Posted 19 Apr 2010 Link to this post

    Thanks Sia, this did solve my problem !

    Kind regards,

    Gertjan
Back to Top