This is a migrated thread and some comments may be shown as answers.

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

1 Answer 41 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Darryl
Top achievements
Rank 1
Darryl asked on 15 May 2013, 12:59 PM
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();
}

1 Answer, 1 is accepted

Sort by
0
Darryl
Top achievements
Rank 1
answered on 15 May 2013, 05:49 PM
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.

Tags
Chart (Obsolete)
Asked by
Darryl
Top achievements
Rank 1
Answers by
Darryl
Top achievements
Rank 1
Share this question
or