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

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

1 Answer 33 Views
Chart
This is a migrated thread and some comments may be shown as answers.
David
Top achievements
Rank 2
David asked on 29 Jul 2011, 02:30 PM
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.

1 Answer, 1 is accepted

Sort by
0
Accepted
Peshito
Telerik team
answered on 03 Aug 2011, 11:16 AM
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 >>
Tags
Chart
Asked by
David
Top achievements
Rank 2
Answers by
Peshito
Telerik team
Share this question
or