Separated Axis autofit

A forum dedicated to WinForms version of LightningChart Ultimate.

Moderator: Arction_LasseP

Igor
Posts: 67
Joined: Mon Sep 28, 2015 1:14 pm

Separated Axis autofit

Post by Igor » Mon Mar 06, 2017 9:37 am

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

ArctionKestutis
Posts: 386
Joined: Mon Mar 14, 2016 9:22 am

Re: Separated Axis autofit

Post by ArctionKestutis » Mon Mar 06, 2017 1:06 pm

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