BulletGraph setting AdditionalComparativeMeasures Value in code behind

4 posts, 0 answers
  1. Nick
    Nick avatar
    3 posts
    Member since:
    Jul 2012

    Posted 19 Feb 2013 Link to this post

    Hello,

    I have the following XAML:
    <telerikDataVisualization:RadBulletGraph.AdditionalComparativeMeasures>
        <telerikDataVisualization:BulletGraphComparativeMeasure x:Name="BGCM9" Value="2.5"
                                                Template="{StaticResource BulletGraphAdornerTemplate}"/>
    </telerikDataVisualization:RadBulletGraph.AdditionalComparativeMeasures>

    And I figured that in the code behind, I would be able to set the value as follows:

    BGCM9.Value = 0;


    But when I run it, I get the following error:
    An exception of type 'System.NullReferenceException' occurred in sstimer.DLL but was not handled in user code where sstimer is my app.

    No matter what value I pick, I get the same error. Can someone point me in the right direction here?

    Thanks,
    Nick

  2. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 19 Feb 2013 Link to this post

    Hi Nick,

    Thanks for writing.
    This is a known bug in the Silverlight framework. RadChart also suffers from it. You can find an explanation here. Basically, you need to iterate through the additional comparative measures to find your object. 

    All the best,
    Victor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
  3. DevCraft banner
  4. Nick
    Nick avatar
    3 posts
    Member since:
    Jul 2012

    Posted 19 Feb 2013 Link to this post

    I have been searching high and low for examples on how I can achieve this, but I cannot... Have you any other suggestions?

    <telerikDataVisualization:RadBulletGraph x:Name="RBGSummary" Grid.Row="1"
                             Height="70"
                             LabelTemplate="{StaticResource BulletGraphLabelTemplate}"
                             TickTemplate="{StaticResource BulletGraphTickTemplate}"
                             TickStep="1"
                             LabelStep=".5"
                             StartValue=".5"
                             EndValue="5"
                             LabelOffset="12"
                             Margin="12,15,12,0"
                             ComparativeMeasure="4.25"
                             FeaturedMeasureBrush="{StaticResource PhoneForegroundBrush}"
                             FeaturedMeasureAlternativeTemplate="{StaticResource FeaturedMeasureAlternativeTemplate}"
                             FeaturedMeasure="2"
                             FeaturedMeasureThickness="6"
                             ComparativeMeasureTemplate="{StaticResource BulletGraphComparativeMeasureTemplate}">
     
        <telerikDataVisualization:RadBulletGraph.QualitativeRanges>
            <telerikDataVisualization:BarIndicatorSegment Stroke="{StaticResource CriticalBrush}"
                                          Thickness="23"/>
            <telerikDataVisualization:BarIndicatorSegment Stroke="{StaticResource SatisfactoryBrush}"
                                          Thickness="23"/>
            <telerikDataVisualization:BarIndicatorSegment Stroke="{StaticResource GoodBrush}"
                                          Thickness="23"
                                          Length=".25"/>
        </telerikDataVisualization:RadBulletGraph.QualitativeRanges>
     
        <telerikDataVisualization:RadBulletGraph.AdditionalComparativeMeasures>
            <telerikDataVisualization:BulletGraphComparativeMeasure Value="2.7"
                                                    Template="{StaticResource BulletGraphAdornerTemplate}"/>
            <!--<telerikDataVisualization:BulletGraphComparativeMeasure Value="3.7"
                                                    Template="{StaticResource BulletGraphAdornerTemplate}"/>-->
        </telerikDataVisualization:RadBulletGraph.AdditionalComparativeMeasures>
    </telerikDataVisualization:RadBulletGraph>

    I am trying to set that value of 2.7 to what I want in the code behind.

    Thanks,
  5. Victor
    Admin
    Victor avatar
    1351 posts

    Posted 19 Feb 2013 Link to this post

    Hi Nick,

    Here is an example of how you can set the value of any additional comparative measure:

    BulletGraphComparativeMeasure BGCM9 = bulletGraph.AdditionalComparativeMeasures.Single<BulletGraphComparativeMeasure>((measure) => measure.Name == "BGCM9");
    BGCM9.Value = 0;

    Please note that you need to add using System.Linq; to the beginning of your source file so that you can take advantage of the Single<> extension method. The other approach would be to iterate of the the collection and compare all measures manually.All the best,
    Victor
    the Telerik team
    Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Back to Top