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

Y Axis Major Ticks / Labels

1 Answer 49 Views
Chart (Obsolete)
This is a migrated thread and some comments may be shown as answers.
Mark
Top achievements
Rank 1
Mark asked on 12 Feb 2009, 01:55 PM
Hi,
I have a chart that displays the qty (y axis) against salesperson (x axis).

The problem i am having is, when the hightest qty is a low number (eg; 2) the major ticks shown are 0.2, 0.4, 0.6 etc...
I dont want this, i just want whole numbers to be shown.
I cant use autoscale (i assume this) as i dont know what the qty will be until the chart is generated.

Can you please help ?
Thanks
Mark

1 Answer, 1 is accepted

Sort by
0
Ves
Telerik team
answered on 13 Feb 2009, 03:10 PM
Hello Mark,

You can take advantage of BeforeLayout event. At the moment this event is fired, the axis calculations are already performed, so you have the information about the calculated max value. Now you can set AutoScale to false, clear the existing axis items and populate the axis again according to your requirements. Here is an example:

protected void RadChart1_BeforeLayout(object sender, EventArgs e) 
    { 
        double max = Math.Floor(RadChart1.PlotArea.YAxis.MaxValue); 
        RadChart1.PlotArea.YAxis.Clear(); 
        RadChart1.PlotArea.YAxis.AutoScale = false
        RadChart1.PlotArea.YAxis.AddRange(0, max, 1); 
    } 

Hope this helps.

Best wishes,
Ves
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Check out the tips for optimizing your support resource searches.
Tags
Chart (Obsolete)
Asked by
Mark
Top achievements
Rank 1
Answers by
Ves
Telerik team
Share this question
or