Rounded Corners and negative values

Thread is closed for posting
2 posts, 0 answers
  1. XXXX
    XXXX avatar
    57 posts
    Member since:
    Jun 2008

    Posted 26 Jan 2010 Link to this post

    When applying round to top corners on a Bar chart doesn't give the results I was looking for for negative values.
    On the bars presenting negative values the actual top corners are rounded not the corners that are furtherst away from the axis.

    This markup for a chart displays this:

    <telerik:RadChart ID="RadChart1" runat="server" > 
          <telerik:ChartSeries Name="Series 1">  
             <Appearance Corners="Round, Round, Rectangle, Rectangle, 3">  
                <telerik:ChartSeriesItem Name="Item 1" YValue="10">  
                <telerik:ChartSeriesItem Name="Item 2" YValue="30">  
                <telerik:ChartSeriesItem Name="Item 3" YValue="-10">  
                <telerik:ChartSeriesItem Name="Item 4" YValue="10">  
          <TextBlock Text="Rounded Negative Corner">  
             <Appearance TextProperties-Color="Black" TextProperties-Font="Arial, 18pt">  

    A workaround for this is simple for static chart (like the one above) all that is needed is to apply <Appearance Corners="Rectangle, Rectangle, Round, Round, 3" /> to the items with negative values.
    The following code (C#) does this on itemDataBound for charts that are databound.
            protected void RadChart1_ItemDataBound(object sender, Telerik.Charting.ChartItemDataBoundEventArgs e)  
                    if (e.SeriesItem.YValue < 0)  
                        e.SeriesItem.Appearance.Corners.BottomLeft = Telerik.Charting.Styles.CornerType.Round;  
                        e.SeriesItem.Appearance.Corners.BottomRight = Telerik.Charting.Styles.CornerType.Round;  
                        e.SeriesItem.Appearance.Corners.TopLeft = Telerik.Charting.Styles.CornerType.Rectangle;  
                        e.SeriesItem.Appearance.Corners.TopRight = Telerik.Charting.Styles.CornerType.Rectangle;  

    Hope this can be of help to someone.
  2. Ves
    Ves avatar
    2926 posts

    Posted 28 Jan 2010 Link to this post

    Hello Bjössi,

    Thanks for sharing your solution. Your Telerik points have been updated.

    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Back to Top