Chart autoscale value

Thread is closed for posting
2 posts, 0 answers
  1. Travis
    Travis avatar
    8 posts
    Member since:
    Nov 2007

    Posted 12 Jan 2009 Link to this post

    I have a bar chart with multiple series and I have the YAxis autoscale set to true.  Is there anyway to get a handle on the generated max YAxis and step value as I would like to reuse these values.

  2. Giuseppe
    Giuseppe avatar
    2363 posts

    Posted 14 Jan 2009 Link to this post

    Hello Travis,

    You can achieve the desired functionality by handling the BeforeLayout server-side event like that:

    <telerik:RadChart ID="RadChart1" runat="server" OnBeforeLayout="RadChart1_BeforeLayout">  

    protected void Page_Load(object sender, EventArgs e)  
        DataTable dt = new DataTable();  
        dt.Columns.Add("Data1", typeof(int));  
        dt.Columns.Add("Data2", typeof(int));  
        DataRow dr = dt.NewRow();  
        dr[0] = 70;  
        dr[1] = 30;  
        DataRow dr2 = dt.NewRow();  
        dr2[0] = 65;  
        dr2[1] = 75;  
        RadChart1.DataSource = dt;  
    protected void RadChart1_BeforeLayout(object sender, EventArgs e)  
        Response.Write("YAxis MaxValue: " + RadChart1.PlotArea.YAxis.MaxValue);  
        Response.Write("<br />");  
        Response.Write("YAxis Step " + RadChart1.PlotArea.YAxis.Step);  

    the Telerik team

    Check out Telerik Trainer, the state of the art learning tool for Telerik products.
Back to Top