Legend like a rectangle

Thread is closed for posting
5 posts, 0 answers
  1. Paulo
    Paulo avatar
    56 posts
    Member since:
    Apr 2012

    Posted 14 May 2012 Link to this post

    Typically Legend has a symbol equal to a circle. How do I have a rectangle instead of a circle?
  2. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 17 May 2012 Link to this post

    Hello Paulo,

     You can handle the BeforeLayout or PrePaint events of RadChart and customize the Marker.Appearance.Figure property of the legend items to any of the predefined figures:

    • Cross
    • Diamond
    • Ellipse
    • Circle
    • Rectangle
    • Star3
    • Star4
    • Star5
    • Star6

    Regards,
    Evgenia
    the Telerik team
    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 their blog feed now.
  3. UI for ASP.NET Ajax is Ready for VS 2017
  4. Paulo
    Paulo avatar
    56 posts
    Member since:
    Apr 2012

    Posted 17 May 2012 Link to this post

    I have dificult to put this code.

    radChart1.Legend.Marker.Appearence.Figure = Rectangle; // Do no work ==>> Error radChart1.Legend.Marker.Appearence.Figure = radChart1.Legend.Marker.Appearence.Figure = "Rectangle";  // Do not work

    I get a example in this forum and nothing too.

    void radChart1_BeforeLayout(object sender,EventAtgs e)
    {
      radChart1.Legend.Items.Clear();
      LabelItem li = new LabelItem();
      li.Marker.Appearence.Figure = DefaultFigures.Rectangle;//Error in DefaultFigures
    .....................................
    }

    My questions is: How Can I do?
  5. Evgenia
    Admin
    Evgenia avatar
    1406 posts

    Posted 17 May 2012 Link to this post

    Hi Paulo,

    If you have one series only or you want each of the series in your chart to be with same Legend Figures you may simply use this code line:

    RadChart1.Legend.Appearance.ItemMarkerAppearance.Figure = Telerik.Charting.Styles.DefaultFigures.Rectangle;

    Otherwise you'll have to wire to PrePaint or BeforeLayout events of the chart and loop through legend items as shown below to change the Legend Figures:

    protected void RadChart1_BeforeLayout(object sender, EventArgs e) 
        foreach (LabelItem item in RadChart1.Legend.Items) 
        
            item.Marker.Appearance.Figure
     = Telerik.Charting.Styles.DefaultFigures.Rectangle;
        
    }

    Kind regards,
    Evgenia
    the Telerik team

    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 their blog feed now.
  6. Paulo
    Paulo avatar
    56 posts
    Member since:
    Apr 2012

    Posted 18 May 2012 Link to this post

    Ok, worked. Thanks for all.
Back to Top
UI for ASP.NET Ajax is Ready for VS 2017