Associating a legend with a ChartArea - Is Legend or LegendName better?

2 posts, 1 answers
  1. David
    David avatar
    57 posts
    Member since:
    Apr 2011

    Posted 29 Jul 2011 Link to this post


    Reviewing the documentation and samples, I've noticed two different ways of associating a legend with a chart area. Given I have defined:

    <telerik:ChartLegend x:Name="legend">

    I can either associate with a chart area with LegendName:

    <telerik:ChartArea LegendName="legend">

    or bind it to the Legend property:

    <telerik:ChartArea Legend="{Binding ElementName=legend}">

    Which is the preferred way to associate a chart legend? Are there advantages/disadvantages with either way?

    Kind regards,
  2. Answer
    Peshito avatar
    524 posts

    Posted 03 Aug 2011 Link to this post

    Hi David,

    By default, the RadChart.DefaultView.ChartLegend is associated with the RadChart.DefaultView.ChartArea. When you predefine the DefaultView of the RadChart, the LegendName property of the ChartArea needs to be set to the name of the newly created ChartLegend.

       <telerik:ChartLegend x:Name="legend" />
    The ChartArea should have the same LegendName:
    <telerik:ChartArea LegendName="legend">

    The preferred way is:
    <telerik:ChartArea LegendName="legend">

    More about chart legends can be found here.

    Kind regards,
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
Back to Top