using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using Telerik.Web.UI;
using System.Drawing;
using System.IO;
using Telerik.Charting;


public partial class _Default : System.Web.UI.Page
{
    private DateTime dateValue = new DateTime(2008, 4, 30);

    protected void Page_Load(object sender, EventArgs e)
    {
        ChartSeries series = new ChartSeries();
        series.Type = ChartSeriesType.Line;
        series.DataYColumn = "Value";
        series.DataXColumn = "Time";

        RadChart1.Series.Add(series);
        RadChart1.PlotArea.XAxis.Appearance.ValueFormat = Telerik.Charting.Styles.ChartValueFormat.ShortDate;
        RadChart1.PlotArea.XAxis.Appearance.LabelAppearance.RotationAngle = 45;

        RadChart1.PlotArea.XAxis.IsZeroBased = false;
        RadChart1.PlotArea.XAxis.AutoScale = false;

        double startDate = dateValue.AddDays(-2).ToOADate();
        double endDate = dateValue.AddDays(6).ToOADate();
        RadChart1.PlotArea.XAxis.AddRange(startDate, endDate, 1);

        RadChart1.DataSource = CreateTimeSource();
        RadChart1.DataBind();
    }

    private DataTable CreateTimeSource()
    {
        DataTable dt = new DataTable();
        dt.Columns.Add("Time", typeof(double));
        dt.Columns.Add("Value", typeof(int));

        DataRow dr = dt.NewRow();
        dr[0] = dateValue.ToOADate();
        dr[1] = 1;
        dt.Rows.Add(dr);

        DataRow dr2 = dt.NewRow();
        dr2[0] = dateValue.AddDays(2).ToOADate();
        dr2[1] = 5;
        dt.Rows.Add(dr2);

        DataRow dr3 = dt.NewRow();
        dr3[0] = dateValue.AddDays(4).ToOADate();
        dr3[1] = 2;
        dt.Rows.Add(dr3);

        return dt;
    }

}
