Hello,
I need to show a horizontal stackedbar RadChart for several (say, 2) series, each series has one item and with some limitations for min and max values. I insert below a page with some simple code and attach 2 images. As you can see if orientation is vertical that all is perfect. But when I change orientation to horizontal one I get some exccessive bar after the last bar. Is it a bug ? How can I fix that? I use Q2 2010 version in this project. May be it is fixed in more latest versions?
I need to show a horizontal stackedbar RadChart for several (say, 2) series, each series has one item and with some limitations for min and max values. I insert below a page with some simple code and attach 2 images. As you can see if orientation is vertical that all is perfect. But when I change orientation to horizontal one I get some exccessive bar after the last bar. Is it a bug ? How can I fix that? I use Q2 2010 version in this project. May be it is fixed in more latest versions?
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Stackbar2.aspx.cs" Inherits="Stackbar2" %>
<%@ Register assembly="Telerik.Web.UI" namespace="Telerik.Charting" tagprefix="telerik" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<
html
xmlns
=
"http://www.w3.org/1999/xhtml"
>
<
head
runat
=
"server"
>
<
title
></
title
>
</
head
>
<
body
>
<
form
id
=
"form1"
runat
=
"server"
>
<
telerik:RadScriptManager
ID
=
"RadScriptManager1"
runat
=
"server"
>
</
telerik:RadScriptManager
>
<
div
>
<
telerik:RadChart
ID
=
"RadChart1"
runat
=
"server"
DefaultType
=
"StackedBar"
SeriesOrientation
=
"Vertical"
>
<
Series
>
<
telerik:ChartSeries
Name
=
"Series 1"
Type
=
"StackedBar"
>
<
Items
>
<
telerik:ChartSeriesItem
Name
=
"Item 1"
YValue
=
"190"
>
</
telerik:ChartSeriesItem
>
</
Items
>
</
telerik:ChartSeries
>
<
telerik:ChartSeries
Name
=
"Series 2"
Type
=
"StackedBar"
>
<
Items
>
<
telerik:ChartSeriesItem
Name
=
"Item 1"
YValue
=
"100"
>
</
telerik:ChartSeriesItem
>
</
Items
>
</
telerik:ChartSeries
>
</
Series
>
</
telerik:RadChart
>
<
br
/>
<
asp:Label
ID
=
"lblChartOrientation"
runat
=
"server"
Text
=
"Series orientation:"
/>
<
asp:RadioButtonList
AutoPostBack
=
"true"
ID
=
"OrientationList"
runat
=
"server"
OnSelectedIndexChanged
=
"OrientationList_SelectedIndexChanged"
>
<
asp:ListItem
Text
=
"Horizontal"
Value
=
"Horizontal"
/>
<
asp:ListItem
Text
=
"Vertical"
Value
=
"Vertical"
Selected
=
"True"
/>
</
asp:RadioButtonList
>
</
div
>
</
form
>
</
body
>
</
html
>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Telerik.Charting;
using System.Drawing;
public partial class Stackbar2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if(!IsPostBack)
Settings();
}
private void Settings()
{
ChartSeriesCollection coll = RadChart1.Series;
for (int i = 0; i < coll.Count; i++)
{
}
double yMin=110;
double yMax=400;
double step = 50;
RadChart1.PlotArea.YAxis.AddRange(yMin, yMax, step);
RadChart1.PlotArea.YAxis.AutoScale = false;
}
protected void OrientationList_SelectedIndexChanged(object sender, EventArgs e)
{
RadChart1.SeriesOrientation = (ChartSeriesOrientation)Enum.Parse(typeof(ChartSeriesOrientation), OrientationList.SelectedValue);
}
}