Hide Item Labels on a Spline Chart in WPF

2 posts, 1 answers
  1. Timothy Corey
    Timothy Corey avatar
    3 posts
    Member since:
    May 2010

    Posted 29 Apr 2011 Link to this post

    I'm trying to hide the item labels on my chart.  There are 52 items on one chart, so the item labels hide the actual line on the chart.  I can't figure out how to turn them off.  The data is generated from the code-behind.  Here is a snippet that shows how I am creating the chart data:

    SeriesMapping mySeries = new SeriesMapping();
    mySeries.LegendLabel = "Current Year Cash Balance";
    mySeries.SeriesDefinition = new SplineSeriesDefinition();
    mySeries.SeriesDefinition.Appearance.StrokeThickness = 3;
    mySeries.ItemMappings.Add(new ItemMapping("CashBalance", DataPointMember.YValue));
    mySeries.ItemMappings.Add(new ItemMapping("Week", DataPointMember.XCategory));
    secondaryChart.DefaultSeriesDefinition.ShowItemLabels = false;
    secondaryChart.ItemsSource = cashBalanceData.Tables["currentCashBalance"];

    Is there a simple way to do this?  Demo code would be most appreciated.  I would prefer the option to do it either in the XAML or the code-behind, since I might want to set the default in the XAML but then change it in the code-behind.
  2. Answer
    Giuseppe avatar
    2363 posts

    Posted 02 May 2011 Link to this post

    Hi Timothy Corey,

    Indeed the desired effect can be accomplished by setting the SeriesDefinition.ShowItemLabels property to false but note that you need to set it on the series definition that you are adding to the RadChart.SeriesMappings collection (i.e. mySeries.SeriesDefinition) and not on RadChart.DefaultSeriesDefinition (DefaultSeriesDefinition is only used if no manual series mappings have been set).

    Hope this helps.

    Best wishes,
    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
Back to Top