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

    Hello,

    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.

    Thanks

    <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">
        <PlotArea>
            <XAxis DataLabelsColumn="TimeSampled">
            </XAxis>
        </PlotArea>
        <ChartTitle Visible="false" />
    </telerik:RadChart>


    protected void Button1_Click(object sender, EventArgs e)
    {
        RadChart1.AutoLayout= true;
        RadChart1.Height=450;
        RadChart1.Width=950;
        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.AddChartSeries(testSeries);
        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";
        RadChart1.DataBind();
    }
  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
    3. 

                    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. UI for ASP.NET Ajax is Ready for VS 2017
Back to Top