Comparative Measure with label

2 posts, 0 answers
  1. David Ribb
    David Ribb avatar
    16 posts
    Member since:
    Aug 2012

    Posted 21 Mar 2012 Link to this post

    I would like to add some static text to the Comparative Measure element.  I have re-templated the bullet graph, but my attempts to add the text does not seem to work.  I would like the text to float at the top right of the line.  Is this possible?

    Here is my style template:

    <Style x:Key="RadHorizontalBulletGraphStyle" TargetType="telerik:RadHorizontalBulletGraph">
        <Setter Property="ComparativeMeasureThickness" Value="1"/>
        <Setter Property="FontSize" Value="10"/>
        <Setter Property="Template">
                <ControlTemplate TargetType="telerik:RadHorizontalBulletGraph">
                            <RowDefinition Height="5*"/>
                            <RowDefinition Height="5*"/>
                        <Border BorderBrush="{TemplateBinding BorderBrush}" BorderThickness="{TemplateBinding BorderThickness}" Background="White" Grid.Row="0">
                                        <Style TargetType="telerik:BarItem">
                                            <Setter Property="LengthPercent" Value="1" />
                                        <RowDefinition Height="5*" />
                                        <RowDefinition Height="5*" />
                                    <telerik:FeaturedMeasurePresenter Grid.Row="0" Content="{TemplateBinding FeaturedMeasureInternal}" Margin="0,5" />
                                    <telerik:FeaturedMeasurePresenter Grid.Row="1" Content="{TemplateBinding ProjectedMeasureInternal}" Margin="0,5"  />
                                <StackPanel HorizontalAlignment="Stretch">
                                    <telerik:ComparativeMeasuresContainer ChildrenSource="{TemplateBinding MergedComparativeMeasures}" Range="{TemplateBinding Range}" Margin="-15" />
                        <telerik:QuantitativeScaleContainer Grid.Row="1" TextFormatString="{TemplateBinding TextFormatString}" Visibility="{TemplateBinding QuantitativeScaleVisibility}" Opacity="0.5" RenderTransformOrigin="0.5,0.5" Range="{TemplateBinding Range}"  >
                                <TranslateTransform Y="5"/>
    <SolidColorBrush x:Key="ActualBrush" Color="Green" />
    <SolidColorBrush x:Key="TargetBrush" Color="Red" />

    And here is my control definition:

    <telerik:RadHorizontalBulletGraph TextFormatString="${0}"
                                      Style="{StaticResource RadHorizontalBulletGraphStyle}"
                                      FeaturedMeasureBrush="{StaticResource ActualBrush}"
                                      ProjectedValueBrush="{StaticResource TargetBrush}"
                                      Step="200" />
  2. Yavor
    Yavor avatar
    401 posts

    Posted 26 Mar 2012 Link to this post

    Hi David,

    We have designed the bullet graph to follow Stephen Few design specification and unfortunately adding text labels next to the comparative measures is not supported.

    Comparative measures are represented visually by a RectangleItem object. This object is positioned and measured in code behind. Adding a text label will make the item too large for the space that the bulletgraph has reserved for the comparative measure.

    Kind regards,
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top