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.Charting;
using Telerik.Charting.Styles;
using System.Drawing;
using System.Collections.Generic;
using Telerik.Web.UI;

public partial class _Default : System.Web.UI.Page
{
    public int[] Data
    {
        get
        {
            return new int[] { 14, 12, 16, 3, 17, 9, 10, 14, 12, 16, 3, 17, 9, 10, 14, 12, 16, 3, 17, 9, 10 };
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        if (ViewState["CHART_CREATED"] != null)
        {
            RadChart chart = new RadChart();
            chart.ID = "RadChart1";
            this.Placeholder1.Controls.Add(chart);
        }
    }

    protected void Button1_Click(object sender, EventArgs e)
    {
        if (ViewState["CHART_CREATED"] == null)
        {
            RadChart chart = new RadChart();
            chart.ID = "RadChart1";
            this.Placeholder1.Controls.Add(chart);

            chart.DefaultType = ChartSeriesType.Line;
            chart.ClientSettings.ScrollMode = ChartClientScrollMode.XOnly;
            chart.ClientSettings.XScale = 2;
            chart.DataSource = this.Data;
            chart.DataBind();

            ViewState["CHART_CREATED"] = true;
        }
    }
}
