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

Not able to reverse the legend order

2 Answers 39 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Santosh
Top achievements
Rank 1
Santosh asked on 25 Sep 2013, 09:34 AM
Hi Team,

I am not able to reverse the legend order in the radchart. Please help me fix it.

2 Answers, 1 is accepted

Sort by
0
Petar Kirov
Telerik team
answered on 30 Sep 2013, 01:56 PM
Hi Santosh,

You can reverse the order of RadChart's Legend items like this:
this.radChart1.BeforeLayout += Chart_BeforeLayout;
 
void Chart_BeforeLayout(object sender, EventArgs e)
{
    var itemsStack = new Stack<LabelItem>();
 
    foreach (var legendItem in this.chart.Legend.Items)
        itemsStack.Push(legendItem);
 
    this.chart.Legend.Items.Clear();
 
    while (itemsStack.Count > 0)
        this.chart.Legend.Items.Add(itemsStack.Pop());
}

I hope this helps.
 
Regards,
Petar Kirov
Telerik
If you want to get updates on new releases, tips and tricks and sneak peeks at our product labs directly from the developers working on the RadControls for ASP.NET AJAX, subscribe to the blog feed now.
0
Santosh
Top achievements
Rank 1
answered on 02 Oct 2013, 03:41 AM
Thank you. It worked.
Tags
Chart (Obsolete)
Asked by
Santosh
Top achievements
Rank 1
Answers by
Petar Kirov
Telerik team
Santosh
Top achievements
Rank 1
Share this question
or