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

    Hi,

    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,
    Dave.
  2. Answer
    Peshito
    Admin
    Peshito avatar
    496 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:ChartDefaultView.ChartLegend>
       <telerik:ChartLegend x:Name="legend" />
    </telerik:ChartDefaultView.ChartLegend>
    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,
    Peshito
    the Telerik team
    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top