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" > |
<Series> |
<telerik:ChartSeries Name="Series 1"> |
<Appearance Corners="Round, Round, Rectangle, Rectangle, 3"> |
</Appearance> |
<Items> |
<telerik:ChartSeriesItem Name="Item 1" YValue="10"> |
</telerik:ChartSeriesItem> |
<telerik:ChartSeriesItem Name="Item 2" YValue="30"> |
</telerik:ChartSeriesItem> |
<telerik:ChartSeriesItem Name="Item 3" YValue="-10"> |
</telerik:ChartSeriesItem> |
<telerik:ChartSeriesItem Name="Item 4" YValue="10"> |
</telerik:ChartSeriesItem> |
</Items> |
</telerik:ChartSeries> |
</Series> |
<ChartTitle> |
<TextBlock Text="Rounded Negative Corner"> |
<Appearance TextProperties-Color="Black" TextProperties-Font="Arial, 18pt"> |
</Appearance> |
</TextBlock> |
</ChartTitle> |
</telerik:RadChart> |
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.