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

BugFixes to Rotated SignalXY plots #3921

Merged
merged 5 commits into from
Jun 10, 2024

Conversation

BrianAtZetica
Copy link
Contributor

Reolution for #3812 had introduced an incorrect final pixel location for rotated SignalXY plots.
This was resolved by a swapping of Xs and Ys coordinates when defining the additional "lastPoint" value.
Note, we could consider renaming Xs and Ys to something like independentValues and dependentValues respectively. Not sure if that will be intuitove to all developers though.

Using the sample code provided in comment on #3812 the fix provided no longer shows a distored line at top of the plot:
image

Second bug was pre-existing, and became apparent when zoomed into the series to observe the final pixel.
Rotated SignalXY series were performing an incorrect interpolation for the final pixel location (another mix-up of Xs and Ys).

Code to demonstrate this issue is as follows:

        InitializeComponent();

        double[] X = new double[2];
        double[] Y = new double[2];
        X[0] = -10;
        X[1] = 10;
        Y[0] = 1;
        Y[1] = 2;

        var signal = WpfPlot1.Plot.Add.SignalXY(X, Y, color: ScottPlot.Colors.Black);
        signal.Data.Rotated = false;
        var signalrotated = WpfPlot1.Plot.Add.SignalXY(X, Y, color: ScottPlot.Colors.Black);
        signalrotated.Data.Rotated = true;

This plots a normal SignalXY and a rotated SignalXY on the same graph.
Before the bug fix, this becomes distorted when panning the content up or down:

image

After the bug fix the plot keeps its cross shape while scrolling off the page in any direction:
image

@BrianAtZetica BrianAtZetica marked this pull request as draft June 9, 2024 08:20
@BrianAtZetica
Copy link
Contributor Author

Discovered there is still a problem if Y axis is inverted. Working on this further...

@BrianAtZetica BrianAtZetica marked this pull request as ready for review June 9, 2024 09:00
@swharden swharden enabled auto-merge (squash) June 10, 2024 12:41
@swharden swharden merged commit c89c357 into ScottPlot:main Jun 10, 2024
3 checks passed
swharden added a commit that referenced this pull request Jun 10, 2024
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

Successfully merging this pull request may close these issues.

None yet

2 participants