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

Sparse datapoint (item) labels?

1 Answer 57 Views
Chart
This is a migrated thread and some comments may be shown as answers.
EM
Top achievements
Rank 1
EM asked on 06 Jul 2011, 02:36 PM
Hello,

I'm interested in selectively showing or hiding labels for specific datapoint in my series.  I have a column called 'LabelVisible' on the underlying data in my view model that contains a boolean value designed to control the datapoint's label visibilty in the series.  True means the label should be visible on the data point, false means that the label should not be displayed.

The underlying data is bound to the series via the ItemsSource property on the chart.

I haven't found a way to control the visibility of individual labels at the data point level - it seems to be an all or nothing option for the entire series through the ShowItemLabels property on the LineSeriesDefinition and AreaSeriesDefinition that I use in this case.

Based on other forum posts, I'm assuming I need to go with a custom template for the item label object and bind its visibility to my boolean column via a converter.  However I'm not sure which object I need to re-template, nor how to setup the new template so objects in it bind to a property that isn't in the template (TemplateBinding) but in the underlying bound data.  

An example on how to do this would be great - unless a simpler solution exists. 

Regards,

EM

1 Answer, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 08 Jul 2011, 10:05 AM
Hi Etienne,

Indeed you are right - you can either show the Labels for all Series Items or for none of them. However you can use the MVVM approach as described in our help topic to show labels per chosen Items only. 

Regards,
Evgenia
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

Tags
Chart
Asked by
EM
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Share this question
or