LineSeries: how to show some labels, some not?

3 posts, 1 answers
  1. Michael
    Michael avatar
    3 posts
    Member since:
    May 2012

    Posted 06 Dec 2012 Link to this post


    I would like my chart to consists of a LineSeries that does not have labels shown on every node. For this, I have bound the ItemsSource of the LineSeries to an ObservableCollection<MyCrazyLineNode>. MyCrazyLineNode has Properties for the Value, the Category and an additional Property "IsValueVisible".

    I tried to accomblish this by setting "ShowLabels" to "False" and define my own labels in the PointTemplate.
    My code looks similar to this:
    <telerik:LineSeries ItemsSource="{Binding MyCrazyLineNodes}" ValueBinding="Value" CategoryBinding="Category" ShowLabels="False">
            <Canvas Margin="0,10,0,0" Visibility="{Binding IsValueVisible, [Converter stuff...}">
              <TextBlock Text="{Binding Value}" />
            <Path Data="M4,0 L8,4 L4,8 L0,4 Z" Fill="Red" Width="8" Height="8" Stretch="Fill" />
      <AxisStuffAndSoOn />

    However, this does not work, because I cannot bind to the Property IsValueVisible.
    How can I do what I want? I hope my problem is understandable. ;-)

    Best Regards
  2. Answer
    Missing user
    Missing user avatar

    Posted 11 Dec 2012 Link to this post

    Hi Michael,

    The easiest way to do this is to create a new property (which is either an empty string or the value you need to show), use the LabelDefinitions and set the Binding property. Please refer to the attached sample project.

    All the best,
    Ivan N.
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

  3. DevCraft R3 2016 release webinar banner
  4. Michael
    Michael avatar
    3 posts
    Member since:
    May 2012

    Posted 12 Dec 2012 Link to this post

    Thanks a lot!

    Best regards,
    Michael Hilus
Back to Top