Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MatchAxesScreenDataRatio not working when X range is wider than Y range #1817

Open
drissoun opened this issue Feb 20, 2025 · 0 comments
Open

Comments

@drissoun
Copy link

Describe the bug
Using the new feature of CartesianChart MatchAxesScreenDataRatio="True", when the scater values range in X is larger than the value range in Y times the aspect ratio, the initial zoom fails at producing an orthonormal grid and the graph is cropped on the left and right edges.
What is more: zooming out does not help, and the chart behaves as if ZoomMode="PanX" .

To Reproduce
For instance Plot a List=[new(0,0), new(3,1)] on a 1:1 UI chart (same height and width)

Expected behavior

  1. Initial zoom encompassing the entire horizontal range of the data
  2. It would be great to match the separators intervals even when ForceStepToMin = false ( in the meantime, how could i implement it using a

ScreenshotsD
Using MatchAxesScreenDataRatio="True"

Image

Using a Custom axis scale, it works like a charm
as per described in your updated docs here with const int timesScale = 1;
What is more, the code is much simpler...

Image

Desktop

  • OS: W10
  • WPF
  • Livecharts Version="2.0.0-rc5.4

My understanding of the issue is the logic backing #LiveCharts2/src/LiveChartsCore
/SharedAxes.cs/ MatchSlopes(LvcSize drawMarginSize, ICartesianAxis source, ICartesianAxis target), in particular here :

 var sourceDimension = source.Orientation == AxisOrientation.X
            ? drawMarginSize.Width
            : drawMarginSize.Height;

        var sourceScreenDataRatio = sourceDimension / (maxSourceData - minSourceData);

        var targetDimension = target.Orientation == AxisOrientation.X
            ? drawMarginSize.Width
            : drawMarginSize.Height;

        var desiredTargetDelta = targetDimension / sourceScreenDataRatio;

... But I may be wrong, i am getting confused with you logic considering the prior MatchAxesScreenDataRatioDelegate

By the way, thank you again for your brilliant work. The last RC5 is great !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant