ZoomPanOptions with AspectRatio

A forum dedicated to WPF version of LightningChart Ultimate.

Moderator: Arction_LasseP

jrvdboom
Posts: 61
Joined: Thu Apr 10, 2014 1:50 pm

ZoomPanOptions with AspectRatio

Post by jrvdboom » Tue Sep 09, 2014 9:45 am

I wrote my own routine to scale the axes of a series, so I also have margins for the X axis. Works fine:
noaspect.png
noaspect.png (23.92 KiB) Viewed 7433 times
Now I need the show the same series with an aspect ratio of 1. The calculated axes ranges are the same as for the picture above, but now the series is shown like this:
aspectwrong.png
aspectwrong.png (22.99 KiB) Viewed 7433 times
As you see, the series is cut off because the aspect ratio adjusts the X axis to match the Y axis. Instead I would have expected the range to be increased to show the entire series, like this:
aspectright.png
aspectright.png (23.23 KiB) Viewed 7433 times
Is there a setting I must adjust to get the expected behavior? Or might it be a bug?

Thanks,
Joost

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

Re: ZoomPanOptions with AspectRatio

Post by ArctionPasi » Mon Sep 15, 2014 5:20 am

If graph area (width * aspectratio) < height, Y axis range is set by X range.
If graph area height < (width * aspectratio), X axis range is set by Y range.

It is by design.
LightningChart Support Team, PT

jrvdboom
Posts: 61
Joined: Thu Apr 10, 2014 1:50 pm

Re: ZoomPanOptions with AspectRatio

Post by jrvdboom » Mon Sep 15, 2014 9:45 am

The I would like to propose an extension of the design (maybe through an extra setting):

When the min and max of the axes are explicitly set:
- if aspect ratio of axes > aspect ratio of graph, then Y is set by X
- if aspect ratio of axes < aspect ratio of graph, the X is set by Y

(where aspect ratio of axes = (max Y - min Y) / (max X - min X))

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

Re: ZoomPanOptions with AspectRatio

Post by ArctionPasi » Mon Sep 15, 2014 10:08 am

We can't do that unfortunately. There's no telling if the axis Minimum and Maximum properties are set by user or by internal zooming logic, panning, touch events, or SetRange method.

Please make your own logic based on event handlers of the chart. For example, hook into chart.SizeChanged, xAxis and yAxis RangeChanged, Zoomed etc. events, and calculate the new axis ranges based on your needs. If you do that, disable aspect ratio in ZoomPanOptions.
LightningChart Support Team, PT

jrvdboom
Posts: 61
Joined: Thu Apr 10, 2014 1:50 pm

Re: ZoomPanOptions with AspectRatio

Post by jrvdboom » Mon Sep 15, 2014 10:14 am

You're right, min and max won't do. But what about the RangeRevertMinimum and RangeRevertMaximum, because those are the min and max I set in my custom logic. I also have ZoomPanOptions.RightToLeftZoomAction set to RevertAxisRanges.