This is a migrated thread and some comments may be shown as answers.
Legend Appearance
3 Answers 46 Views
This is a migrated thread and some comments may be shown as answers.
Rabeek Ahamed
Top achievements
Rank 1
Rabeek Ahamed asked on 06 Apr 2011, 02:21 PM
I am developing line charts. I have two chart series items. One of the chart series style is Line another one is Dashed line. I want  the legend appearance exactly like how the series item is appeared in the chart. (like ----------- and -  -  -  -  -  - )

3 Answers, 1 is accepted

Sort by
0
Evgenia
Telerik team
answered on 11 Apr 2011, 08:27 AM
Hello Rabeek,

You can handle the BeforeLayout or PrePaint events of RadChart and customize the Marker.Appearance.Figure of the legend items to any of the predefined figures (unfortunately there is no predefined dashed line figure):
  • Cross
  • Diamond
  • Ellipse
  • Circle
  • Rectangle
  • Star3
  • Star4
  • Star5
  • Star6

What I can suggest you is to set the Figure of the LegendItem Marker to Rectangle and set custom Height  and Width for it so that it looks like a Line:

protected void RadChart1_BeforeLayout(object sender, EventArgs e)
   {
           RadChart1.Legend.Items[1].Marker.Appearance.Figure = "Rectangle";
           RadChart1.Legend.Items[1].Marker.Appearance.Dimensions.AutoSize = false;
           RadChart1.Legend.Items[1].Marker.Appearance.Dimensions.Width = 6;            
           RadChart1.Legend.Items[1].Marker.Appearance.Dimensions.Height = 2;
   }
You can find more information on customizing the legend appearance here.

All the best,
Evgenia
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
0
brian
Top achievements
Rank 1
answered on 03 Aug 2012, 06:27 PM
This is a going to be a recurring issues for Telerik support. Here is is application scenario -
I have period bar and accumulative line tied in pairs. We got accumulative line by summing up the periodic data.

So they have to be in the same color. Then how can we tell them apart? I think there are 2 options: change line thickness and change pen style. Unfortunately I have to use both. Accumulative curves on my chart looks thinner than the periodic bar, and for future accumulative forecast, I have to show the line type (pen type by your term) difference in the same color.

Since Telerik RadChart is not supporting legend marker by pen style, we are going though the painful process of re-evaluating this toolbox.
0
Evgenia
Telerik team
answered on 07 Aug 2012, 08:21 AM
Hi brian,

 As you can see in our documentation only Line and Spline Series support PenStyle property. Since there is no predefined line Legend Marker, you can't have a dashed/dotted line in the legend. However you may consider adding an image instead of using a predefined shape as legend item marker. This is described here.

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.
Asked by
Rabeek Ahamed
Top achievements
Rank 1
Answers by
Evgenia
Telerik team
brian
Top achievements
Rank 1
Share this question
or