I have a chart that is displaying 365 days of data and I want the X axis labeled only by month. Seems like a simple request but after spending considerable time looking at documentation and numerous forum posts, it looks like it is not as easy as it seems. I have also included an image of how my chart renders. I can get the range on the x axis to display fine however the plotted line does not extend to the end of the graph. Even if the monthly labels are impossible to achieve, I need to AT LEAST get that plotted line to scale to the end of the graph. Of course when I turn the auto scaling on the X axis range does not work.
Here is my chart and code behind.
<telerik:RadChart ID="rc1" runat="server" DataSourceID="SqlDataSource1" DefaultType="Line"
Width="600px">
<Series>
<telerik:ChartSeries DataYColumn="ClosePrice" Name="ClosePrice" Type="Line">
<Appearance ShowLabels="false">
<FillStyle MainColor="213, 247, 255">
</FillStyle>
</Appearance>
</telerik:ChartSeries>
</Series>
<Legend Visible="False">
<Appearance Visible="False">
</Appearance>
</Legend>
<PlotArea XAxis-AutoScale="False">
<Appearance Dimensions-Margins="18%, 5%, 22%, 10%">
</Appearance>
<XAxis LayoutMode="Inside" AutoScale="false" LabelStep="45">
<Appearance ValueFormat="ShortDate" MajorGridLines-Visible="false">
<LabelAppearance RotationAngle="45" Position-AlignedPosition="Top">
</LabelAppearance>
</Appearance>
</XAxis>
<YAxis IsZeroBased="false" AxisMode="Extended">
</YAxis>
</PlotArea>
<ChartTitle>
<TextBlock Text="Title Here" />
</ChartTitle>
</telerik:RadChart>
SqlDataSource1.SelectCommand = "select * from BofIHistoricalData where datadate between '" +
DateTime.Now.Date.AddMonths(-12).ToString() + "' and '" + DateTime.Now.Date.AddDays(-1) + "'" +
"order by datadate";
double today = DateTime.Now.Date.ToOADate();
double lastYear = DateTime.Now.Date.AddMonths(-12).ToOADate();
rc1.PlotArea.XAxis.AddRange(lastYear, today, 1);
Here is my chart and code behind.
<telerik:RadChart ID="rc1" runat="server" DataSourceID="SqlDataSource1" DefaultType="Line"
Width="600px">
<Series>
<telerik:ChartSeries DataYColumn="ClosePrice" Name="ClosePrice" Type="Line">
<Appearance ShowLabels="false">
<FillStyle MainColor="213, 247, 255">
</FillStyle>
</Appearance>
</telerik:ChartSeries>
</Series>
<Legend Visible="False">
<Appearance Visible="False">
</Appearance>
</Legend>
<PlotArea XAxis-AutoScale="False">
<Appearance Dimensions-Margins="18%, 5%, 22%, 10%">
</Appearance>
<XAxis LayoutMode="Inside" AutoScale="false" LabelStep="45">
<Appearance ValueFormat="ShortDate" MajorGridLines-Visible="false">
<LabelAppearance RotationAngle="45" Position-AlignedPosition="Top">
</LabelAppearance>
</Appearance>
</XAxis>
<YAxis IsZeroBased="false" AxisMode="Extended">
</YAxis>
</PlotArea>
<ChartTitle>
<TextBlock Text="Title Here" />
</ChartTitle>
</telerik:RadChart>
SqlDataSource1.SelectCommand = "select * from BofIHistoricalData where datadate between '" +
DateTime.Now.Date.AddMonths(-12).ToString() + "' and '" + DateTime.Now.Date.AddDays(-1) + "'" +
"order by datadate";
double today = DateTime.Now.Date.ToOADate();
double lastYear = DateTime.Now.Date.AddMonths(-12).ToOADate();
rc1.PlotArea.XAxis.AddRange(lastYear, today, 1);