Not able to reverse the legend order

Thread is closed for posting
3 posts, 0 answers
  1. Santosh
    Santosh avatar
    7 posts
    Member since:
    Jun 2013

    Posted 25 Sep 2013 Link to this post

    Hi Team,

    I am not able to reverse the legend order in the radchart. Please help me fix it.
  2. Petar Kirov
    Admin
    Petar Kirov avatar
    425 posts

    Posted 30 Sep 2013 Link to this post

    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.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Santosh
    Santosh avatar
    7 posts
    Member since:
    Jun 2013

    Posted 01 Oct 2013 Link to this post

    Thank you. It worked.
Back to Top