Overriding scaling decisions in YAxis Autofit

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Queue Moderators

Post Reply
NielsUll
Posts: 19
Joined: Thu Jan 19, 2017 8:23 am

Overriding scaling decisions in YAxis Autofit

Post by NielsUll » Fri Jan 20, 2017 10:56 am

Hi!

For some xy graphs, we would like handle scaling in a customized way: The Y minimum should be 0 and the Y maximum should always be rounded up to 10^n, 2*10^n or 5*10^n.
So 0.01, 200 or 5, but not 15 or 3.5 - in this case the axis should go to 20 or 5 respectively.

Now, we can do the computation ourselves, given the max Y value - but is there an easy way to make this be called when AutoFit is used?

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Overriding scaling decisions in YAxis Autofit

Post by ArctionPasi » Sun Jan 22, 2017 7:34 am

Hello.

You can set chart.ViewXY.ZoomPanOptions.RightToLeftZoomAction = RevertAxisRanges.

When applying zoom-to-fit gesture (default action for right-to-left zooming) it will set X and Y axes ranges from

xAxis.RangeRevertMinimum to xAxis.RangeRevertMaximum

and

yAxis.RangeRevertMinimum to yAxis.RangeRevertMaximum

So, store your preferred scaling values in these properties.

If you want to exclude either axis from range revert, set that axis' RangeRevertEnabled = False.

I hope this helps :)
LightningChart Support Team, PT

NielsUll
Posts: 19
Joined: Thu Jan 19, 2017 8:23 am

Re: Overriding scaling decisions in YAxis Autofit

Post by NielsUll » Mon Jan 23, 2017 7:19 am

I'm afraid this is not exactly what i was looking for.
Assume we have s graph that's more or less a straight line from 0,0 to 100,100.
Now, the user zooms in on the xrange to see [5;30]. In this case, I want the YAxis to adjust to [0;50].
When he then zooms further into [8;12], I want the YAxis to adjust to [0;20].

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Overriding scaling decisions in YAxis Autofit

Post by ArctionPasi » Mon Jan 23, 2017 7:53 am

Ok. Please set RangeChanged event handler for the X axis. In the event handler, call yAxis.SetRange with preferred range.
LightningChart Support Team, PT

Post Reply