Advanced Chart Functionality

Thread is closed for posting
2 posts, 0 answers
  1. Jay
    Jay avatar
    11 posts
    Member since:
    Mar 2012

    Posted 16 Apr 2012 Link to this post

    I was wondering if i can expand the series legend box and have more information in it like the attached picture. I would like to have legend look like what it has for "top 5 spending" is it possible?
  2. Peshito
    Peshito avatar
    590 posts

    Posted 19 Apr 2012 Link to this post

    Hello Jay,

    Expanding the legend like the scenario you have described is not supported out of the box.

    In order to display custom count of legend items, you can either set them manually by wiring to the BeforeLayout event like this:
    void radChart_BeforeLayout(object sender, EventArgs e)
            radChart.Legend.Visible = true;
            LabelItem label1 = new LabelItem();
            label1.TextBlock.Text = "Label 1";
            label1.Visible = true;
            LabelItem label2 = new LabelItem();
            label2.TextBlock.Text = "Label 2";
            label2.Visible = true;
            LabelItem label3 = new LabelItem();
            label3.TextBlock.Text = "Label 3";
            label3.Visible = true;
    or you can wire the ItemDataBound event of RadChart. In the event handler you can set the Name property of each individual ChartSeriesItem -- this is the value which will appear in the legend. The event arguments will hold references to the ChartSeriesItem, ChartSeries and the underlying data. It would be similar to what's shown in this blog post, but you need to set the Name property and not the Label's text.

    Hope this helps.

    the Telerik team
    RadControls for WinForms Q1'12 release is now live! Check out what's new or download a free trial >>
Back to Top