We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

Automatic ranges question

I have a chart that I know will have only positive values for the Y axis. I don''t know what the maximum value will be. How can I make my chart automatically determine the Y axis range but force it to always start at zero? ie. have a minimum range value of 0. As it is right now, the Y axis always has a lower (minimum) range that starts from negative 1000 although the data is ALWAYS positive! I need it to start at zero yet automatically determine the maximum value.

5 Replies

DJ Davis Jebaraj Syncfusion Team November 8, 2004 03:14 PM UTC

Hi, You can explicitly set the Min of the AxisRange to be 0. Please refer to the sample linked to below: http://www.syncfusion.com/support/user/uploads/chartaxisrangeadjust.zip this.chartControl1.PrimaryYAxis.DimensionsChanged += new EventHandler(this.YAxisChangedHandler); private void YAxisChangedHandler(object sender, EventArgs e) { AdjustYAxis(); } private void AdjustYAxis() { this.chartControl1.PrimaryYAxis.Range.Min =0; } Thanks, Davis

AD Administrator Syncfusion Team November 8, 2004 03:54 PM UTC

Thanks Davis. Is it me or does it not seem a little strange that if I set the minimum Y axis value to something one time, that I should have to keep checking (via the changehandler) and keep resetting it? What if I set it in the property page? Do I then need to have a changehandeler to keep resetting it? Kinda defeats the purpose of setting the property in the first place does it not?

DJ Davis Jebaraj Syncfusion Team November 9, 2004 03:28 AM UTC

Hi, The alternative would be to set the RangeType to be ChartAxisRangeType.Set In this case, the Range will not be automatically recomputed if the data changes. The approach with the event handling does not disable the automatic range calculation. Thanks, Davis

JE Jeff January 11, 2008 08:21 PM UTC

I think this is a really useful post and I was wondering if perhaps it could be put into an FAQ... or better yet, fix the search in the forums so this doesn't take me an hour to find this information... Just some thoughts

AL Aymiee Lee November 20, 2009 06:24 PM UTC

Setting the RangeType to be ChartAxisRangeType.Set is not recomputing the range type.

on the same chartcontrol:
A - user runs first report: double on X axis and double on Y axis
B - user runs second report: date on X axis and double on Y axis.

Even though I use ChartAxisRangeType.Set, somehow the rangetype still thinks it is plotting double on X when its it is supposed to be date.

how do I recompute the rangetype other than using ChartAxisRangeType.Set?

ChartAxisRangeType.Auto does not work either.

Live Chat Icon For mobile
Up arrow icon