I need to create stacked bar data from code and cannot find a working example. Below is some code I've pieces together from other samples this does group the bars but they are not stacked correctly. I can make this work in a RadChart but we are trying to move away from the old control
<telerik:RadHtmlChart ID="RadHtmlChart1" runat="server" Width="625" > <ChartTitle Text="My test chart"/></telerik:RadHtmlChart>
protected void Page_Load(object sender, EventArgs e) { int numSeries = GetData().Columns.Count - 2; for (int i = 0; i < numSeries; i++) { BarSeries currLineSeries = new BarSeries { DataFieldY = GetData().Columns[2 + i].Caption, Stacked = true, StackType = HtmlChartStackType.Normal, GroupName = "Weeks", Gap = 2 }; RadHtmlChart1.PlotArea.Series.Add(currLineSeries); } RadHtmlChart1.PlotArea.XAxis.DataLabelsField = "Weeks"; RadHtmlChart1.DataSource = GetData(); RadHtmlChart1.DataBind();} protected DataTable GetData() { DataTable dt = new DataTable(); dt.Columns.Add("ID"); dt.Columns.Add("Weeks"); dt.Columns.Add("a111"); dt.Columns.Add("a112"); dt.Columns.Add("a119"); dt.Rows.Add(1, "1/3/2011", 4, 46, 117); dt.Rows.Add(2, "1/10/2011", 12, 62, 112); dt.Rows.Add(3, "1/17/2011", 6, 79, 132); return dt; }