Legends of the RadChart

3 posts, 1 answers
  1. Arvind
    Arvind avatar
    6 posts
    Member since:
    Aug 2010

    Posted 03 Aug 2010 Link to this post

    Hi,
       In RadChards, is it possible to display the legends as given in the attached screen shot?  I generated this from the excel.  I tried to generate the same using RadChart.  But I am not able to get the legends as in the attached screen shot.  

       Please advice. 

       Thank you for your help.

    Regards,
    Arvind Robin Kumar.
  2. Answer
    Velin
    Admin
    Velin avatar
    391 posts

    Posted 06 Aug 2010 Link to this post

    Hi Arvind,
    Here is some sample code that should help:
        ChartSeries s1 = new ChartSeries("1", ChartSeriesType.Pie);
        s1.DataYColumn = "Y";
        s1.Appearance.LegendDisplayMode = ChartSeriesLegendDisplayMode.ItemLabels;
     
        RadChart1.ItemDataBound += new EventHandler<ChartItemDataBoundEventArgs>(RadChart1_ItemDataBound);
     
    void RadChart1_ItemDataBound(object sender, ChartItemDataBoundEventArgs e)
    {
        e.SeriesItem.Name = "TEST";
    }


    Sincerely yours,
    Velin
    the Telerik team
    Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Arvind
    Arvind avatar
    6 posts
    Member since:
    Aug 2010

    Posted 09 Aug 2010 Link to this post

    Hi Velin,
        I added the following code and it is working fine now. 

     

    private void radChart1_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e)

     

    {

     

    DataRowView dataItem = (DataRowView)e.DataItem;

     

     

    if (dataItem != null)

     

    {

    e.SeriesItem.Name =

    Convert.ToString(dataItem["LegendName"]);

     

    }

    }


    Regards,
    Arvind Robin Kumar.
Back to Top