Page 1 of 1

Separated Axis autofit

Posted: Mon Mar 06, 2017 9:37 am
by Igor
Hi,

I would like to implement axis autofit separated for each axis (Y and X-Axis).

I've set the global property to true, so that autofit is enabled in general.

Code: Select all

ViewXy.ZoomPanOptions.AutoYFit.Enabled = true;
Then I can enable the autofit for every Y-Axis.

Code: Select all

var axisY = Axis as AxisY;
                if (axisY != null)
                    axisY.AllowAutoYFit = true;
But there aren't equivalent properties for X-Axes.
Is there an another way to implement this behavior?

thank you very much

Igor

Re: Separated Axis autofit

Posted: Mon Mar 06, 2017 1:06 pm
by ArctionKestutis
Hi Igor,

The Autofit x-axis property is not available - it would be to complicating to combine with Scrolling property.
However, you have several options how to implement this behavior. You need to create another Timer for x-axis. Afterwards, you can use either method

Code: Select all

_chart.ViewXY.ZoomToFit();
(if want to fit x and y at the same time),
or

Code: Select all

_chart.ViewXY.XAxes[0].Fit();
(if you want to fit just x-axis values).

You can use

Code: Select all

_chart.ViewXY.XAxes[0].SetRange(minX,maxX);
at any given moment if you know minimum and maximum.

All the best,
Kestutis