Skip to content

BugFixes to Rotated SignalXY plots#3921

Merged
swharden merged 5 commits intoScottPlot:mainfrom
BrianAtZetica:RotatedSignalXY
Jun 10, 2024
Merged

BugFixes to Rotated SignalXY plots#3921
swharden merged 5 commits intoScottPlot:mainfrom
BrianAtZetica:RotatedSignalXY

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
swharden added a commit that referenced this pull request Jun 10, 2024
@BrianAtZetica BrianAtZetica deleted the RotatedSignalXY branch November 8, 2025 05:40
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.

2 participants