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

[Solved] Stacked Chart in Windows8 App

1 Answer 31 Views
Chart for XAML
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Nitin
Top achievements
Rank 1
Nitin asked on 29 May 2013, 11:18 PM
Hi ,

I am facing an issue where : In the stacked chart we are comparing two values i.e. current vs. full day  , where  we have values showing  as labels on chart.. So what I need is that I want to hide one of the label value on the bars. if I set visibility = false ; it hides both the label values . So can I hide one label value from the stacked chart.


Thanks,
Nitin

1 Answer, 1 is accepted

Sort by
0
Rosy Topchiyska
Telerik team
answered on 30 May 2013, 01:39 PM
Hi Nitin,

Thank you for contacting us.

I can suggest using TemplateSelector for the labels. You can define a class inheriting the DataTemplateSelector class:

public class LabelTemplateSelctor : DataTemplateSelector
{
  protected override DataTemplate SelectTemplateCore(object item, DependencyObject container)
  {
    if ( put your logic for empty template here )
    {
      return new DataTemplate();
    }
    return null;
  }
}

You have to override the SelectTemplateCore method where you can provide your custom logic for displaying the labels and if you return null then the default template will be used.Then you can use this class in the TemplateSelector of your chart:

<telerik:BarSeries.LabelDefinitions>.
  <telerik:ChartSeriesLabelDefinition>
    <telerik:ChartSeriesLabelDefinition.TemplateSelector>
      <local:LabelTemplateSelctor/>                     
    </telerik:ChartSeriesLabelDefinition.TemplateSelector>
  </telerik:ChartSeriesLabelDefinition>
</telerik:BarSeries.LabelDefinitions>

Let me know if this works for you.


Regards,
Rositsa Topchiyska
Telerik
Have a suggestion or face a problem - you can use the Ideas & Feedback portal to submit ideas, feedback and vote for them.
Tags
Chart for XAML
Asked by
Nitin
Top achievements
Rank 1
Answers by
Rosy Topchiyska
Telerik team
Share this question
or