Legend Appearance

Thread is closed for posting
4 posts, 0 answers
  1. Rabeek Ahamed
    Rabeek Ahamed avatar
    20 posts
    Member since:
    Sep 2012

    Posted 06 Apr 2011 Link to this post

    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 -  -  -  -  -  - )
  2. Evgenia
    Evgenia avatar
    1437 posts

    Posted 11 Apr 2011 Link to this post

    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,
    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. brian
    brian avatar
    2 posts
    Member since:
    Apr 2008

    Posted 03 Aug 2012 Link to this post

    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.
  4. Evgenia
    Evgenia avatar
    1437 posts

    Posted 07 Aug 2012 Link to this post

    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.

    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.
Back to Top