This is a migrated thread and some comments may be shown as answers.

Hide Item Labels on a Spline Chart in WPF

1 Answer 90 Views
Chart
This is a migrated thread and some comments may be shown as answers.
Timothy Corey
Top achievements
Rank 1
Timothy Corey asked on 29 Apr 2011, 10:54 PM
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.SeriesMappings.Add(mySeries);
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Giuseppe
Telerik team
answered on 02 May 2011, 01:44 PM
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,
Giuseppe
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
Tags
Chart
Asked by
Timothy Corey
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or