Two Problems - AutoLayout and XAxis DataLabelsColumn not working in code-behind

Thread is closed for posting
2 posts, 0 answers
  1. Darryl
    Darryl avatar
    17 posts
    Member since:
    Apr 2013

    Posted 15 May 2013 Link to this post


    I am running into two problems, which I think might be connected. I have a data table with about 25 values. Currently, the Chart is only showing 8 of them. Previously, when I defined the Series in the .aspx page, setting AutoLayout=true would fix this problem. But now that I am setting AutoLayout in the code-behind, I cannot get it to show all my values.

    Secondly, I have the "PlotArea.XAxis.DataLabelsColumn" value defined to one of my columns, but it never shows the values (which are date/times). I only see the numbers 0-7 for my Data Labels.

    Any suggestions appreciated. I have made many variations to the code below, without finding a solution, including setting both the DataLabelsColumn and AutoLayout in both the aspx and c# code.


    <asp:Button ID="Button1" runat="server" style="text-align: center" onclick="Button1_Click" Text="Generate Chart" />
    <telerik:RadChart ID="RadChart1" runat="server" Visible="True" AutoLayout="true">
            <XAxis DataLabelsColumn="TimeSampled">
        <ChartTitle Visible="false" />

    protected void Button1_Click(object sender, EventArgs e)
        RadChart1.AutoLayout= true;
        RadChart1.SeriesOrientation = ChartSeriesOrientation.Vertical;
        RadChart1.DefaultType = ChartSeriesType.Line;
        RadChart1.ClientSettings.ScrollMode = ChartClientScrollMode.Both;
        RadChart1.ClientSettings.EnableZoom = true;
        ChartSeries testSeries = new ChartSeries("Pages/sec", ChartSeriesType.Line);
        RadChart1.Series[0].DataYColumn = "SampleValue";
        RadChart1.Series[0].Type = ChartSeriesType.Line;
        RadChart1.Series[0].Appearance.LabelAppearance.RotationAngle = 90;
        RadChart1.PlotArea.YAxis.AxisMode = ChartYAxisMode.Extended;
        RadChart1.PlotArea.XAxis.AutoScale = false;
        RadChart1.PlotArea.XAxis.DataLabelsColumn = "TimeSampled";
        RadChart1.DataSourceID = "ChartData";
  2. Darryl
    Darryl avatar
    17 posts
    Member since:
    Apr 2013

    Posted 15 May 2013 Link to this post

    I was able to resolve this (so far, I believe...) with a few changes:
    1. Using RadChart1.DataGroupColumn
    2. Creating multiple series for my data

                    RadChart1.PlotArea.YAxis.AxisMode = ChartYAxisMode.Normal;

                    RadChart1.PlotArea.XAxis.AutoScale = true;

                    RadChart1.PlotArea.XAxis.Visible = ChartAxisVisibility.True;

    It seems a combination of changes resolved my issue.

  3. Telerik UI for ASP.NET Core is out
Back to Top