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.

    Thanks,
    `Travis
  2. Giuseppe
    Admin
    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:

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

    Code-behind:
    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;  
        dt.Rows.Add(dr);  
      
        DataRow dr2 = dt.NewRow();  
        dr2[0] = 65;  
        dr2[1] = 75;  
        dt.Rows.Add(dr2);  
      
        RadChart1.DataSource = dt;  
        RadChart1.DataBind();  
    }  
      
    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);  
    }  



    Greetings,
    Manuel
    the Telerik team

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