Axis Label custom DataTemplate

3 posts, 0 answers
  1. leblanc
    leblanc avatar
    56 posts
    Member since:
    Aug 2010

    Posted 15 Jun 2012 Link to this post

    I'm using RadChart and have three series defined each with an XCategory defined in ItemMappings
    <telerik:ItemMapping FieldName="CategoryX" DataPointMember="XCategory" />

    FieldName CategoryX is a partial class property which allows the X axis to have the data I want. I could probably use FormatExpressions to accomplish similar.  I need more than just a TextBlock...

    and each series is defined with 1 y value (OpenedPercentage, ClickedPercentage, DeliveredPercentage)
    <telerik:ItemMapping FieldName="OpenedPercentage" DataPointMember="YValue" />


    My attempts to replace the style of the axis label has not worked.  

    How can i provide a custom data template (a lot of controls) to the axis label that can bind to all the dataitem properties?

    I am using 2012 Q2. Thanks ahead of time!




  2. leblanc
    leblanc avatar
    56 posts
    Member since:
    Aug 2010

    Posted 17 Jun 2012 Link to this post

    In my first post I attached an image of what the view looks like today.  I want to improve the x axis label to just be an image and then use a tooltip to give you the details.

    The problem is if i try to use styles I can't bind to the item in my MVVM.

    System.Windows.Data Error: BindingExpression path error: 'CategoryX' property not found on 'Telerik.Windows.Controls.Charting.TickPoint' 'Telerik.Windows.Controls.Charting.TickPoint' (HashCode=40306186). BindingExpression: Path='CategoryX' DataItem='Telerik.Windows.Controls.Charting.TickPoint' (HashCode=40306186); target element is 'System.Windows.Controls.TextBlock' (Name=''); target property is 'ToolTip' (type 'System.Object')..

                    <Charting:AxisX MajorGridLinesVisibility="Visible" StripLinesVisibility="Visible">
                            <Charting:AxisStyles ItemLabelStyle="{StaticResource CustomLabel}" />
    <Style x:Key="CustomLabel" TargetType="TextBlock">
        <Setter Property="Width" Value="50" />
        <Setter Property="TextWrapping" Value="Wrap" />
        <Setter Property="ToolTipService.ToolTip" Value="{Binding CategoryX}" />

    How would you accomplish changing the xaxis to be an image with a tooltip with a stackpanel and multiple textboxes?

  3. Yavor
    Yavor avatar
    401 posts

    Posted 20 Jun 2012 Link to this post


    This can be achieved with RadChartView as it enables you to set custom template for your categorical axis labels. In the LabelTemplate you can put a stacked panel with multiple textboxes and images with ease.

    All the best,
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top