I'm having an issue I can't find any similar posts to so here goes.
I am generating a pivot table using Linq where I won't know the column names until run-time. So I am creating the data series in codebdhind and then binding the Radhtmlchart to the data table. Things work somewhat well but for one problem. Each new series I add changes the Y-Axis scale by a factor of 10. I have added images below to show how it grows (data points are set to 1 or 2 in each case for simplicity). Note that the Y-axis grows from roughly 1 to 10 to 100 and the column height of each successive series is correspondingly bigger.
Here is the aspx for the Chart:
<telerik:RadHtmlChart ID="RadHtmlChart1" runat="server"> <PlotArea> <XAxis DataLabelsField="DayHour"> <LabelsAppearance Step="4"> </LabelsAppearance> </XAxis> <YAxis Type="Numeric"> <LabelsAppearance Step="1"> </LabelsAppearance> </YAxis> </PlotArea> <Appearance> <FillStyle BackgroundColor="Transparent"></FillStyle> </Appearance> <ChartTitle Text="Hourly Clicks"> <Appearance Align="Center" BackgroundColor="Transparent" Position="Top"> <TextStyle Bold="true" FontSize="24px" /> </Appearance> </ChartTitle> <Legend> <Appearance BackgroundColor="Transparent" Position="Bottom"></Appearance> </Legend></telerik:RadHtmlChart>
And here is the codebehind where I generate the ColumnSeries dynamically and bind. There is some code to test different configurations of the 'stacked' attribute based on some older articles I saw but it was not helpful. T is the Data Table and looks exactly as it should.
int i = T.Columns.Count;bool bstacked = true;foreach (DataColumn col in T.Columns){ if (col.ColumnName == "DayHour") continue; ColumnSeries newSeries = new ColumnSeries(); newSeries.Name = col.ColumnName; newSeries.GroupName = "colGroup"; newSeries.DataFieldY = col.ColumnName; i--; if (i == 1) bstacked = false; newSeries.Stacked = bstacked; newSeries.LabelsAppearance.Position = Telerik.Web.UI.HtmlChart.BarColumnLabelsPosition.OutsideEnd; RadHtmlChart1.PlotArea.Series.Add(newSeries);}RadHtmlChart1.DataSource = T;RadHtmlChart1.DataBind();
I would appreciate any help with this.
Thanks.
