This is a migrated thread and some comments may be shown as answers.

Chart autoscale value

1 Answer 103 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Travis
Top achievements
Rank 1
Travis asked on 13 Jan 2009, 01:19 AM
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

1 Answer, 1 is accepted

Sort by
0
Giuseppe
Telerik team
answered on 14 Jan 2009, 09:17 AM
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.
Tags
Chart (Obsolete)
Asked by
Travis
Top achievements
Rank 1
Answers by
Giuseppe
Telerik team
Share this question
or