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

Legend like a rectangle

4 Answers 56 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Paulo
Top achievements
Rank 1
Paulo asked on 15 May 2012, 12:58 AM
Typically Legend has a symbol equal to a circle. How do I have a rectangle instead of a circle?

4 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 17 May 2012, 09:24 AM
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.
0
Paulo
Top achievements
Rank 1
answered on 17 May 2012, 01:12 PM
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?
0
Evgenia
Telerik team
answered on 17 May 2012, 02:53 PM
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.
0
Paulo
Top achievements
Rank 1
answered on 18 May 2012, 01:43 PM
Ok, worked. Thanks for all.
Tags
Chart (Obsolete)
Asked by
Paulo
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
Paulo
Top achievements
Rank 1
Share this question
or